# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing_extensions import Literal

from ....._models import BaseModel

__all__ = [
    "MaintenanceConfigGetResponse",
    "MaintenanceConfig",
    "MaintenanceConfigCompaction",
    "MaintenanceConfigSnapshotExpiration",
]


class MaintenanceConfigCompaction(BaseModel):
    """Configures compaction settings for table optimization."""

    state: Literal["enabled", "disabled"]
    """Specifies the state of maintenance operations."""

    target_size_mb: Literal["64", "128", "256", "512"]
    """Sets the target file size for compaction in megabytes. Defaults to "128"."""


class MaintenanceConfigSnapshotExpiration(BaseModel):
    """Configures snapshot expiration settings."""

    max_snapshot_age: str
    """Specifies the maximum age for snapshots.

    The system deletes snapshots older than this age. Format: <number><unit> where
    unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7
    days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d".
    """

    min_snapshots_to_keep: int
    """Specifies the minimum number of snapshots to retain. Defaults to 100."""

    state: Literal["enabled", "disabled"]
    """Specifies the state of maintenance operations."""


class MaintenanceConfig(BaseModel):
    """Configures maintenance for the table."""

    compaction: Optional[MaintenanceConfigCompaction] = None
    """Configures compaction settings for table optimization."""

    snapshot_expiration: Optional[MaintenanceConfigSnapshotExpiration] = None
    """Configures snapshot expiration settings."""


class MaintenanceConfigGetResponse(BaseModel):
    """Contains table maintenance configuration."""

    maintenance_config: MaintenanceConfig
    """Configures maintenance for the table."""
