# initially based on class generated by uv run wiz gs <scraped json file> src/eu_consultation_scraper/consultation_data.py

from dataclasses import dataclass
from typing import List, Union, Optional

from dataclass_wizard import JSONWizard, CatchAll


@dataclass
class Initiative(JSONWizard):
    id: int
    short_title: str
    extra_initiative_fields: CatchAll
    consultations: Optional[List["Consultation"]] | None = None


@dataclass
class Consultation(JSONWizard):
    """
    Consultation dataclass

    """

    id: int
    total_feedback: int
    extra_consultation_fields: CatchAll
    feedback: Optional[List["Feedback"]] | None = None


@dataclass
class Feedback(JSONWizard):
    """
    Feedback dataclass

    """

    id: int
    attachments: List["Attachment"]
    extra_feedback_fields: CatchAll
    status: Optional[str] = None
    date_feedback: Optional[str] = None
    surname: Optional[str] = None
    language: Optional[str] = None
    country: Optional[str] = None
    publication: Optional[str] = None
    user_type: Optional[str] = None
    feedback: Optional[str] = None
    login: Optional[str] = None
    first_name: Optional[str] = None
    reference_initiative: Optional[str] = None
    history_event_occurs: Optional[bool] = None
    is_disliked_by_me: Optional[bool] = None
    is_my_feedback: Optional[bool] = None
    is_liked_by_me: Optional[bool] = None
    publication_status: Optional[str] = None
    publication_id: Optional[int] = None
    feedback_text_user_language: Optional[str] = None
    organization: Optional[str] = None
    company_size: Optional[str] = None
    # tr_number: Union[str, int]
    scope: Optional[str] = None
    governance_level: Optional[str] = None


@dataclass
class Attachment(JSONWizard):
    """
    Attachment dataclass

    """

    id: int
    file_name: str
    document_id: Union[str, float]
    links: str
    extra_attachment_fields: CatchAll
    downloaded_filepath: Optional[str] = None
    extracted_text: Optional[str] = None
    docling_json: Optional["DoclingDump"] = None


@dataclass
class DoclingDump(JSONWizard):
    docling_dict: CatchAll
