# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .alert_public_alert_type import AlertPublicAlertType
from .alert_trigger_public import AlertTriggerPublic
from .webhook_public import WebhookPublic


class AlertPublic(UniversalBaseModel):
    id: typing.Optional[str] = None
    name: typing.Optional[str] = None
    enabled: typing.Optional[bool] = None
    alert_type: typing.Optional[AlertPublicAlertType] = None
    metadata: typing.Optional[typing.Dict[str, str]] = None
    webhook: WebhookPublic
    triggers: typing.Optional[typing.List[AlertTriggerPublic]] = None
    created_at: typing.Optional[dt.datetime] = None
    created_by: typing.Optional[str] = None
    last_updated_at: typing.Optional[dt.datetime] = None
    last_updated_by: typing.Optional[str] = None
    project_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional project scope for this alert. When set, the alert is scoped to the specified project. Do NOT also provide a 'scope:project' trigger config — the system will create it automatically from this field. Sending both project_id and a scope:project trigger config will result in an error.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
