"""Prism specification for {{ project_name }}.

Starter spec — edit these models and run `prisme generate` to create the full stack.
"""

from prisme import (
    FieldSpec,
    FieldType,
    FilterOperator,
    ModelSpec,
    RelationshipSpec,
    StackSpec,
)

spec = StackSpec(
    name="{{ project_name_snake }}",
    version="1.0.0",
    description="{{ description }}",
    models=[
        ModelSpec(
            name="Project",
            description="A project that groups related tasks",
            fields=[
                FieldSpec(
                    name="name",
                    type=FieldType.STRING,
                    max_length=255,
                    required=True,
                    searchable=True,
                    filter_operators=[FilterOperator.EQ, FilterOperator.CONTAINS],
                ),
                FieldSpec(
                    name="description",
                    type=FieldType.TEXT,
                ),
                FieldSpec(
                    name="status",
                    type=FieldType.ENUM,
                    enum_values=["planning", "active", "completed", "archived"],
                    default="planning",
                ),
            ],
            relationships=[
                RelationshipSpec(
                    name="tasks",
                    target_model="Task",
                    type="one_to_many",
                    back_populates="project",
                ),
            ],
            timestamps=True,
        ),
        ModelSpec(
            name="Task",
            description="A task belonging to a project",
            fields=[
                FieldSpec(
                    name="title",
                    type=FieldType.STRING,
                    max_length=255,
                    required=True,
                    searchable=True,
                    filter_operators=[FilterOperator.EQ, FilterOperator.CONTAINS],
                ),
                FieldSpec(
                    name="description",
                    type=FieldType.TEXT,
                ),
                FieldSpec(
                    name="is_completed",
                    type=FieldType.BOOLEAN,
                    default=False,
                ),
                FieldSpec(
                    name="priority",
                    type=FieldType.ENUM,
                    enum_values=["low", "medium", "high"],
                    default="medium",
                ),
                FieldSpec(
                    name="project_id",
                    type=FieldType.FOREIGN_KEY,
                    references="Project",
                    required=True,
                ),
            ],
            relationships=[
                RelationshipSpec(
                    name="project",
                    target_model="Project",
                    type="many_to_one",
                    back_populates="tasks",
                ),
            ],
            timestamps=True,
        ),
    ],
)
