from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, ConfigDict

from models import MiningOperationType


class ProjectBase(BaseModel):
    name: str
    location: str | None = None
    operation_type: MiningOperationType
    description: str | None = None

    model_config = ConfigDict(extra="forbid")


class ProjectCreate(ProjectBase):
    pass


class ProjectUpdate(BaseModel):
    name: str | None = None
    location: str | None = None
    operation_type: MiningOperationType | None = None
    description: str | None = None

    model_config = ConfigDict(extra="forbid")


class ProjectRead(ProjectBase):
    id: int
    created_at: datetime
    updated_at: datetime

    model_config = ConfigDict(from_attributes=True)
