"""Sequence schemas — create, update, read, list."""

from __future__ import annotations

from pydantic import BaseModel, Field


class SequenceCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=100, description="e.g. invoice, quote")
    prefix: str = Field("", max_length=20, description="e.g. RE-2026-")
    padding: int = Field(4, ge=1, le=10, description="Zero-pad width, e.g. 4 -> 0001")


class SequenceUpdate(BaseModel):
    name: str | None = Field(None, min_length=1, max_length=100)
    prefix: str | None = Field(None, max_length=20)
    padding: int | None = Field(None, ge=1, le=10)


class SequenceResponse(BaseModel):
    id: str
    name: str
    prefix: str
    next_number: int
    padding: int
    created_at: str | None = None
    updated_at: str | None = None


class SequenceListResponse(BaseModel):
    items: list[SequenceResponse]
    total: int
