# generated by datamodel-codegen:
#   filename:  core/requirements/javascript_asset_requirements.json
#   timestamp: 2026-02-23T01:56:40+00:00

from __future__ import annotations

from enum import Enum
from typing import Annotated

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


class ModuleType(Enum):
    script = 'script'
    module = 'module'
    iife = 'iife'


class JavascriptAssetRequirements(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    allowed_external_domains: Annotated[
        list[str] | None,
        Field(
            description='List of domains the JavaScript may reference for external resources. Only applicable when external_resources_allowed is true.'
        ),
    ] = None
    external_resources_allowed: Annotated[
        bool | None,
        Field(description='Whether the JavaScript can load external resources dynamically'),
    ] = None
    max_file_size_kb: Annotated[
        int | None,
        Field(description='Maximum file size in kilobytes for the JavaScript asset', ge=1),
    ] = None
    module_type: Annotated[
        ModuleType | None,
        Field(
            description="Required JavaScript module format. 'script' = classic script, 'module' = ES modules, 'iife' = immediately invoked function expression"
        ),
    ] = None
    strict_mode_required: Annotated[
        bool | None, Field(description='Whether the JavaScript must use strict mode')
    ] = None
