# generated by datamodel-codegen:
#   filename:  list-creatives-request.json
#   timestamp: 2025-11-18T12:11:55+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated, Any

from adcp.types.base import AdCPBaseModel
from pydantic import AwareDatetime, ConfigDict, Field

from . import creative_status


class FieldModel(Enum):
    creative_id = 'creative_id'
    name = 'name'
    format = 'format'
    status = 'status'
    created_date = 'created_date'
    updated_date = 'updated_date'
    tags = 'tags'
    assignments = 'assignments'
    performance = 'performance'
    sub_assets = 'sub_assets'


class Filters(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    assigned_to_package: Annotated[
        str | None, Field(description='Filter creatives assigned to this specific package')
    ] = None
    assigned_to_packages: Annotated[
        list[str] | None, Field(description='Filter creatives assigned to any of these packages')
    ] = None
    created_after: Annotated[
        AwareDatetime | None,
        Field(description='Filter creatives created after this date (ISO 8601)'),
    ] = None
    created_before: Annotated[
        AwareDatetime | None,
        Field(description='Filter creatives created before this date (ISO 8601)'),
    ] = None
    creative_ids: Annotated[
        list[str] | None, Field(description='Filter by specific creative IDs', max_length=100)
    ] = None
    format: Annotated[
        str | None,
        Field(description='Filter by creative format type (e.g., video, audio, display)'),
    ] = None
    formats: Annotated[
        list[str] | None, Field(description='Filter by multiple creative format types')
    ] = None
    has_performance_data: Annotated[
        bool | None, Field(description='Filter creatives that have performance data when true')
    ] = None
    name_contains: Annotated[
        str | None,
        Field(description='Filter by creative names containing this text (case-insensitive)'),
    ] = None
    status: Annotated[
        creative_status.CreativeStatus | None,
        Field(description='Filter by creative approval status'),
    ] = None
    statuses: Annotated[
        list[creative_status.CreativeStatus] | None,
        Field(description='Filter by multiple creative statuses'),
    ] = None
    tags: Annotated[
        list[str] | None, Field(description='Filter by creative tags (all tags must match)')
    ] = None
    tags_any: Annotated[
        list[str] | None, Field(description='Filter by creative tags (any tag must match)')
    ] = None
    unassigned: Annotated[
        bool | None,
        Field(
            description='Filter for unassigned creatives when true, assigned creatives when false'
        ),
    ] = None
    updated_after: Annotated[
        AwareDatetime | None,
        Field(description='Filter creatives last updated after this date (ISO 8601)'),
    ] = None
    updated_before: Annotated[
        AwareDatetime | None,
        Field(description='Filter creatives last updated before this date (ISO 8601)'),
    ] = None


class Pagination(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    limit: Annotated[
        int | None, Field(description='Maximum number of creatives to return', ge=1, le=100)
    ] = 50
    offset: Annotated[int | None, Field(description='Number of creatives to skip', ge=0)] = 0


class Direction(Enum):
    asc = 'asc'
    desc = 'desc'


class Field1(Enum):
    created_date = 'created_date'
    updated_date = 'updated_date'
    name = 'name'
    status = 'status'
    assignment_count = 'assignment_count'
    performance_score = 'performance_score'


class Sort(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    direction: Annotated[Direction | None, Field(description='Sort direction')] = Direction.desc
    field: Annotated[Field1 | None, Field(description='Field to sort by')] = Field1.created_date


class ListCreativesRequest(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    context: Annotated[
        dict[str, Any] | None,
        Field(
            description='Initiator-provided context included in the request payload. Agentsmust echo this value back unchanged in responses and webhooks. Use for UI/session hints, correlation tokens, or tracking metadata.'
        ),
    ] = None
    fields: Annotated[
        list[FieldModel] | None,
        Field(description='Specific fields to include in response (omit for all fields)'),
    ] = None
    filters: Annotated[
        Filters | None, Field(description='Filter criteria for querying creatives')
    ] = None
    include_assignments: Annotated[
        bool | None, Field(description='Include package assignment information in response')
    ] = True
    include_performance: Annotated[
        bool | None, Field(description='Include aggregated performance metrics in response')
    ] = False
    include_sub_assets: Annotated[
        bool | None,
        Field(description='Include sub-assets (for carousel/native formats) in response'),
    ] = False
    pagination: Annotated[Pagination | None, Field(description='Pagination parameters')] = None
    sort: Annotated[Sort | None, Field(description='Sorting parameters')] = None
