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

from __future__ import annotations
from .digesttimedconfigdto import DigestTimedConfigDto, DigestTimedConfigDtoTypedDict
from .digesttypeenum import DigestTypeEnum
from .digestunitenum import DigestUnitEnum
from enum import Enum
from novu_py.types import BaseModel
import pydantic
from typing import Any, Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class DigestMetadataDtoUnit(str, Enum):
    r"""Unit of the digest"""

    SECONDS = "seconds"
    MINUTES = "minutes"
    HOURS = "hours"
    DAYS = "days"
    WEEKS = "weeks"
    MONTHS = "months"


class DigestMetadataDtoTypedDict(TypedDict):
    type: DigestTypeEnum
    r"""The Digest Type"""
    digest_key: NotRequired[str]
    r"""Optional key for the digest"""
    amount: NotRequired[float]
    r"""Amount for the digest"""
    unit: NotRequired[DigestMetadataDtoUnit]
    r"""Unit of the digest"""
    events: NotRequired[List[Dict[str, Any]]]
    r"""Optional array of events associated with the digest, represented as key-value pairs"""
    backoff: NotRequired[bool]
    r"""Regular digest: Indicates if backoff is enabled for the regular digest"""
    backoff_amount: NotRequired[float]
    r"""Regular digest: Amount for backoff"""
    backoff_unit: NotRequired[DigestUnitEnum]
    r"""Regular digest: Unit for backoff"""
    update_mode: NotRequired[bool]
    r"""Regular digest: Indicates if the digest should update"""
    timed: NotRequired[DigestTimedConfigDtoTypedDict]
    r"""Configuration for timed digest"""


class DigestMetadataDto(BaseModel):
    type: DigestTypeEnum
    r"""The Digest Type"""

    digest_key: Annotated[Optional[str], pydantic.Field(alias="digestKey")] = None
    r"""Optional key for the digest"""

    amount: Optional[float] = None
    r"""Amount for the digest"""

    unit: Optional[DigestMetadataDtoUnit] = None
    r"""Unit of the digest"""

    events: Optional[List[Dict[str, Any]]] = None
    r"""Optional array of events associated with the digest, represented as key-value pairs"""

    backoff: Optional[bool] = None
    r"""Regular digest: Indicates if backoff is enabled for the regular digest"""

    backoff_amount: Annotated[
        Optional[float], pydantic.Field(alias="backoffAmount")
    ] = None
    r"""Regular digest: Amount for backoff"""

    backoff_unit: Annotated[
        Optional[DigestUnitEnum], pydantic.Field(alias="backoffUnit")
    ] = None
    r"""Regular digest: Unit for backoff"""

    update_mode: Annotated[Optional[bool], pydantic.Field(alias="updateMode")] = None
    r"""Regular digest: Indicates if the digest should update"""

    timed: Optional[DigestTimedConfigDto] = None
    r"""Configuration for timed digest"""
