""" Pydantic schemas for M365Tenant model. Request and response schemas for Microsoft 365 tenant configurations. """ from datetime import datetime from typing import Optional from uuid import UUID from pydantic import BaseModel, Field class M365TenantBase(BaseModel): """Base schema with shared M365Tenant fields.""" client_id: Optional[UUID] = Field(None, description="Reference to the client") tenant_id: str = Field(..., description="Microsoft tenant ID (UUID)") tenant_name: Optional[str] = Field(None, description="Tenant name (e.g., 'dataforth.com')") default_domain: Optional[str] = Field(None, description="Default domain (e.g., 'dataforthcorp.onmicrosoft.com')") admin_email: Optional[str] = Field(None, description="Administrator email address") cipp_name: Optional[str] = Field(None, description="Name in CIPP portal") notes: Optional[str] = Field(None, description="Additional notes") class M365TenantCreate(M365TenantBase): """Schema for creating a new M365Tenant.""" pass class M365TenantUpdate(BaseModel): """Schema for updating an existing M365Tenant. All fields are optional.""" client_id: Optional[UUID] = Field(None, description="Reference to the client") tenant_id: Optional[str] = Field(None, description="Microsoft tenant ID (UUID)") tenant_name: Optional[str] = Field(None, description="Tenant name (e.g., 'dataforth.com')") default_domain: Optional[str] = Field(None, description="Default domain (e.g., 'dataforthcorp.onmicrosoft.com')") admin_email: Optional[str] = Field(None, description="Administrator email address") cipp_name: Optional[str] = Field(None, description="Name in CIPP portal") notes: Optional[str] = Field(None, description="Additional notes") class M365TenantResponse(M365TenantBase): """Schema for M365Tenant responses with ID and timestamps.""" id: UUID = Field(..., description="Unique identifier for the M365 tenant") created_at: datetime = Field(..., description="Timestamp when the M365 tenant was created") updated_at: datetime = Field(..., description="Timestamp when the M365 tenant was last updated") model_config = {"from_attributes": True}