"""IAM permission constants and registration for the DMS assets module."""

from __future__ import annotations

from simorgh.apps.iam.registry import register_permission

# Permission codenames
PERM_ASSET_VIEW = "dms.asset.view"
PERM_ASSET_UPLOAD = "dms.asset.upload"
PERM_ASSET_DELETE = "dms.asset.delete"
PERM_ASSET_DOWNLOAD = "dms.asset.download"


def register_all() -> None:
    """Register all DMS IAM permissions.  Called from DMSConfig.ready()."""
    register_permission(
        PERM_ASSET_VIEW,
        label="View file assets",
        description="List and retrieve DMS file assets within the tenant.",
    )
    register_permission(
        PERM_ASSET_UPLOAD,
        label="Upload files",
        description="Upload files to DMS (direct upload and resumable sessions).",
    )
    register_permission(
        PERM_ASSET_DELETE,
        label="Delete file assets",
        description="Soft-delete DMS file assets.",
    )
    register_permission(
        PERM_ASSET_DOWNLOAD,
        label="Download file assets",
        description="Access the content / download URL of DMS file assets.",
    )
