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

from __future__ import annotations
from .resumemode import ResumeMode
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 DtoResumeSubscriptionRequestTypedDict(TypedDict):
    r"""Request object for resuming a paused subscription"""

    resume_mode: ResumeMode
    dry_run: NotRequired[bool]
    r"""Whether to perform a dry run
    @Description If true, validates the request and shows impact without actually resuming the subscription
    @Example false
    """
    metadata: NotRequired[Dict[str, str]]
    r"""Additional metadata as key-value pairs
    @Description Optional metadata for storing additional information about the resume operation
    @Example {\"resumed_by\": \"admin\", \"reason\": \"issue_resolved\"}
    """


class DtoResumeSubscriptionRequest(BaseModel):
    r"""Request object for resuming a paused subscription"""

    resume_mode: ResumeMode

    dry_run: Optional[bool] = None
    r"""Whether to perform a dry run
    @Description If true, validates the request and shows impact without actually resuming the subscription
    @Example false
    """

    metadata: Optional[Dict[str, str]] = None
    r"""Additional metadata as key-value pairs
    @Description Optional metadata for storing additional information about the resume operation
    @Example {\"resumed_by\": \"admin\", \"reason\": \"issue_resolved\"}
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["dry_run", "metadata"])
        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
