# generated by datamodel-codegen:
#   filename:  pydantic_v2_dataclass_required_field_order.json

from __future__ import annotations

from enum import Enum
from typing import Annotated

from pydantic import ConfigDict, EmailStr, Field
from pydantic.dataclasses import dataclass


class Role(Enum):
    admin = "admin"
    editor = "editor"
    viewer = "viewer"


@dataclass
class Address:
    city: str
    street: str | None = None
    postal_code: Annotated[
        str | None, Field(alias="postalCode", pattern="^[0-9]{5}$")
    ] = None


@dataclass(config=ConfigDict(extra="forbid"))
class UserProfile:
    id: Annotated[str, Field(description="Unique identifier for the user")]
    name: Annotated[str, Field(min_length=1)]
    email: EmailStr
    age: Annotated[int | None, Field(ge=0)] = None
    is_active: Annotated[bool | None, Field(alias="isActive")] = True
    role: Role | None = None
    tags: list[str] | None = None
    address: Address | None = None
