from __future__ import annotations

import uuid
from datetime import datetime

from pydantic import BaseModel, ConfigDict


class GroupMemberCreate(BaseModel):
    display_name: str
    identity_id: uuid.UUID | None = None


class GroupMemberOut(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: uuid.UUID
    display_name: str
    identity_id: uuid.UUID | None
    added_at: datetime


class GroupCreate(BaseModel):
    name: str
    description: str | None = None


class GroupOut(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: uuid.UUID
    name: str
    description: str | None
    organization_id: uuid.UUID | None
    created_at: datetime
    members: list[GroupMemberOut] = []


class GroupSummary(BaseModel):
    model_config = ConfigDict(from_attributes=True)

    id: uuid.UUID
    name: str
    description: str | None
    organization_id: uuid.UUID | None
    member_count: int = 0
