# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import SharedMachinePermission


class SharedMachine(BaseModel):
    """
    Full shared machine details (for owners).

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    share_token: Any = Field(description='Unique token for public access')
    share_url: Any = Field(description='Generate full share URL.')
    permission: SharedMachinePermission | None = Field(
    None,
    description='* `read_only` - Read Only',
)
    machine: str = ...
    machine_name: Any = ...
    machine_hostname: Any = ...
    machine_status: Any = ...
    expires_at: datetime.datetime | None = Field(
    None,
    description='When this share expires (null = ...',
)
    views_count: int = ...
    last_viewed_at: datetime.datetime | None = None
    is_active: bool | None = Field(None, description='Can be deactivated without deleting')
    is_expired: bool = ...
    is_valid: bool = ...
    active_sessions_count: int = Field(description='Count active terminal sessions o...')
    created_by: int = ...
    created_at: datetime.datetime = ...



class SharedMachineList(BaseModel):
    """
    Lightweight serializer for listing shares.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    share_token: str = Field(description='Unique token for public access', max_length=64)
    permission: SharedMachinePermission | None = Field(
    None,
    description='* `read_only` - Read Only',
)
    machine: str = ...
    machine_name: Any = ...
    expires_at: datetime.datetime | None = Field(
    None,
    description='When this share expires (null = ...',
)
    views_count: int | None = Field(None, ge=0, le=2147483647)
    is_active: bool | None = Field(None, description='Can be deactivated without deleting')
    is_expired: bool = ...
    is_valid: bool = ...
    created_at: datetime.datetime = ...



class PaginatedSharedMachineListList(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    count: int = Field(description='Total number of items across all...')
    page: int = Field(description='Current page number (1-based)')
    pages: int = Field(description='Total number of pages')
    page_size: int = Field(description='Number of items per page')
    has_next: bool = Field(description='Whether there is a next page')
    has_previous: bool = Field(description='Whether there is a previous page')
    next_page: int | None = Field(None, description='Next page number (null if no nex...')
    previous_page: int | None = Field(None, description='Previous page number (null if no...')
    results: list[SharedMachineList] = Field(description='Array of items for current page')



class SharedMachineCreateRequest(BaseModel):
    """
    Serializer for creating a new share.

    Request model (no read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    expires_in_hours: int | None = Field(
    None,
    description='Hours until share expires (null ...',
    ge=1,
    le=720,
)



