# Copyright (c) 2024 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com
from datetime import datetime
from typing import NamedTuple, List, Optional

from czc.type_util import deserializable

from .types import BillingIngestStatus, PausedState


@deserializable()
class BillingIngestStatusEvent(NamedTuple):
    organization_id: str
    connection_id: str
    status: BillingIngestStatus
    start_time: Optional[datetime] = None
    end_time: Optional[datetime] = None
    message: Optional[str] = None
    details: Optional[dict] = None  # Changing this from Optional[str] is a breaking change
    billing_periods: Optional[List[str]] = None  # This makes more sense to be part of the details field, but will also be a breaking change


@deserializable()
class BillingConnectionEnabledEvent(NamedTuple):
    cz_organization_id: str
    connection_id: str
    is_enabled: bool
    paused_state: PausedState
