from marshmallow import Schema, fields, validate class VendorsDataloader(Schema): """Base schema for validating vendor UUID in dataloader requests. Attributes: vendor_uuids (list[UUID]): Required list of vendor UUIDs to process. Each UUID must be valid and strictly formatted. """ vendor_uuids = fields.List( fields.UUID(), required=True, ) class SubaccountsDataloader(Schema): """Base schema for validating subaccount UUID in dataloader requests. Attributes: subaccount_uuids (list[UUID]): Required list of vendor UUIDs to process. Each UUID must be valid and strictly formatted. """ subaccount_uuids = fields.List( fields.UUID(), required=True, ) class VendorsDataloaderWithMinLength(Schema): """Schema for vendor UUID in dataloader requests that require at least one UUID. Attributes: vendor_uuids (list[UUID]): Required non-empty list of vendor UUIDs. Must contain at least one valid UUID. """ vendor_uuids = fields.List( fields.UUID(), required=True, validate=validate.Length(min=1), ) class SkipAccessCheck(Schema): """Schema for dataloader endpoints with access control bypass functionality. This schema provides a skip_access_check field that allows bypassing access checks. Attributes: skip_access_check (bool): Optional flag to bypass access checks. Defaults to False (access checks enabled). When True, skips access checks. """ skip_access_check = fields.Boolean( required=False, load_default=False, dump_default=False, truthy={True}, falsy={False}, ) class VendorCompanyBrandsDataloaderSchema(VendorsDataloader, SkipAccessCheck): """Schema for validating POST /vendors/company_brands/dataloader requests. This schema validates requests to fetch company_brand for multiple vendors. It combines vendor UUID validation with optional access control bypass functionality. Attributes: vendor_uuids (list[UUID]): Required list of vendor UUIDs to fetch company brands for. skip_access_check (bool): Optional flag to bypass access checks. Example: { "vendor_uuids": ["123e4567-e89b-12d3-a456-426614174000"], "skip_access_check": false } """ pass class VendorServiceTierDataloaderSchema(VendorsDataloader, SkipAccessCheck): """Schema for validating POST /vendors/service_tier/dataloader requests. This schema validates requests to fetch company_brand for multiple vendors. It combines vendor UUID validation with optional access control bypass functionality. Attributes: vendor_uuids (list[UUID]): Required list of vendor UUIDs to fetch company brands for. skip_access_check (bool): Optional flag to bypass access checks. Example: { "vendor_uuids": ["123e4567-e89b-12d3-a456-426614174000"], "skip_access_check": false } """ pass class VendorClosersRequestSchema(VendorsDataloaderWithMinLength): """Schema for validating POST /vendors/closers/dataloader requests. This schema validates requests to fetch closers for multiple vendors. It requires at least one vendor UUID to be provided in the request payload. Attributes: vendor_uuids (list[UUID]): Required non-empty list of vendor UUIDs to fetch the closers for. Must contain at least one valid UUID. Example: { "vendor_uuids": ["123e4567-e89b-12d3-a456-426614174000"] } """ pass class VendorFirstStatementPeriodRequestSchema(VendorsDataloaderWithMinLength): """Schema for validating POST /vendors/first_statement_period/dataloader requests. This schema validates requests to fetch closers for multiple vendors. It requires at least one vendor UUID to be provided in the request payload. Attributes: vendor_uuids (list[UUID]): Required non-empty list of vendor UUIDs to fetch the closers for. Must contain at least one valid UUID. Example: { "vendor_uuids": ["123e4567-e89b-12d3-a456-426614174000"] } """ pass class VendorRelationshipNotesRequestSchema(VendorsDataloaderWithMinLength): """ Schema for validating POST /vendors/relationship_notes/dataloader requests. This schema validates requests containing a non-empty list of vendor UUIDs. Each UUID must be a valid UUID string. """ pass