# AUTO-GENERATED by ninja-codegen — DO NOT EDIT
# Re-run `ninjastack sync` to regenerate.
# GraphQL types and resolvers for: {{ entity.name }}

from __future__ import annotations

from typing import Any
{% if has_uuid %}
from uuid import UUID
{% endif %}
{% if has_datetime %}
from datetime import datetime
{% endif %}
{% if has_date %}
from datetime import date
{% endif %}

import strawberry


@strawberry.type
class {{ entity.name }}Type:
    """GraphQL type for {{ entity.name }}."""
{% for field in fields_meta %}
    {{ field.name }}: {{ field.gql_type }}{% if field.nullable %} | None = None{% endif %}

{% endfor %}


@strawberry.input
class {{ entity.name }}Input:
    """GraphQL input type for creating/updating {{ entity.name }}."""
{% for field in fields_meta %}
{% if not field.primary_key %}
    {{ field.name }}: {{ field.gql_type }}{% if field.nullable %} | None = None{% endif %}

{% endif %}
{% endfor %}


@strawberry.type
class {{ entity.name }}Query:
    """GraphQL queries for {{ entity.name }}."""

    @strawberry.field
    def {{ entity.name | lower }}(self, id: str) -> {{ entity.name }}Type | None:
        """Get a single {{ entity.name }} by ID."""
        # TODO: Wire to persistence layer
        raise NotImplementedError("Wire to {{ entity.name }} repository")

    @strawberry.field
    def {{ entity.name | lower }}s(self, limit: int = 25, offset: int = 0) -> list[{{ entity.name }}Type]:
        """List {{ entity.name }} records."""
        # TODO: Wire to persistence layer
        raise NotImplementedError("Wire to {{ entity.name }} repository")


@strawberry.type
class {{ entity.name }}Mutation:
    """GraphQL mutations for {{ entity.name }}."""

    @strawberry.mutation
    def create_{{ entity.name | lower }}(self, input: {{ entity.name }}Input) -> {{ entity.name }}Type:
        """Create a new {{ entity.name }}."""
        # TODO: Wire to persistence layer
        raise NotImplementedError("Wire to {{ entity.name }} repository")

    @strawberry.mutation
    def update_{{ entity.name | lower }}(self, id: str, input: {{ entity.name }}Input) -> {{ entity.name }}Type:
        """Update an existing {{ entity.name }}."""
        # TODO: Wire to persistence layer
        raise NotImplementedError("Wire to {{ entity.name }} repository")

    @strawberry.mutation
    def delete_{{ entity.name | lower }}(self, id: str) -> bool:
        """Delete a {{ entity.name }} by ID."""
        # TODO: Wire to persistence layer
        raise NotImplementedError("Wire to {{ entity.name }} repository")
