"""Staff schemas."""
from __future__ import annotations


from datetime import datetime, date, time
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field

from app.models.types import LifecycleStatus, StaffKind
from app.schemas.common import ORMBase

_FORBID = ConfigDict(extra="forbid")


class StaffProfileCreate(BaseModel):
    model_config = _FORBID

    organization_id: UUID
    branch_id: UUID | None = None
    code: str = Field(max_length=50)
    display_name: str = Field(max_length=255)
    kind: StaffKind = StaffKind.OTHER
    external_user_ref: str | None = None
    mobile: str | None = None
    email: str | None = None
    status: LifecycleStatus = LifecycleStatus.ACTIVE
    hire_date: date | None = None
    metadata_json: dict | None = None


class StaffProfileRead(ORMBase):
    id: UUID
    tenant_id: UUID
    organization_id: UUID
    branch_id: UUID | None
    code: str
    display_name: str
    kind: StaffKind
    external_user_ref: str | None
    mobile: str | None
    email: str | None
    status: LifecycleStatus
    hire_date: date | None
    metadata_json: dict | None
    is_deleted: bool
    created_by: str | None
    updated_by: str | None
    created_at: datetime
    updated_at: datetime


from datetime import datetime, date, time
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field

from app.models.types import LifecycleStatus
from app.schemas.common import ORMBase

_FORBID = ConfigDict(extra="forbid")


class CommissionRuleCreate(BaseModel):
    model_config = _FORBID

    organization_id: UUID
    code: str = Field(max_length=50)
    name: str = Field(max_length=255)
    rule_type: str = Field(max_length=50)
    rate_percent: float | None = None
    flat_amount: float | None = None
    applies_to_service_id: UUID | None = None
    status: LifecycleStatus = LifecycleStatus.ACTIVE
    config: dict | None = None


class CommissionRuleRead(ORMBase):
    id: UUID
    tenant_id: UUID
    organization_id: UUID
    code: str
    name: str
    rule_type: str
    rate_percent: float | None
    flat_amount: float | None
    applies_to_service_id: UUID | None
    status: LifecycleStatus
    config: dict | None
    is_deleted: bool
    created_by: str | None
    updated_by: str | None
    created_at: datetime
    updated_at: datetime
