from typing import Optional
from pydantic import BaseModel
from api_validations.core_validations import BaseModelRegular
from api_validations.validations_request import (
    PydanticBaseModel,
)


class InsertBuildDecisionBookProjectItems(BaseModelRegular):
    item_header: str
    item_comment: str
    build_decision_book_project_uu_id: str
    attachment_pdf_path: Optional[str] = None
    item_objection: Optional[str] = None


class UpdateBuildDecisionBookProjectItems(PydanticBaseModel):
    item_header: Optional[str] = None
    item_comment: Optional[str] = None
    attachment_pdf_path: Optional[str] = None
    item_estimated_cost: Optional[float] = None
    build_decision_book_project_uu_id: Optional[str] = None


class InsertBuildDecisionBookProjectPerson(BaseModelRegular):
    dues_percent_discount: Optional[int] = None
    job_fix_wage: Optional[float] = None
    bid_price: Optional[float] = None
    decision_price: Optional[float] = None
    build_decision_book_project_uu_id: str
    living_space_uu_id: str
    project_team_type_uu_id: str


class UpdateBuildDecisionBookProjectPerson(PydanticBaseModel):
    dues_percent_discount: Optional[int] = None
    job_fix_wage: Optional[float] = None
    bid_price: Optional[float] = None
    decision_price: Optional[float] = None
    build_decision_book_project_uu_id: Optional[str] = None
    living_space_uu_id: Optional[str] = None
    project_team_type_uu_id: Optional[str] = None


class InsertBuildDecisionBookProjects(BaseModelRegular):
    build_decision_book_item_uu_id: str
    project_response_person_uu_id: str
    project_name: str
    project_start_date: str
    project_stop_date: str
    project_type: str

    is_out_sourced: Optional[bool] = False
    project_note: Optional[str] = None
    decision_book_pdf_path: Optional[str] = None
    resp_company_fix_wage: Optional[float] = None
    contact_agreement_path: Optional[str] = None
    contact_agreement_date: Optional[str] = None
    meeting_date: Optional[str] = None
    currency: Optional[str] = None
    bid_price: Optional[float] = None
    resp_company_uu_id: Optional[str] = None


class UpdateBuildDecisionBookProjects(PydanticBaseModel):
    build_decision_book_project_uu_id: str
    is_out_sourced: Optional[bool] = False
    project_note: Optional[str] = None
    decision_book_pdf_path: Optional[str] = None
    status_id: Optional[int] = None
    resp_company_fix_wage: Optional[float] = None
    contact_agreement_path: Optional[str] = None
    contact_agreement_date: Optional[str] = None
    contact_uu_id: Optional[str] = None
    resp_company_uu_id: Optional[str] = None
    approved_price: Optional[float] = None


class ApprovalsBuildDecisionBookProjects(PydanticBaseModel):
    build_decision_book_project_uu_id: str
    final_price_list: list[dict]   # {"date": "2021-01-01", "price": 1000}
    project_stop_date: str


class InsertBuildDecisionBookProjectItemDebits(PydanticBaseModel):
    build_decision_book_project_item_uu_id: str
    payment_date: str
    dues_values: dict
    is_official: Optional[bool] = False
    discount_value: Optional[float] = None
    discount_fix: Optional[float] = None
    decision_taken: Optional[bool] = None


class UpdateBuildDecisionBookProjectItemDebits(PydanticBaseModel):
    dues_values: Optional[str] = None
    discount_value: Optional[float] = None
    discount_fix: Optional[float] = None
    decision_taken: Optional[bool] = None
    is_official: Optional[bool] = None
