"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .assetrefdto import AssetRefDto, AssetRefDtoTypedDict
from .cawgidentitydto import CawgIdentityDto, CawgIdentityDtoTypedDict
from .limitsdto import LimitsDto, LimitsDtoTypedDict
from enum import Enum
from que_media.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class Mode(str, Enum):
    r"""The signing mode to use.
    * `server_measure`: The server streams the asset, calculates its hash, and embeds the manifest. Requires `manifest_json`. This is the primary signing mode.
    * `client_hash`: The client provides the asset hash directly for offline signing. (Not yet implemented).

    """

    SERVER_MEASURE = "server_measure"
    CLIENT_HASH = "client_hash"


class SignRequestTypedDict(TypedDict):
    r"""Request to sign a digital asset with a C2PA manifest. The asset is processed using memory-efficient streaming to temporary storage."""

    asset: AssetRefDtoTypedDict
    r"""A reference to a digital asset, either stored in S3 or accessible via URL. Files are streamed efficiently to temporary storage during processing to minimize memory usage."""
    mode: Mode
    r"""The signing mode to use.
    * `server_measure`: The server streams the asset, calculates its hash, and embeds the manifest. Requires `manifest_json`. This is the primary signing mode.
    * `client_hash`: The client provides the asset hash directly for offline signing. (Not yet implemented).

    """
    manifest_json: NotRequired[str]
    r"""JSON string containing the manifest to embed in the asset as a C2PA claim. This defines the provenance information and assertions about the asset. Required when `mode` is `server_measure`."""
    cawg: NotRequired[CawgIdentityDtoTypedDict]
    r"""Configuration to add a CAWG identity assertion during signing. Presence of this object enables CAWG."""
    allow_insecure_remote_http: NotRequired[bool]
    r"""Whether to allow HTTP (non-HTTPS) URLs for remote manifest resources. Disabled by default for security."""
    limits: NotRequired[LimitsDtoTypedDict]
    r"""Optional limits for processing operations to prevent resource exhaustion. These limits apply to the streaming and processing phases of asset handling."""


class SignRequest(BaseModel):
    r"""Request to sign a digital asset with a C2PA manifest. The asset is processed using memory-efficient streaming to temporary storage."""

    asset: AssetRefDto
    r"""A reference to a digital asset, either stored in S3 or accessible via URL. Files are streamed efficiently to temporary storage during processing to minimize memory usage."""

    mode: Mode
    r"""The signing mode to use.
    * `server_measure`: The server streams the asset, calculates its hash, and embeds the manifest. Requires `manifest_json`. This is the primary signing mode.
    * `client_hash`: The client provides the asset hash directly for offline signing. (Not yet implemented).

    """

    manifest_json: Optional[str] = None
    r"""JSON string containing the manifest to embed in the asset as a C2PA claim. This defines the provenance information and assertions about the asset. Required when `mode` is `server_measure`."""

    cawg: Optional[CawgIdentityDto] = None
    r"""Configuration to add a CAWG identity assertion during signing. Presence of this object enables CAWG."""

    allow_insecure_remote_http: Optional[bool] = False
    r"""Whether to allow HTTP (non-HTTPS) URLs for remote manifest resources. Disabled by default for security."""

    limits: Optional[LimitsDto] = None
    r"""Optional limits for processing operations to prevent resource exhaustion. These limits apply to the streaming and processing phases of asset handling."""
