"""
Pydantic Models for MONITOR - network/debug_flow/start

Runtime validation models for network/debug_flow/start 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 StartModel(BaseModel):
    """
    Pydantic model for network/debug_flow/start configuration.
    
    Start debug flow packet capture.
    
    Validation Rules:        - num_packets: pattern=        - ipv6: pattern=        - negate: pattern=        - addr_from: pattern=        - addr_to: pattern=        - daddr_from: pattern=        - daddr_to: pattern=        - saddr_from: pattern=        - saddr_to: pattern=        - port_from: pattern=        - port_to: pattern=        - dport_from: pattern=        - dport_to: pattern=        - sport_from: pattern=        - sport_to: pattern=        - proto: 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
    # ========================================================================
    
    num_packets: Any = Field()    
    ipv6: Any = Field()    
    negate: Any = Field(default=None)    
    addr_from: str | None = Field(default=None)    
    addr_to: str | None = Field(default=None)    
    daddr_from: str | None = Field(default=None)    
    daddr_to: str | None = Field(default=None)    
    saddr_from: str | None = Field(default=None)    
    saddr_to: str | None = Field(default=None)    
    port_from: Any = Field(default=None)    
    port_to: Any = Field(default=None)    
    dport_from: Any = Field(default=None)    
    dport_to: Any = Field(default=None)    
    sport_from: Any = Field(default=None)    
    sport_to: Any = Field(default=None)    
    proto: Any = 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]) -> "StartModel":
        """
        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__ = [
    "StartModel",]


# ============================================================================
# Generated by hfortix generator v0.6.0
# Schema: 1.7.0
# Generated: 2026-01-17T16:18:44.580482Z
# ============================================================================