"""
Pydantic Models for CMDB - wireless_controller/syslog_profile

Runtime validation models for wireless_controller/syslog_profile configuration.
Generated from FortiOS schema version unknown.

Example Usage:
    >>> from hfortix_fortios.models.cmdb.wireless_controller.syslog_profile import 
    >>>
    >>> # Create with validation
    >>> obj = (
    ...     name=1,
    ...     name="example",
    ... )
    >>>
    >>> # Validation happens automatically
    >>> # ValidationError raised if constraints violated
"""

from __future__ import annotations

from pydantic import BaseModel, Field, field_validator
from typing import Any, Literal, Optional
from enum import Enum

# ============================================================================
# Enum Definitions (for fields with 4+ allowed values)
# ============================================================================

class SyslogProfileLog_levelEnum(str, Enum):
    """Allowed values for log_level field."""
    EMERGENCY = "emergency"    ALERT = "alert"    CRITICAL = "critical"    ERROR = "error"    WARNING = "warning"    NOTIFICATION = "notification"    INFORMATION = "information"    DEBUGGING = "debugging"

# ============================================================================
# Main Model
# ============================================================================

class SyslogProfileModel(BaseModel):
    """
    Pydantic model for wireless_controller/syslog_profile configuration.
    
    Configure Wireless Termination Points (WTP) system log server profile.
    
    Validation Rules:        - name: max_length=35 pattern=        - comment: max_length=255 pattern=        - server_status: pattern=        - server: max_length=63 pattern=        - server_port: min=0 max=65535 pattern=        - server_type: pattern=        - log_level: pattern=    """
    
    class Config:
        """Pydantic model configuration."""
        extra = "allow"  # Allow additional fields from API
        str_strip_whitespace = True
        validate_assignment = True  # Validate on attribute assignment
        use_enum_values = True  # Use enum values instead of names
    
    # ========================================================================
    # Model Fields
    # ========================================================================
    
    name: str | None = Field(max_length=35, default="", description="WTP system log server profile name.")    
    comment: str | None = Field(max_length=255, default=None, description="Comment.")    
    server_status: Literal["enable", "disable"] | None = Field(default="enable", description="Enable/disable FortiAP units to send log messages to a syslog server (default = enable).")    
    server: str | None = Field(max_length=63, default="", description="Syslog server CN domain name or IP address.")    
    server_port: int | None = Field(ge=0, le=65535, default=514, description="Port number of syslog server that FortiAP units send log messages to (default = 514).")    
    server_type: Literal["standard", "fortianalyzer"] | None = Field(default="standard", description="Configure syslog server type (default = standard).")    
    log_level: LogLevelEnum | None = Field(default="information", description="Lowest level of log messages that FortiAP units send to this server (default = information).")    
    # ========================================================================
    # Custom Validators
    # ========================================================================
    
    # ========================================================================
    # Helper Methods
    # ========================================================================
    
    def to_fortios_dict(self) -> dict[str, Any]:
        """
        Convert model to FortiOS API payload format.
        
        Returns:
            Dict suitable for POST/PUT operations
        """
        # Export with exclude_none to avoid sending null values
        return self.model_dump(exclude_none=True, by_alias=True)
    
    @classmethod
    def from_fortios_response(cls, data: dict[str, Any]) -> "":
        """
        Create model instance from FortiOS API response.
        
        Args:
            data: Response data from API
            
        Returns:
            Validated model instance
        """
        return cls(**data)

# ============================================================================
# Type Aliases for Convenience
# ============================================================================

Dict = dict[str, Any]  # For backward compatibility

# ============================================================================
# Module Exports
# ============================================================================

__all__ = [
    "SyslogProfileModel",]


# ============================================================================
# Generated by hfortix generator v0.6.0
# Schema: 1.7.0
# Generated: 2026-01-07T01:42:14.594303Z
# ============================================================================