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

from __future__ import annotations
from .lookbackwindowdto import LookBackWindowDto, LookBackWindowDtoTypedDict
from enum import Enum
from novu_py.types import BaseModel
import pydantic
from typing import Any, Dict, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class DigestControlDtoType(str, Enum):
    r"""The type of digest strategy. Determines which fields are applicable."""

    REGULAR = "regular"
    TIMED = "timed"


class DigestControlDtoUnit(str, Enum):
    r"""The unit of time for the digest interval (for REGULAR type)."""

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


class DigestControlDtoTypedDict(TypedDict):
    skip: NotRequired[Dict[str, Any]]
    r"""JSONLogic filter conditions for conditionally skipping the step execution. Supports complex logical operations with AND, OR, and comparison operators. See https://jsonlogic.com/ for full typing reference."""
    type: NotRequired[DigestControlDtoType]
    r"""The type of digest strategy. Determines which fields are applicable."""
    amount: NotRequired[float]
    r"""The amount of time for the digest interval (for REGULAR type). Min 1."""
    unit: NotRequired[DigestControlDtoUnit]
    r"""The unit of time for the digest interval (for REGULAR type)."""
    look_back_window: NotRequired[LookBackWindowDtoTypedDict]
    r"""Configuration for look-back window (for REGULAR type)."""
    cron: NotRequired[str]
    r"""Cron expression for TIMED digest. Min length 1."""
    digest_key: NotRequired[str]
    r"""Specify a custom key for digesting events instead of the default event key."""


class DigestControlDto(BaseModel):
    skip: Optional[Dict[str, Any]] = None
    r"""JSONLogic filter conditions for conditionally skipping the step execution. Supports complex logical operations with AND, OR, and comparison operators. See https://jsonlogic.com/ for full typing reference."""

    type: Optional[DigestControlDtoType] = None
    r"""The type of digest strategy. Determines which fields are applicable."""

    amount: Optional[float] = None
    r"""The amount of time for the digest interval (for REGULAR type). Min 1."""

    unit: Optional[DigestControlDtoUnit] = None
    r"""The unit of time for the digest interval (for REGULAR type)."""

    look_back_window: Annotated[
        Optional[LookBackWindowDto], pydantic.Field(alias="lookBackWindow")
    ] = None
    r"""Configuration for look-back window (for REGULAR type)."""

    cron: Optional[str] = None
    r"""Cron expression for TIMED digest. Min length 1."""

    digest_key: Annotated[Optional[str], pydantic.Field(alias="digestKey")] = None
    r"""Specify a custom key for digesting events instead of the default event key."""
