from pydantic import BaseModel, EmailStr, Field, constr, validator
from typing import Optional, List
from datetime import date, datetime

 
class GroupLifeCreate(BaseModel):
    company_name: str = Field(..., max_length=100)
    industry_type: str = Field(..., description="Predefined list: Healthcare, Tech, etc.")
    federal_tax_id: str = Field(..., r"^\d{9}$", description="9-digit EIN")  
    company_address: str = Field(..., max_length=255)

    contact_name: str = Field(..., max_length=100)
    contact_email: EmailStr = Field(...)
    contact_phone: str = Field(..., regex=r"^\(\d{3}\) \d{3}-\d{4}$")  # (123) 456-7890

    group_type: str = Field(..., description="LLC, Corporation, Partnership, etc.")

    eligible_employees: int = Field(..., ge=2)
    insured_employees: int = Field(..., ge=1)

    employee_locations: List[str] = Field(..., description="States or ZIP codes")
    coverage_types: List[str] = Field(
        ..., description="Options: Basic Life, Voluntary Life, AD&D, etc."
    )

    effective_date: date = Field(..., description="Must be a future date")

    current_carrier: Optional[str] = Field(None, max_length=100)
    current_premium: Optional[float] = Field(None, ge=0)
    current_benefit_design: Optional[str] = None
    desired_benefit_design: Optional[str] = None

    employer_contribution: Optional[float] = Field(None, ge=0, le=100)
    waiting_period: str = Field(..., description="None, 30 days, 60 days, etc.")

    class_structure: Optional[str] = None
    union_mix: Optional[str] = Field(
        None, description="Options: All Union, All Non-Union, Mixed"
    )
    renewal_month: Optional[str] = None
    broker_name: Optional[str] = Field(None, max_length=100)
    notes: Optional[str] = Field(None, max_length=1000)

    census_file_path: str = Field(
        ..., description="Path or filename for uploaded CSV/XLSX"
    )
    transaction_no: str