# 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 .schedule_action_info import ScheduleActionInfo
from .schedule_spec_info import ScheduleSpecInfo
from .schedule_state import ScheduleState


class ScheduleResponse(UniversalBaseModel):
    """
    Response model for schedule operations
    """

    action: ScheduleActionInfo
    agent_id: str = pydantic.Field()
    """
    ID of the agent this schedule belongs to
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the schedule was created
    """

    last_action_time: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the schedule last executed
    """

    name: str = pydantic.Field()
    """
    Human-readable name for the schedule
    """

    next_action_times: typing.Optional[typing.List[dt.datetime]] = pydantic.Field(default=None)
    """
    Upcoming scheduled execution times
    """

    num_actions_missed: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of scheduled executions that were missed
    """

    num_actions_taken: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of times the schedule has executed
    """

    schedule_id: str = pydantic.Field()
    """
    Unique identifier for the schedule
    """

    spec: ScheduleSpecInfo = pydantic.Field()
    """
    Schedule specification
    """

    state: ScheduleState = pydantic.Field()
    """
    Current state of the schedule
    """

    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
