from datetime import datetime
from typing import List, Optional
from uuid import UUID

from fastapi import File, UploadFile
from pydantic import Field

from src.models import DefultBase, Pagination

class OverhaulScheduleBase(DefultBase):
    pass


class AerosProjectBase(DefultBase):
    pass


class AerosProjectInput(AerosProjectBase):
    schematic_name: str = Field(..., max_length=100)
    aro_file: UploadFile = File(..., description="ARO file")
    
class AerosMetadata(AerosProjectBase):
    project_name: str = Field(..., max_length=100)
    aro_file_path: str = Field(..., max_length=255)
    updated_at: datetime


class OverhaulScheduleCreate(OverhaulScheduleBase):
    year: int
    plan_duration: Optional[int] = Field(None)
    planned_outage: Optional[int] = Field(None)
    actual_shutdown: Optional[int] = Field(None)
    start: datetime
    finish: datetime
    remark: Optional[str] = Field(None)


class OverhaulScheduleUpdate(OverhaulScheduleBase):
    start: datetime
    finish: datetime


class OverhaulScheduleRead(OverhaulScheduleBase):
    id: UUID
    year: int
    plan_duration: Optional[int]
    planned_outage: Optional[int]
    actual_shutdown: Optional[int]
    start: datetime
    finish: datetime
    remark: Optional[str]

class OverhaulSchedulePagination(Pagination):
    items: List[OverhaulScheduleRead] = []
