# generated by datamodel-codegen:
#   filename:  openapi.json
#   timestamp: 2025-07-02T19:27:09+00:00

# Delay annotation evaluation to avoid circular imports
from __future__ import annotations

from pydantic import BaseModel, Field


class Address(BaseModel):
    line1: str = Field(..., description="The first line of the address.")
    line2: str = Field(..., description="The second line of the address.")
    city: str = Field(..., description="The city of the address.")
    state: str = Field(..., description="The state of the address.")
    postal_code: str = Field(..., alias="postalCode", description="The postal code of the address.")
    country: str = Field(..., description="The country of the address.")


class Group(BaseModel):
    group_id: int = Field(..., alias="groupId", description="The id of the group.")
    group_name: str = Field(..., alias="groupName", description="The display name of the group.")
    institution: str = Field(..., description="The name of the institution.")
    address: Address = Field(..., description="The address of the institution.")
    contact_email: str | None = Field(
        None, alias="contactEmail", description="The contact email for the group."
    )

    @classmethod
    def _create_example_for_tests(cls) -> Group:
        """Create an example Group instance for tests"""
        return cls(
            groupId=-1,
            groupName="Test group with funny characters \\ / '\"!@#$%^&*()",
            institution="Test institution with funny characters \\ / '\"!@#$%^&*()",
            address=Address(
                line1="1234",
                line2="Apt 1",
                city="Basel",
                state="BS",
                postalCode="12345",
                country="Switzerland",
            ),
            contactEmail="something@loculus.org",
        )


class User(BaseModel):
    name: str


class GroupDetails(BaseModel):
    group: Group
    users: list[User] | None = None
