"""
Pydantic Models for MONITOR - vpn_certificate/local/import_

Runtime validation models for vpn_certificate/local/import_ configuration.
Generated from FortiOS schema version unknown.
"""

from __future__ import annotations

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

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


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

class ImportModel(BaseModel):
    """
    Pydantic model for vpn_certificate/local/import_ configuration.
    
    Import local certificate.
    
    Validation Rules:        - type_: pattern=        - certname: pattern=        - password: pattern=        - key_file_content: pattern=        - scope: pattern=        - acme_domain: pattern=        - acme_email: pattern=        - acme_ca_url: pattern=        - acme_rsa_key_size: pattern=        - acme_renew_window: pattern=        - file_content: 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
    # ========================================================================
    
    type_: str = Field(serialization_alias="type")    
    certname: str | None = Field(default=None)    
    password: str | None = Field(default=None)    
    key_file_content: str | None = Field(default=None)    
    scope: str | None = Field(default=None)    
    acme_domain: str | None = Field(default=None)    
    acme_email: str | None = Field(default=None)    
    acme_ca_url: str | None = Field(default=None)    
    acme_rsa_key_size: Any = Field(default=None)    
    acme_renew_window: Any = Field(default=None)    
    file_content: str | None = Field(default=None)    
    # ========================================================================
    # 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]) -> "ImportModel":
        """
        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__ = [
    "ImportModel",]


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