# 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__ = [
    "R2DataCatalogGetResponse",
    "MaintenanceConfig",
    "MaintenanceConfigCompaction",
    "MaintenanceConfigSnapshotExpiration",
]


class MaintenanceConfigCompaction(BaseModel):
    """Configures compaction for catalog maintenance."""

    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 catalog."""

    compaction: Optional[MaintenanceConfigCompaction] = None
    """Configures compaction for catalog maintenance."""

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


class R2DataCatalogGetResponse(BaseModel):
    """Contains R2 Data Catalog information."""

    id: str
    """Use this to uniquely identify the catalog."""

    bucket: str
    """Specifies the associated R2 bucket name."""

    name: str
    """Specifies the catalog name (generated from account and bucket name)."""

    status: Literal["active", "inactive"]
    """Indicates the status of the catalog."""

    credential_status: Optional[Literal["present", "absent"]] = None
    """Shows the credential configuration status."""

    maintenance_config: Optional[MaintenanceConfig] = None
    """Configures maintenance for the catalog."""
