from slurpit.models.basemodel import BaseModel

class TransformRule(BaseModel):
    """
    Representation of a Transform Rule.

    Args:
        id (int): Read-only unique identifier for the transform rule.
        name (str): Name of the transform rule.
        rule (str): The rule definition.
        content (str): The content of the rule.
        type (str): The type of the rule ("scanner" or "scraper").
        disabled (int): Whether the rule is disabled (1) or not (0).
        comment (str): A comment regarding the rule.
        example_data (str): Example data for the rule.
        order (int): Read-only order of the rule.
    """
    def __init__(
        self,
        id: int,
        name: str,
        rule: str,
        content: str,
        type: str,
        disabled: int,
        comment: str,
        example_data: str,
        order: int,
        **extra
    ):
        if extra:
            self.notify_unrecognized_fields(extra)
            
        self.id = id
        self.name = name
        self.rule = rule
        self.content = content
        self.type = type
        self.disabled = disabled
        self.comment = comment
        self.example_data = example_data
        self.order = order

class AlertRule(BaseModel):
    """
    Representation of an Alert Rule.

    Args:
        id (int): Read-only unique identifier for the alert rule.
        name (str): Name of the alert rule.
        rule (str): The rule definition.
        content (str): The content of the rule.
        type (str): The type of the rule ("scanner" or "scraper").
        alert_inverted (int): Whether the alert is inverted (1) or not (0).
        alert_webhook (str): Webhook URL for the alert.
        alert_webhook_token (str): Webhook token for the alert.
        alert_email (str): Email address for the alert.
        alert_email_subject (str): Email subject for the alert.
        disabled (int): Whether the rule is disabled (1) or not (0).
        comment (str): A comment regarding the rule.
        example_data (str): Example data for the rule.
        order (int): Read-only order of the rule.
        plannings (list[int]): List of planning IDs associated with the rule.
    """
    def __init__(
        self,
        id: int,
        name: str,
        rule: str,
        content: str,
        type: str,
        alert_inverted: int,
        alert_webhook: str,
        alert_webhook_token: str,
        alert_email: str,
        alert_email_subject: str,
        disabled: int,
        comment: str,
        example_data: str,
        order: int,
        plannings: list,
        **extra
    ):
        if extra:
            self.notify_unrecognized_fields(extra)
            
        self.id = id
        self.name = name
        self.rule = rule
        self.content = content
        self.type = type
        self.alert_inverted = alert_inverted
        self.alert_webhook = alert_webhook
        self.alert_webhook_token = alert_webhook_token
        self.alert_email = alert_email
        self.alert_email_subject = alert_email_subject
        self.disabled = disabled
        self.comment = comment
        self.example_data = example_data
        self.order = order
        self.plannings = plannings
