"""
Pydantic Models for CMDB - wireless_controller/hotspot20/anqp_3gpp_cellular

Runtime validation models for wireless_controller/hotspot20/anqp_3gpp_cellular configuration.
Generated from FortiOS schema version unknown.
"""

from __future__ import annotations

from pydantic import BaseModel, Field
from typing import Any, Optional

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

# ============================================================================
# Child Table Models (sorted deepest-first so nested models are defined before their parents)
# ============================================================================

class Anqp3gppCellularMccMncList(BaseModel):
    """
    Child table model for mcc-mnc-list.
    
    Mobile Country Code and Mobile Network Code configuration.
    """
    
    class Config:
        """Pydantic model configuration."""
        extra = "allow"  # Allow additional fields from API
        str_strip_whitespace = True
        use_enum_values = True  # Use enum values instead of names
    
    id_: int = Field(ge=1, le=6, default=0, serialization_alias="id", description="ID.")    
    mcc: str | None = Field(max_length=3, default=None, description="Mobile country code.")    
    mnc: str | None = Field(max_length=3, default=None, description="Mobile network code.")
# ============================================================================
# Enum Definitions (for fields with 4+ allowed values)
# ============================================================================


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

class Anqp3gppCellularModel(BaseModel):
    """
    Pydantic model for wireless_controller/hotspot20/anqp_3gpp_cellular configuration.
    
    Configure 3GPP public land mobile network (PLMN).
    
    Validation Rules:        - name: max_length=35 pattern=        - mcc_mnc_list: 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=None, description="3GPP PLMN name.")    
    mcc_mnc_list: list[Anqp3gppCellularMccMncList] = Field(default_factory=list, description="Mobile Country Code and Mobile Network Code configuration.")    
    # ========================================================================
    # 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]) -> "Anqp3gppCellularModel":
        """
        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__ = [
    "Anqp3gppCellularModel",    "Anqp3gppCellularMccMncList",]


# ============================================================================
# Generated by hfortix generator v0.6.0
# Schema: 1.7.0
# Generated: 2026-01-17T17:56:11.325151Z
# ============================================================================