Module adcp.types.domains.media_buy.change_term_constraints

Classes

class MediaBuyChangeTermConstraints1 (**data: Any)
Expand source code
class MediaBuyChangeTermConstraints1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['budget'] = 'budget'
    max_delta_amount: Annotated[
        Money | None,
        Field(
            description='Maximum absolute amount by which the affected budget may change in the direction named by the action.'
        ),
    ] = None
    max_delta_percent: Annotated[
        StrictFloat | None,
        Field(
            description='Maximum percentage change relative to the current committed value. Values above 100 are valid for increases greater than the current value.',
            ge=0.0,
        ),
    ] = None
    min_result_amount: Annotated[
        Money | None, Field(description='Minimum resulting committed value after the change.')
    ] = None
    max_result_amount: Annotated[
        Money | None, Field(description='Maximum resulting committed value after the change.')
    ] = None


    @model_validator(mode='after')
    def _require_portable_bound(self) -> MediaBuyChangeTermConstraints1:
        if not any(getattr(self, name) is not None for name in ('max_delta_amount', 'max_delta_percent', 'min_result_amount', 'max_result_amount')):
            raise ValueError('at least one portable constraint bound is required')
        return self

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var kind : Literal['budget']
var max_delta_amount : Money | None
var max_delta_percent : float | None
var max_result_amount : Money | None
var min_result_amount : Money | None
var model_config

Inherited members

class MediaBuyChangeTermConstraints2 (**data: Any)
Expand source code
class MediaBuyChangeTermConstraints2(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['flight'] = 'flight'
    max_change: Annotated[
        duration.Duration | None,
        Field(
            description='Maximum extension, shortening, or shift in the direction named by the action.'
        ),
    ] = None
    earliest_result: Annotated[
        AwareDatetime | None,
        Field(description='Earliest resulting start or end timestamp accepted for this action.'),
    ] = None
    latest_result: Annotated[
        AwareDatetime | None,
        Field(description='Latest resulting start or end timestamp accepted for this action.'),
    ] = None
    minimum_notice: Annotated[
        duration.Duration | None,
        Field(
            description='Minimum elapsed notice before the requested flight change may take effect.'
        ),
    ] = None


    @model_validator(mode='after')
    def _require_portable_bound(self) -> MediaBuyChangeTermConstraints2:
        if not any(getattr(self, name) is not None for name in ('max_change', 'earliest_result', 'latest_result', 'minimum_notice')):
            raise ValueError('at least one portable constraint bound is required')
        return self

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var earliest_result : pydantic.types.AwareDatetime | None
var kind : Literal['flight']
var latest_result : pydantic.types.AwareDatetime | None
var max_change : Duration | None
var minimum_notice : Duration | None
var model_config

Inherited members

class MediaBuyChangeTermConstraints3 (**data: Any)
Expand source code
class MediaBuyChangeTermConstraints3(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['package_count'] = 'package_count'
    max_additions: Annotated[
        SchemaInt | None,
        Field(description='Maximum packages that may be added by one exercise of the right.', ge=0),
    ] = None
    max_removals: Annotated[
        SchemaInt | None,
        Field(
            description='Maximum packages that may be removed by one exercise of the right.', ge=0
        ),
    ] = None
    max_result_count: Annotated[
        SchemaInt | None, Field(description='Maximum active package count after the change.', ge=0)
    ] = None


    @model_validator(mode='after')
    def _require_portable_bound(self) -> MediaBuyChangeTermConstraints3:
        if not any(getattr(self, name) is not None for name in ('max_additions', 'max_removals', 'max_result_count')):
            raise ValueError('at least one portable constraint bound is required')
        return self

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var kind : Literal['package_count']
var max_additions : int | None
var max_removals : int | None
var max_result_count : int | None
var model_config

Inherited members

class MediaBuyChangeTermConstraints4 (**data: Any)
Expand source code
class MediaBuyChangeTermConstraints4(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['effective_timing'] = 'effective_timing'
    minimum_notice: Annotated[
        duration.Duration | None,
        Field(
            description='Minimum elapsed notice before pause, resume, cancellation, or another operational action may take effect.'
        ),
    ] = None
    earliest_effective_at: AwareDatetime | None = None
    latest_effective_at: AwareDatetime | None = None


    @model_validator(mode='after')
    def _require_portable_bound(self) -> MediaBuyChangeTermConstraints4:
        if not any(getattr(self, name) is not None for name in ('minimum_notice', 'earliest_effective_at', 'latest_effective_at')):
            raise ValueError('at least one portable constraint bound is required')
        return self

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var earliest_effective_at : pydantic.types.AwareDatetime | None
var kind : Literal['effective_timing']
var latest_effective_at : pydantic.types.AwareDatetime | None
var minimum_notice : Duration | None
var model_config

Inherited members

class Money (**data: Any)
Expand source code
class Money(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    amount: Annotated[StrictFloat, Field(ge=0.0)]
    currency: Annotated[str, Field(pattern='^[A-Z]{3}$')]

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var amount : float
var currency : str
var model_config

Inherited members