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

from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias

from .._utils import PropertyInfo
from .._models import BaseModel

__all__ = ["ContentProvenanceCheck", "Result", "ResultC2PA", "ResultSynthID"]


class ResultC2PA(BaseModel):
    generated_at: Optional[str] = None
    """
    The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset
    was generated, when available.
    """

    issuer: Optional[str] = None
    """The C2PA manifest issuer, when available."""

    model: Optional[str] = None
    """The OpenAI model recorded by the provenance signal, when available."""

    outcome: Literal["detected", "not_detected"]
    """
    Whether a supported OpenAI C2PA provenance signal was detected. If
    `not_detected`, it means the tool did not find supported signals in the uploaded
    file. The content could still have been generated by OpenAI if the metadata was
    stripped or has evidence of tampering, the watermark was degraded, it comes from
    a legacy generation model, or it was created before provenance signals were
    available. Content could also still be AI-generated by another company's model,
    which the tool currently does not detect.
    """

    type: Literal["c2pa"]
    """The provenance signal type. Always `c2pa`."""

    validation_state: Literal["trusted", "valid", "invalid", "not_present"]
    """The validation status of the C2PA manifest in the uploaded image."""


class ResultSynthID(BaseModel):
    generated_at: Optional[str] = None
    """
    The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset
    was generated, when available.
    """

    model: Optional[str] = None
    """The OpenAI model recorded by the provenance signal, when available."""

    outcome: Literal["detected", "not_detected"]
    """
    Whether a supported OpenAI SynthID watermark was detected. If `not_detected`, it
    means the tool did not find supported signals in the uploaded file. The content
    could still have been generated by OpenAI if the metadata was stripped or has
    evidence of tampering, the watermark was degraded, it comes from a legacy
    generation model, or it was created before provenance signals were available.
    Content could also still be AI-generated by another company's model, which the
    tool currently does not detect.
    """

    type: Literal["synthid"]
    """The provenance signal type. Always `synthid`."""


Result: TypeAlias = Annotated[Union[ResultC2PA, ResultSynthID], PropertyInfo(discriminator="type")]


class ContentProvenanceCheck(BaseModel):
    created_at: int
    """The Unix timestamp, in seconds, when the provenance check was created."""

    object: Literal["content_provenance_check"]
    """The object type. Always `content_provenance_check` for this endpoint."""

    results: List[Result]
    """The provenance results that apply to the uploaded file.

    Image results include C2PA and SynthID; audio results include SynthID.
    """
