# This file is auto-generated by oagen. Do not edit.

from __future__ import annotations

from dataclasses import dataclass
from typing import Any, Dict
from workos._types import _raise_deserialize_error


@dataclass(slots=True)
class UpdateAuditLogsRetention:
    """Update Audit Logs Retention model."""

    retention_period_in_days: int
    """The number of days Audit Log events will be retained. Valid values are `30` and `365`."""

    @classmethod
    def from_dict(cls, data: Dict[str, Any]) -> "UpdateAuditLogsRetention":
        """Deserialize from a dictionary."""
        try:
            return cls(
                retention_period_in_days=data["retention_period_in_days"],
            )
        except (KeyError, ValueError) as e:
            _raise_deserialize_error("UpdateAuditLogsRetention", e)

    def to_dict(self) -> Dict[str, Any]:
        """Serialize to a dictionary."""
        result: Dict[str, Any] = {}
        result["retention_period_in_days"] = self.retention_period_in_days
        return result
