"""
Regulation Pydantic schemas — extracted from compliance/api/schemas.py.

Phase 1 Step 3: the monolithic ``compliance.api.schemas`` module is being
split per domain under ``compliance.schemas``. This module is re-exported
from ``compliance.api.schemas`` for backwards compatibility.
"""

from datetime import datetime, date
from typing import Optional, List, Any, Dict

from pydantic import BaseModel, ConfigDict, Field

from compliance.schemas.common import (
    PaginationMeta, RegulationType, ControlType, ControlDomain,
    ControlStatus, RiskLevel, EvidenceStatus,
)


# ============================================================================
# Regulation Schemas
# ============================================================================

class RegulationBase(BaseModel):
    code: str
    name: str
    full_name: Optional[str] = None
    regulation_type: str
    source_url: Optional[str] = None
    local_pdf_path: Optional[str] = None
    effective_date: Optional[date] = None
    description: Optional[str] = None
    is_active: bool = True


class RegulationCreate(RegulationBase):
    pass


class RegulationResponse(RegulationBase):
    id: str
    created_at: datetime
    updated_at: datetime
    requirement_count: Optional[int] = None

    model_config = ConfigDict(from_attributes=True)


class RegulationListResponse(BaseModel):
    regulations: List[RegulationResponse]
    total: int

