from pydantic import BaseModel, Field, ConfigDict
from pydantic.alias_generators import to_camel

from persona_models.common import create_uuid


class Project(BaseModel):
    id: str = Field(default_factory=create_uuid)
    name: str
    api_key: str
    tag: str | None = None

    @classmethod
    def test(cls):
        return cls(
            id="test-project-id",
            name="Test Project",
            api_key="test-api-key",
            tag="test-tag",
        )

    model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel)


class ProjectCreateRequest(BaseModel):
    name: str
    tag: str | None = None

    model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel)


class ProjectUpdateRequest(BaseModel):
    name: str | None = None
    tag: str | None = None

    model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel)
