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

from __future__ import annotations
from flexprice_py.types import BaseModel, UNSET_SENTINEL
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class DtoGetCostAnalyticsRequestTypedDict(TypedDict):
    end_time: NotRequired[str]
    expand: NotRequired[List[str]]
    r"""Expand options - specify which entities to expand"""
    external_customer_id: NotRequired[str]
    r"""Optional - for specific customer"""
    feature_ids: NotRequired[List[str]]
    r"""Additional filters"""
    limit: NotRequired[int]
    r"""Pagination"""
    offset: NotRequired[int]
    start_time: NotRequired[str]
    r"""Time range fields (optional - defaults to last 7 days if not provided)"""


class DtoGetCostAnalyticsRequest(BaseModel):
    end_time: Optional[str] = None

    expand: Optional[List[str]] = None
    r"""Expand options - specify which entities to expand"""

    external_customer_id: Optional[str] = None
    r"""Optional - for specific customer"""

    feature_ids: Optional[List[str]] = None
    r"""Additional filters"""

    limit: Optional[int] = None
    r"""Pagination"""

    offset: Optional[int] = None

    start_time: Optional[str] = None
    r"""Time range fields (optional - defaults to last 7 days if not provided)"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "end_time",
                "expand",
                "external_customer_id",
                "feature_ids",
                "limit",
                "offset",
                "start_time",
            ]
        )
        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
