"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .pausemode import PauseMode
from .pausestatus import PauseStatus
from .resumemode import ResumeMode
from .status import Status
from flexprice_py.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Dict, Optional
from typing_extensions import NotRequired, TypedDict


class DtoSubscriptionPauseResponseTypedDict(TypedDict):
    r"""Response object containing subscription pause information"""

    created_at: NotRequired[str]
    created_by: NotRequired[str]
    environment_id: NotRequired[str]
    r"""EnvironmentID is the environment identifier for the pause"""
    id: NotRequired[str]
    r"""ID is the unique identifier for the subscription pause"""
    metadata: NotRequired[Dict[str, str]]
    original_period_end: NotRequired[str]
    r"""OriginalPeriodEnd is the end of the billing period when the pause was created"""
    original_period_start: NotRequired[str]
    r"""OriginalPeriodStart is the start of the billing period when the pause was created"""
    pause_end: NotRequired[str]
    r"""PauseEnd is when the pause will end (null for indefinite)"""
    pause_mode: NotRequired[PauseMode]
    pause_start: NotRequired[str]
    r"""PauseStart is when the pause actually started"""
    pause_status: NotRequired[PauseStatus]
    reason: NotRequired[str]
    r"""Reason is the reason for pausing"""
    resume_mode: NotRequired[ResumeMode]
    resumed_at: NotRequired[str]
    r"""ResumedAt is when the pause was actually ended (if manually resumed)"""
    status: NotRequired[Status]
    subscription_id: NotRequired[str]
    r"""SubscriptionID is the identifier for the subscription"""
    tenant_id: NotRequired[str]
    updated_at: NotRequired[str]
    updated_by: NotRequired[str]


class DtoSubscriptionPauseResponse(BaseModel):
    r"""Response object containing subscription pause information"""

    created_at: Optional[str] = None

    created_by: Optional[str] = None

    environment_id: Optional[str] = None
    r"""EnvironmentID is the environment identifier for the pause"""

    id: Optional[str] = None
    r"""ID is the unique identifier for the subscription pause"""

    metadata: Optional[Dict[str, str]] = None

    original_period_end: Optional[str] = None
    r"""OriginalPeriodEnd is the end of the billing period when the pause was created"""

    original_period_start: Optional[str] = None
    r"""OriginalPeriodStart is the start of the billing period when the pause was created"""

    pause_end: Optional[str] = None
    r"""PauseEnd is when the pause will end (null for indefinite)"""

    pause_mode: Optional[PauseMode] = None

    pause_start: Optional[str] = None
    r"""PauseStart is when the pause actually started"""

    pause_status: Optional[PauseStatus] = None

    reason: Optional[str] = None
    r"""Reason is the reason for pausing"""

    resume_mode: Optional[ResumeMode] = None

    resumed_at: Optional[str] = None
    r"""ResumedAt is when the pause was actually ended (if manually resumed)"""

    status: Optional[Status] = None

    subscription_id: Optional[str] = None
    r"""SubscriptionID is the identifier for the subscription"""

    tenant_id: Optional[str] = None

    updated_at: Optional[str] = None

    updated_by: Optional[str] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "created_at",
                "created_by",
                "environment_id",
                "id",
                "metadata",
                "original_period_end",
                "original_period_start",
                "pause_end",
                "pause_mode",
                "pause_start",
                "pause_status",
                "reason",
                "resume_mode",
                "resumed_at",
                "status",
                "subscription_id",
                "tenant_id",
                "updated_at",
                "updated_by",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m
