"""
API Schemas for Demo Session Service
"""

from pydantic import BaseModel, Field
from typing import Optional, Dict, Any
from datetime import datetime


class DemoSessionCreate(BaseModel):
    """Create demo session request"""
    demo_account_type: str = Field(..., description="individual_bakery or central_baker")
    user_id: Optional[str] = Field(None, description="Optional authenticated user ID")
    ip_address: Optional[str] = None
    user_agent: Optional[str] = None


class DemoSessionResponse(BaseModel):
    """Demo session response"""
    session_id: str
    virtual_tenant_id: str
    demo_account_type: str
    status: str
    created_at: datetime
    expires_at: datetime
    demo_config: Dict[str, Any]
    session_token: str

    class Config:
        from_attributes = True


class DemoSessionExtend(BaseModel):
    """Extend session request"""
    session_id: str


class DemoSessionDestroy(BaseModel):
    """Destroy session request"""
    session_id: str


class DemoSessionStats(BaseModel):
    """Demo session statistics"""
    total_sessions: int
    active_sessions: int
    expired_sessions: int
    destroyed_sessions: int
    avg_duration_minutes: float
    total_requests: int


class DemoAccountInfo(BaseModel):
    """Public demo account information"""
    account_type: str
    name: str
    email: str
    password: str
    description: str
    features: list[str]
    business_model: str


class CloneDataRequest(BaseModel):
    """Request to clone tenant data"""
    base_tenant_id: str
    virtual_tenant_id: str
    session_id: str


class CloneDataResponse(BaseModel):
    """Response from data cloning"""
    session_id: str
    services_cloned: list[str]
    total_records: int
    redis_keys: int
