from slurpit.models.basemodel import BaseModel

class TaskScheduler(BaseModel):
    """
    This class represents a task scheduler record.

    Args:
        id (int): Unique identifier for the task scheduler record.
        name (str): Name of the task scheduler record.
        starts_at (str): The date and time when the task starts. Example: "2023-04-03 12:41:24".
        launch (str): Frequency of the task. Allowed values: "once", "hourly", "daily", "weekly", "monthly", "yearly", "cron_style".
        description (str): Description of the task scheduler record.
        action (str): Action to perform. Allowed values: "start_scraper", "start_scanner", "start_profiler".
        planning_id (int | None): The ID of the planning associated with the task.
        repeat_every (int | None): Frequency interval for repeating the task.
        repeat_at (str | None): Time of day to repeat the task.
        repeat_on (str | None): Day(s) of the week or month to repeat the task.
        repeat_days (str | None): Specific days to repeat the task.
        cron_style (str | None): Cron-style expression for the task schedule.
        disabled (int): Indicates if the task is disabled. Allowed values: 0, 1.
        type (str): Type of the task. Example: "shell".
        createddate (str): The date and time when the record was created.
        changeddate (str): The date and time when the record was last changed.
    """
    
    def __init__(
        self,
        id: int,
        name: str,
        starts_at: str,
        launch: str,
        description: str,
        action: str,
        planning_id: int | None = None,
        repeat_every: int | None = None,
        repeat_at: str | None = None,
        repeat_on: str | None = None,
        repeat_days: str | None = None,
        cron_style: str | None = None,
        disabled: int = 0,
        type: str = "shell",
        createddate: str | None = None,
        changeddate: str | None = None,
        **extra
    ):
        if extra:
            self.notify_unrecognized_fields(extra)
        
        self.id = int(id)
        self.name = name
        self.starts_at = starts_at
        self.launch = launch
        self.description = description
        self.action = action
        self.planning_id = planning_id
        self.repeat_every = repeat_every
        self.repeat_at = repeat_at
        self.repeat_on = repeat_on
        self.repeat_days = repeat_days
        self.cron_style = cron_style
        self.disabled = disabled
        self.type = type
        self.createddate = createddate
        self.changeddate = changeddate
