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

from __future__ import annotations
from .alertsettings import AlertSettings, AlertSettingsTypedDict
from .featuretype import FeatureType
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 GithubComFlexpriceFlexpriceInternalDomainFeatureFeatureTypedDict(TypedDict):
    alert_settings: NotRequired[AlertSettingsTypedDict]
    created_at: NotRequired[str]
    created_by: NotRequired[str]
    description: NotRequired[str]
    environment_id: NotRequired[str]
    id: NotRequired[str]
    lookup_key: NotRequired[str]
    metadata: NotRequired[Dict[str, str]]
    meter_id: NotRequired[str]
    name: NotRequired[str]
    status: NotRequired[Status]
    tenant_id: NotRequired[str]
    type: NotRequired[FeatureType]
    unit_plural: NotRequired[str]
    unit_singular: NotRequired[str]
    updated_at: NotRequired[str]
    updated_by: NotRequired[str]


class GithubComFlexpriceFlexpriceInternalDomainFeatureFeature(BaseModel):
    alert_settings: Optional[AlertSettings] = None

    created_at: Optional[str] = None

    created_by: Optional[str] = None

    description: Optional[str] = None

    environment_id: Optional[str] = None

    id: Optional[str] = None

    lookup_key: Optional[str] = None

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

    meter_id: Optional[str] = None

    name: Optional[str] = None

    status: Optional[Status] = None

    tenant_id: Optional[str] = None

    type: Optional[FeatureType] = None

    unit_plural: Optional[str] = None

    unit_singular: 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(
            [
                "alert_settings",
                "created_at",
                "created_by",
                "description",
                "environment_id",
                "id",
                "lookup_key",
                "metadata",
                "meter_id",
                "name",
                "status",
                "tenant_id",
                "type",
                "unit_plural",
                "unit_singular",
                "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
