from __future__ import annotations

from pydantic import BaseModel, ConfigDict, Field


class StrictModel(BaseModel):
    model_config = ConfigDict(extra="forbid")


class ContactInfo(StrictModel):
    full_name: str
    email: str | None
    phone: str | None
    location: str | None
    linkedin: str | None
    website: str | None


class EvidenceFact(StrictModel):
    id: str = Field(description="Stable identifier such as F001.")
    category: str
    statement: str
    source_name: str
    source_excerpt: str


class CareerProfile(StrictModel):
    contact: ContactInfo
    professional_identity: str
    differentiators: list[str]
    target_roles: list[str]
    facts: list[EvidenceFact]
    skills: list[str]
    unanswered_questions: list[str]


class JobRequirement(StrictModel):
    requirement: str
    importance: str = Field(description="One of: required, preferred, contextual.")
    keywords: list[str]


class JobAnalysis(StrictModel):
    company: str | None
    role_title: str | None
    mission: str | None
    requirements: list[JobRequirement]
    responsibilities: list[str]
    culture_signals: list[str]
    ats_keywords: list[str]


class BackedText(StrictModel):
    text: str
    evidence_ids: list[str]


class ResumeSection(StrictModel):
    title: str
    items: list[BackedText]


class TailoredResume(StrictModel):
    contact: ContactInfo
    headline: str
    summary: list[BackedText]
    sections: list[ResumeSection]


class MatchAssessment(StrictModel):
    strong_matches: list[str]
    partial_matches: list[str]
    genuine_gaps: list[str]
    keywords_used: list[str]


class TailoringPackage(StrictModel):
    job: JobAnalysis
    resume: TailoredResume
    match: MatchAssessment
    changes_made: list[str]
    questions_for_candidate: list[str]
    warnings: list[str]
