# generated by datamodel-codegen:
#   filename:  temp_openapi.json
#   timestamp: 2025-07-09T01:08:11+00:00

from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, ConfigDict, EmailStr, Field, RootModel, conint, constr


class BolImagesRequest(BaseModel):
    order_ids: Optional[List[str]] = Field([], title='Order Ids')
    order_numbers: Optional[List[str]] = Field([], title='Order Numbers')


class DeliveryTicketById(BaseModel):
    order_id: str = Field(..., title='Order Id')
    store_id: str = Field(..., title='Store Id')


class DeliveryTicketByNumber(BaseModel):
    order_number: int = Field(..., title='Order Number')
    store_number: str = Field(..., title='Store Number')


class DriverCredentialUpsertRequest(BaseModel):
    driver_id: str = Field(..., title='Driver Id')
    credential_id: str = Field(..., title='Credential Id')
    certification_date: Optional[datetime] = Field(None, title='Certification Date')
    expiration_date: Optional[datetime] = Field(None, title='Expiration Date')


class Type(Enum):
    regular = 'regular'
    order_request = 'order_request'
    backhaul = 'backhaul'


class IntegrationFormResponseOverviewReq(BaseModel):
    form_name: Optional[str] = Field(None, title='Form Name')
    from_date: datetime = Field(..., title='From Date')
    to_date: datetime = Field(..., title='To Date')
    market: Optional[str] = Field(None, title='Market')


class OptimalSupplyReportRequest(BaseModel):
    order_numbers: Optional[List[int]] = Field(None, title='Order Numbers')
    order_ids: Optional[List[str]] = Field(None, title='Order Ids')
    order_date_start: Optional[datetime] = Field(None, title='Order Date Start')
    order_date_end: Optional[datetime] = Field(None, title='Order Date End')
    movement_updated_start: Optional[datetime] = Field(
        None, title='Movement Updated Start'
    )
    movement_updated_end: Optional[datetime] = Field(None, title='Movement Updated End')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')


class OptimalSupplyReportRow(BaseModel):
    order_number: int = Field(..., title='Order Number')
    order_id: str = Field(..., title='Order Id')
    site_number: str = Field(..., title='Site Number')
    actual_component_product: str = Field(..., title='Actual Component Product')
    actual_component_product_id: str = Field(..., title='Actual Component Product Id')
    optimal_component_product: str = Field(..., title='Optimal Component Product')
    optimal_component_product_id: str = Field(..., title='Optimal Component Product Id')
    actual_terminal: str = Field(..., title='Actual Terminal')
    actual_terminal_id: str = Field(..., title='Actual Terminal Id')
    optimal_terminal: str = Field(..., title='Optimal Terminal')
    optimal_terminal_id: str = Field(..., title='Optimal Terminal Id')
    actual_supplier: str = Field(..., title='Actual Supplier')
    actual_supplier_id: str = Field(..., title='Actual Supplier Id')
    optimal_supplier: str = Field(..., title='Optimal Supplier')
    optimal_supplier_id: str = Field(..., title='Optimal Supplier Id')
    actual_price_type: str = Field(..., title='Actual Price Type')
    optimal_price_type: str = Field(..., title='Optimal Price Type')
    actual_contract: Optional[str] = Field(None, title='Actual Contract')
    optimal_contract: Optional[str] = Field(None, title='Optimal Contract')
    actual_curve_id: str = Field(..., title='Actual Curve Id')
    optimal_curve_id: str = Field(..., title='Optimal Curve Id')
    actual_price_id: str = Field(..., title='Actual Price Id')
    optimal_price_id: str = Field(..., title='Optimal Price Id')
    actual_loaded_miles: float = Field(..., title='Actual Loaded Miles')
    optimal_loaded_miles: float = Field(..., title='Optimal Loaded Miles')
    actual_product_price: float = Field(..., title='Actual Product Price')
    optimal_product_price: float = Field(..., title='Optimal Product Price')
    actual_freight_rate: float = Field(..., title='Actual Freight Rate')
    optimal_freight_rate: float = Field(..., title='Optimal Freight Rate')
    actual_total_price: float = Field(..., title='Actual Total Price')
    optimal_total_price: float = Field(..., title='Optimal Total Price')
    total_price_delta: float = Field(..., title='Total Price Delta')
    actual_volume: float = Field(..., title='Actual Volume')
    optimal_volume: float = Field(..., title='Optimal Volume')
    last_change_date: datetime = Field(..., title='Last Change Date')
    last_updated_date: datetime = Field(..., title='Last Updated Date')
    reason_code: Optional[str] = Field(None, title='Reason Code')


class PydanticObjectId(
    RootModel[constr(pattern=r'^[0-9a-f]{24}$', min_length=24, max_length=24)]
):
    root: constr(pattern=r'^[0-9a-f]{24}$', min_length=24, max_length=24) = Field(
        ..., examples=['5eb7cf5a86d9755df3a6c593']
    )


class RouteUpsertReq(BaseModel):
    origin_name: str = Field(..., title='Origin Name')
    destination_name: str = Field(..., title='Destination Name')
    api_distance_miles: Optional[float] = Field(None, title='Api Distance Miles')
    api_travel_time_seconds: Optional[float] = Field(
        None, title='Api Travel Time Seconds'
    )
    override_travel_time_seconds: Optional[int] = Field(
        None, title='Override Travel Time Seconds'
    )
    override_distance_miles: Optional[float] = Field(
        None, title='Override Distance Miles'
    )
    override_payroll_miles: Optional[int] = Field(None, title='Override Payroll Miles')


class SalesAdjustedDeliveryUpsertReq(BaseModel):
    source: str = Field(..., title='Source')
    store_id: str = Field(..., title='Store Id')
    tank_id: str = Field(..., title='Tank Id')
    product_id: str = Field(..., title='Product Id')
    volume: float = Field(..., title='Volume')
    date: datetime = Field(..., title='Date')


class SurchargeUpdateReq(BaseModel):
    id: PydanticObjectId
    effective_from: datetime = Field(..., title='Effective From')
    effective_to: Optional[datetime] = Field(None, title='Effective To')
    surcharge: Optional[float] = Field(None, title='Surcharge')


class TractorView(BaseModel):
    id: str = Field(..., title='Id')
    tractor_number: str = Field(..., title='Tractor Number')
    depot: Optional[str] = Field(None, title='Depot')
    vin: Optional[str] = Field(None, title='Vin')
    model: Optional[str] = Field(None, title='Model')
    make: Optional[str] = Field(None, title='Make')
    year: Optional[int] = Field(None, title='Year')
    weight: Optional[int] = Field(None, title='Weight')
    next_maintenance: Optional[datetime] = Field(None, title='Next Maintenance')
    next_tractor_maintenance_required: Optional[bool] = Field(
        None, title='Next Tractor Maintenance Required'
    )
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')


class TrailerConfigMatrixView(BaseModel):
    id: str = Field(..., title='Id')
    importance: int = Field(..., title='Importance')
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    code: Optional[str] = Field(None, title='Code')
    values: Optional[List[float]] = Field([], title='Values')
    updated_on: Optional[datetime] = Field(None, title='Updated On')


class TrailerView(BaseModel):
    id: str = Field(..., title='Id')
    trailer_number: str = Field(..., title='Trailer Number')
    configuration: Optional[str] = Field(None, title='Configuration')
    depot: Optional[str] = Field(None, title='Depot')
    make: Optional[str] = Field(None, title='Make')
    model: Optional[str] = Field(None, title='Model')
    weight: Optional[float] = Field(None, title='Weight')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')


class UpsertTractorReq(BaseModel):
    id: Optional[str] = Field(None, title='Id')
    tractor_number: Optional[str] = Field(None, title='Tractor Number')
    depot: Optional[str] = Field(None, title='Depot')
    vin: Optional[str] = Field(None, title='Vin')
    make: Optional[str] = Field(None, title='Make')
    model: Optional[str] = Field(None, title='Model')
    year: Optional[int] = Field(None, title='Year')
    weight: Optional[int] = Field(None, title='Weight')
    next_maintenance: Optional[datetime] = Field(None, title='Next Maintenance')
    next_tractor_maintenance_required: Optional[bool] = Field(
        None, title='Next Tractor Maintenance Required'
    )
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')


class UpsertTractorResp(BaseModel):
    created: Optional[int] = Field(0, title='Created')
    updated: Optional[int] = Field(0, title='Updated')
    errors: List[str] = Field(..., title='Errors')


class UpsertTrailerReq(BaseModel):
    id: Optional[str] = Field(None, title='Id')
    trailer_number: Optional[str] = Field(None, title='Trailer Number')
    configuration: Optional[str] = Field(None, title='Configuration')
    depot: Optional[str] = Field(None, title='Depot')
    make: Optional[str] = Field(None, title='Make')
    model: Optional[str] = Field(None, title='Model')
    weight: Optional[float] = Field(None, title='Weight')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')


class UpsertTrailerResp(BaseModel):
    created: Optional[int] = Field(0, title='Created')
    updated: Optional[int] = Field(0, title='Updated')
    errors: List[str] = Field(..., title='Errors')


class AllocatedBolResponse(RootModel[Any]):
    root: Any


class BillableDateType(RootModel[Any]):
    root: Any


class BillableVolumeType(RootModel[Any]):
    root: Any


class BlendView(RootModel[Any]):
    root: Any


class BolImageResponse(RootModel[Any]):
    root: Any


class Card(RootModel[Any]):
    root: Any


class ContractVolumeRequest(RootModel[Any]):
    root: Any


class Coordinate(RootModel[Any]):
    root: Any


class Counterparty(RootModel[Any]):
    root: Any


class DateWindow(RootModel[Any]):
    root: Any


class DaysOfWeek(RootModel[Any]):
    root: Any


class DeliveryRequestStatus(RootModel[Any]):
    root: Any


class DeliveryWindow(RootModel[Any]):
    root: Any


class DeliveryWindowDefault(RootModel[Any]):
    root: Any


class DriverCredentialView(RootModel[Any]):
    root: Any


class DriverTerminalCardView(RootModel[Any]):
    root: Any


class DropCreateRequest(RootModel[Any]):
    root: Any


class DropWorkflow(RootModel[Any]):
    root: Any


class Dwell(RootModel[Any]):
    root: Any


class EBolDetailRequest(RootModel[Any]):
    root: Any


class ExternalBOLDetailRequest(RootModel[Any]):
    root: Any


class FormFieldResponse(RootModel[Any]):
    root: Any


class FreightCost(RootModel[Any]):
    root: Any


class FreightItem(RootModel[Any]):
    root: Any


class FreightTransactionOutput(RootModel[Any]):
    root: Any


class FreightTransactionDetailOutput(RootModel[Any]):
    root: Any


class FreightTransactionRowOutput(RootModel[Any]):
    root: Any


class InCabSupplyOptionMode(RootModel[Any]):
    root: Any


class InCabTripMode(RootModel[Any]):
    root: Any


class InNetworkSupplyZone(RootModel[Any]):
    root: Any


class InNetworkTerminal(RootModel[Any]):
    root: Any


class InvoiceDynamicStatus(RootModel[Any]):
    root: Any


class InvoiceStaticStatus(RootModel[Any]):
    root: Any


class InvoiceType(RootModel[Any]):
    root: Any


class Key(RootModel[Any]):
    root: Any


class LocationResponse(RootModel[Any]):
    root: Any


class MonitoringStrategy(RootModel[Any]):
    root: Any


class NOSupplyOptionResponse(RootModel[Any]):
    root: Any


class OrderCreateStatus(RootModel[Any]):
    root: Any


class OrderDriver(RootModel[Any]):
    root: Any


class OrderReqNotificationStates(RootModel[Any]):
    root: Any


class OrderResponse(RootModel[Any]):
    root: Any


class OrderState(RootModel[Any]):
    root: Any


class OrderType(RootModel[Any]):
    root: Any


class PayrollExportDetailModel(RootModel[Any]):
    root: Any


class PriceType(RootModel[Any]):
    root: Any


class ProductGroups(RootModel[Any]):
    root: Any


class ProductIDName(RootModel[Any]):
    root: Any


class RateBookType(RootModel[Any]):
    root: Any


class SaveDropDetail(RootModel[Any]):
    root: Any


class SaveDropMode(RootModel[Any]):
    root: Any


class Shift(RootModel[Any]):
    root: Any


class SourceMap(RootModel[Any]):
    root: Any


class SourcingStrategy(RootModel[Any]):
    root: Any


class StatusUpdate(RootModel[Any]):
    root: Any


class StoreStatus(RootModel[Any]):
    root: Any


class StoreTank(RootModel[Any]):
    root: Any


class SupplyPriceUpdateResponse(RootModel[Any]):
    root: Any


class SurchargeType(RootModel[Any]):
    root: Any


class TankLidEnum(RootModel[Any]):
    root: Any


class TerminalType(RootModel[Any]):
    root: Any


class TimezoneEnum(RootModel[Any]):
    root: Any


class UnavailableHours(RootModel[Any]):
    root: Any


class UnavailableHoursRequest(RootModel[Any]):
    root: Any


class ValidationError(RootModel[Any]):
    root: Any


class VolumeDistributionRequest(RootModel[Any]):
    root: Any


class WaterReadingRequirement(RootModel[Any]):
    root: Any


class ForecastApiCreateRequest(RootModel[Any]):
    root: Any


class MarketSchemaSectorView(RootModel[Any]):
    root: Any


class OrderSchemaBolResponse(RootModel[Any]):
    root: Any


class OrderSchemaDropResponse(RootModel[Any]):
    root: Any


class BolAndDropResponse(BaseModel):
    order_number: Optional[str] = Field(None, title='Order Number')
    order_id: Optional[str] = Field(None, title='Order Id')
    po: Optional[str] = Field(None, title='Po')
    carrier_id: Optional[str] = Field(None, title='Carrier Id')
    last_movement_update: Optional[datetime] = Field(None, title='Last Movement Update')
    order_date: Optional[datetime] = Field(None, title='Order Date')
    status: Optional[str] = Field(None, title='Status')
    type: Optional[str] = Field(None, title='Type')
    drops: Optional[List[OrderSchemaDropResponse]] = Field(None, title='Drops')
    bols: Optional[List[OrderSchemaBolResponse]] = Field(None, title='Bols')
    costs: Optional[List[FreightCost]] = Field(None, title='Costs')
    validation_bypass_on: Optional[datetime] = Field(None, title='Validation Bypass On')
    has_additives: Optional[bool] = Field(False, title='Has Additives')
    estimated_freight: Optional[FreightTransactionOutput] = None
    actual_freight: Optional[FreightTransactionOutput] = None
    allocated_bol_error: Optional[str] = Field(None, title='Allocated Bol Error')
    allocated_bol_issue: Optional[str] = Field(None, title='Allocated Bol Issue')
    allocated_bols: Optional[List[AllocatedBolResponse]] = Field(
        None, title='Allocated Bols'
    )
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    reference_order_number: Optional[str] = Field(None, title='Reference Order Number')


class BolImagesResponse(BaseModel):
    order_id: Optional[str] = Field(None, title='Order Id')
    bol_id: Optional[str] = Field(None, title='Bol Id')
    bol_number: Optional[str] = Field(None, title='Bol Number')
    photos: Optional[List[BolImageResponse]] = Field(None, title='Photos')


class BolsAndDropsRequest(BaseModel):
    order_date_start: Optional[datetime] = Field(None, title='Order Date Start')
    order_date_end: Optional[datetime] = Field(None, title='Order Date End')
    movement_updated_start: Optional[datetime] = Field(
        None, title='Movement Updated Start'
    )
    movement_updated_end: Optional[datetime] = Field(None, title='Movement Updated End')
    order_ids: Optional[List[str]] = Field([], title='Order Ids')
    order_numbers: Optional[List[int]] = Field([], title='Order Numbers')
    order_states: Optional[List[OrderState]] = Field([], title='Order States')
    order_types: Optional[List[OrderType]] = Field([], title='Order Types')
    include_invalid: Optional[bool] = Field(False, title='Include Invalid')
    include_bol_allocation: Optional[bool] = Field(
        False, title='Include Bol Allocation'
    )
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    reference_order_numbers: Optional[List[str]] = Field(
        [], title='Reference Order Numbers'
    )


class CounterpartyView(BaseModel):
    id: str = Field(..., title='Id')
    name: str = Field(..., title='Name')
    goid: Optional[str] = Field(None, title='Goid')
    scac: Optional[str] = Field(None, title='Scac')
    types: Optional[List[str]] = Field(None, title='Types')
    carrier_type: Optional[str] = Field(None, title='Carrier Type')
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system: Optional[str] = Field(None, title='Source System')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    emails: Optional[List[str]] = Field(None, title='Emails')
    sourcing_strategy: Optional[SourcingStrategy] = None
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    allow_short_loads: Optional[bool] = Field(False, title='Allow Short Loads')
    order_notification_preferences: Optional[List[OrderReqNotificationStates]] = Field(
        [], title='Order Notification Preferences'
    )
    supply_map: Optional[List[SourceMap]] = Field([], title='Supply Map')


class CreateGroupRequest(BaseModel):
    source_id: Optional[str] = Field(None, title='Source Id')
    name: str = Field(..., title='Name')
    keys: List[Key] = Field(..., title='Keys')
    as_of: datetime = Field(..., title='As Of')
    min: Optional[float] = Field(None, title='Min')
    max: Optional[float] = Field(None, title='Max')
    start_hour: Optional[int] = Field(None, title='Start Hour')
    volume_distributions: Optional[List[VolumeDistributionRequest]] = Field(
        [], title='Volume Distributions'
    )
    contract_volumes: Optional[List[ContractVolumeRequest]] = Field(
        [], title='Contract Volumes'
    )
    daily_percent: Optional[float] = Field(None, title='Daily Percent')
    weekly_percent: Optional[float] = Field(None, title='Weekly Percent')
    monthly_percent: Optional[float] = Field(None, title='Monthly Percent')
    contract_start: Optional[datetime] = Field(None, title='Contract Start')
    contract_end: Optional[datetime] = Field(None, title='Contract End')
    week_start_day: Optional[DaysOfWeek] = 'monday'


class DriverView(BaseModel):
    id: str = Field(..., title='Id')
    name: Optional[str] = Field('', title='Name')
    username: Optional[str] = Field('', title='Username')
    depot_id: Optional[str] = Field(None, title='Depot Id')
    depot_name: Optional[str] = Field(None, title='Depot Name')
    in_cab_trip_mode: Optional[InCabTripMode] = Field(
        default_factory=lambda: InCabTripMode.model_validate('all')
    )
    in_cab_supply_option_mode: Optional[InCabSupplyOptionMode] = Field(
        default_factory=lambda: InCabSupplyOptionMode.model_validate('disabled')
    )
    trailer_number: Optional[str] = Field(None, title='Trailer Number')
    tractor_number: Optional[str] = Field(None, title='Tractor Number')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    cards: Optional[List[DriverTerminalCardView]] = Field([], title='Cards')
    credentials: Optional[List[DriverCredentialView]] = Field([], title='Credentials')


class EBolRequest(BaseModel):
    source_system: str = Field(..., title='Source System')
    bol_number: str = Field(..., title='Bol Number')
    date: datetime = Field(..., title='Date')
    terminal_id: str = Field(..., title='Terminal Id')
    supplier_id: str = Field(..., title='Supplier Id')
    details: List[EBolDetailRequest] = Field(..., title='Details')


class ExternalBOLRequest(BaseModel):
    order_id: str = Field(..., title='Order Id')
    bol_number: str = Field(..., title='Bol Number')
    terminal_id: str = Field(..., title='Terminal Id')
    bol_date: datetime = Field(..., title='Bol Date')
    details: List[ExternalBOLDetailRequest] = Field(..., title='Details')


class FormResponseRow(BaseModel):
    id: PydanticObjectId
    name: str = Field(..., title='Name')
    description: Optional[str] = Field(None, title='Description')
    order_number: int = Field(..., title='Order Number')
    driver_name: str = Field(..., title='Driver Name')
    date: datetime = Field(..., title='Date')
    shift: str = Field(..., title='Shift')
    location_name: Optional[str] = Field(None, title='Location Name')
    address: Optional[str] = Field(None, title='Address')
    latitude: Optional[float] = Field(None, title='Latitude')
    longitude: Optional[float] = Field(None, title='Longitude')
    market: Optional[str] = Field(None, title='Market')
    sector: Optional[str] = Field(None, title='Sector')
    supply_zones: Optional[List[str]] = Field([], title='Supply Zones')
    tractor: Optional[str] = Field(None, title='Tractor')
    trailer_number: Optional[str] = Field(None, title='Trailer Number')
    required: Optional[bool] = Field(False, title='Required')
    response: List[FormFieldResponse] = Field(..., title='Response')


class FreightIntegrationReq(BaseModel):
    order_numbers: Optional[List[int]] = Field(None, title='Order Numbers')
    order_ids: Optional[List[PydanticObjectId]] = Field(None, title='Order Ids')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')


class GetOrderRequestResponse(BaseModel):
    type: Optional[str] = Field(None, title='Type')
    number: int = Field(..., title='Number')
    order_id: Optional[str] = Field(None, title='Order Id')
    order_number: Optional[int] = Field(None, title='Order Number')
    order_date: Optional[datetime] = Field(None, title='Order Date')
    order_state: Optional[Union[DeliveryRequestStatus, str]] = Field(
        None, title='Order State'
    )
    reference_order_number: Optional[str] = Field(None, title='Reference Order Number')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    site_name: Optional[str] = Field(None, title='Site Name')
    site_id: Optional[str] = Field(None, title='Site Id')
    customer_id: Optional[str] = Field(None, title='Customer Id')
    customer_name: Optional[str] = Field(None, title='Customer Name')
    delivery_window_start: datetime = Field(..., title='Delivery Window Start')
    delivery_window_end: datetime = Field(..., title='Delivery Window End')
    products: List[ProductIDName] = Field(..., title='Products')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')
    status: str = Field(..., title='Status')


class GetOrderResponse(BaseModel):
    type: Optional[Type] = Field('regular', title='Type')
    order_id: Optional[str] = Field(None, title='Order Id')
    drivers: Optional[List[OrderDriver]] = Field([], title='Drivers')
    order_number: Optional[int] = Field(None, title='Order Number')
    order_date: Optional[datetime] = Field(None, title='Order Date')
    order_state: Optional[str] = Field(None, title='Order State')
    carrier_window_start: Optional[datetime] = Field(None, title='Carrier Window Start')
    carrier_window_end: Optional[datetime] = Field(None, title='Carrier Window End')
    carrier_notify_state: Optional[str] = Field(None, title='Carrier Notify State')
    load_window_start: Optional[datetime] = Field(None, title='Load Window Start')
    load_window_end: Optional[datetime] = Field(None, title='Load Window End')
    dispatch_window_start: Optional[datetime] = Field(
        None, title='Dispatch Window Start'
    )
    dispatch_window_end: Optional[datetime] = Field(None, title='Dispatch Window End')
    hauler_counterparty_id: Optional[str] = Field(None, title='Hauler Counterparty Id')
    hauler_counterparty_name: Optional[str] = Field(
        None, title='Hauler Counterparty Name'
    )
    hauler_counterparty_source_id: Optional[str] = Field(
        None, title='Hauler Counterparty Source Id'
    )
    hauler_counterparty_source_system: Optional[str] = Field(
        None, title='Hauler Counterparty Source System'
    )
    hauled_by_updated_by: Optional[str] = Field(None, title='Hauled By Updated By')
    hauled_by_updated: Optional[datetime] = Field(None, title='Hauled By Updated')
    loads: Optional[List[LocationResponse]] = Field([], title='Loads')
    drops: Optional[List[LocationResponse]] = Field([], title='Drops')
    trip_status: Optional[str] = Field(None, title='Trip Status')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    market: Optional[str] = Field(None, title='Market')
    supply_option: Optional[NOSupplyOptionResponse] = None
    created_by: Optional[str] = Field(None, title='Created By')
    note: Optional[str] = Field(None, title='Note')
    estimated_load_minutes: Optional[int] = Field(None, title='Estimated Load Minutes')
    total_miles: Optional[float] = Field(None, title='Total Miles')
    loaded_miles: Optional[float] = Field(None, title='Loaded Miles')
    unloaded_miles: Optional[float] = Field(None, title='Unloaded Miles')
    reference_order_number: Optional[str] = Field(None, title='Reference Order Number')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')


class GetOrdersRequest(BaseModel):
    order_id: Optional[str] = Field(None, title='Order Id')
    order_number: Optional[int] = Field(None, title='Order Number')
    type: Optional[str] = Field(None, title='Type')
    state: Optional[Union[OrderState, str]] = Field(None, title='State')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    order_date_start: Optional[datetime] = Field(None, title='Order Date Start')
    order_date_end: Optional[datetime] = Field(None, title='Order Date End')
    reference_order_number: Optional[str] = Field(None, title='Reference Order Number')
    order_date: Optional[datetime] = Field(None, title='Order Date')


class HTTPValidationError(BaseModel):
    detail: Optional[List[ValidationError]] = Field(None, title='Detail')


class ImportRequest(BaseModel):
    reqs: List[ForecastApiCreateRequest] = Field(..., max_length=5000, title='Reqs')


class InvoiceAllReq(BaseModel):
    order_numbers: Optional[List[int]] = Field(None, title='Order Numbers')
    order_ids: Optional[List[str]] = Field(None, title='Order Ids')
    invoice_numbers: Optional[List[str]] = Field(None, title='Invoice Numbers')
    status: Optional[InvoiceStaticStatus] = 'sent'
    counterparty_name: Optional[str] = Field(None, title='Counterparty Name')
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    book_type: Optional[RateBookType] = Field(
        default_factory=lambda: RateBookType.model_validate('Revenue')
    )
    as_of: Optional[datetime] = Field(None, title='As Of')
    between: Optional[DateWindow] = None


class InvoiceRow(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    invoice_number: str = Field(..., title='Invoice Number')
    sent_date: Optional[datetime] = Field(None, title='Sent Date')
    when_to_send_date: Optional[datetime] = Field(None, title='When To Send Date')
    created_on: Optional[datetime] = Field(None, title='Created On')
    type: InvoiceType
    status: Optional[Union[InvoiceStaticStatus, InvoiceDynamicStatus]] = Field(
        None, title='Status'
    )
    transactions: List[FreightTransactionRowOutput] = Field(..., title='Transactions')
    note: Optional[str] = Field(None, title='Note')
    base_amount: float = Field(..., title='Base Amount')
    base_distance: float = Field(..., title='Base Distance')
    distance_uom: str = Field(..., title='Distance Uom')
    accessorial_amount: float = Field(..., title='Accessorial Amount')
    surcharge_amount: float = Field(..., title='Surcharge Amount')
    total_amount: float = Field(..., title='Total Amount')


class LocationView(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    id: str = Field(..., title='Id')
    name: str = Field(..., title='Name')
    short_name: Optional[str] = Field(None, title='Short Name')
    market: Optional[str] = Field(None, title='Market')
    market_id: Optional[str] = Field(None, title='Market Id')
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')
    type: Optional[str] = Field(None, title='Type')
    lat: Optional[float] = Field(None, title='Lat')
    lon: Optional[float] = Field(None, title='Lon')
    address: Optional[str] = Field(None, title='Address')
    phone: Optional[str] = Field(None, title='Phone')
    city: Optional[str] = Field(None, title='City')
    state: Optional[str] = Field(None, title='State')
    active: Optional[bool] = Field(None, title='Active')
    postal_code: Optional[str] = Field(None, title='Postal Code')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system: Optional[str] = Field(None, title='Source System')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    timezone: Optional[str] = Field(None, title='Timezone')
    supply_zones: Optional[List[str]] = Field([], title='Supply Zones')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    cards: Optional[List[Card]] = Field([], title='Cards')
    dwells: Optional[List[Dwell]] = Field([], title='Dwells')
    requires_card: Optional[bool] = Field(None, title='Requires Card')
    geofence: Optional[List[Coordinate]] = Field(None, title='Geofence')
    supply_map: Optional[List[SourceMap]] = Field([], title='Supply Map')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')


class MarketView(BaseModel):
    id: str = Field(..., title='Id')
    name: str = Field(..., title='Name')
    network_radius: Optional[int] = Field(250, title='Network Radius')
    active: Optional[bool] = Field(True, title='Active')
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    sectors: Optional[List[MarketSchemaSectorView]] = Field([], title='Sectors')
    delivery_window_default: Optional[DeliveryWindowDefault] = {
        'name': 'default',
        'cutoffs': [
            {
                'cutoff_time': 16,
                'earliest_request_hours': 6,
                'earliest_request_offset_days': 1,
            }
        ],
    }


class OrderCreateRequest(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    reference_order_number: Optional[str] = Field(..., title='Reference Order Number')
    supply_owner: Optional[Counterparty] = None
    sourcing_strategy: Optional[SourcingStrategy] = None
    manual_supply_fallback: Optional[bool] = Field(True, title='Manual Supply Fallback')
    allow_alternate_products: Optional[bool] = Field(
        False, title='Allow Alternate Products'
    )
    delivery_window: DeliveryWindow
    fit_to_trailer: Optional[bool] = Field(False, title='Fit To Trailer')
    note: Optional[str] = Field(None, title='Note')
    drops: List[DropCreateRequest] = Field(..., title='Drops')
    accept_by: Optional[datetime] = Field(None, title='Accept By')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')


class OrderCreateResponse(BaseModel):
    status: OrderCreateStatus
    order_number: Optional[int] = Field(None, title='Order Number')
    order: Optional[OrderResponse] = None
    errors: Optional[List[str]] = Field([], title='Errors')
    accept_by: Optional[datetime] = Field(None, title='Accept By')
    reference_order_number: Optional[str] = Field(None, title='Reference Order Number')
    extra_data: Optional[Dict[str, str]] = Field(None, title='Extra Data')


class OrderFreightResp(BaseModel):
    number: int = Field(..., title='Number')
    po: Optional[str] = Field(None, title='Po')
    freight_rate: float = Field(..., title='Freight Rate')
    freight_total: float = Field(..., title='Freight Total')
    freight_items: List[FreightItem] = Field(..., title='Freight Items')


class OrderFreightRespV2(BaseModel):
    number: int = Field(..., title='Number')
    po: Optional[str] = Field(None, title='Po')
    freight_rate: float = Field(..., title='Freight Rate')
    freight_total: float = Field(..., title='Freight Total')
    freight_items: List[FreightTransactionDetailOutput] = Field(
        ..., title='Freight Items'
    )


class OrderStatusUpdateRequest(BaseModel):
    order_id: str = Field(..., title='Order Id')
    order_number: Optional[str] = Field(None, title='Order Number')
    status: StatusUpdate
    location_id: Optional[str] = Field(None, title='Location Id')
    eta: Optional[datetime] = Field(None, title='Eta')
    actual: Optional[datetime] = Field(None, title='Actual')


class PayrollExportDetailResponse(BaseModel):
    driver_name: str = Field(..., title='Driver Name')
    driver_source_id: Optional[str] = Field(None, title='Driver Source Id')
    driver_source_system: str = Field(..., title='Driver Source System')
    end_date: datetime = Field(..., title='End Date')
    hours_worked: float = Field(..., title='Hours Worked')
    pay_earned: float = Field(..., title='Pay Earned')
    payroll_config: Optional[str] = Field(None, title='Payroll Config')
    start_date: datetime = Field(..., title='Start Date')
    status: str = Field(..., title='Status')
    updated: datetime = Field(..., title='Updated')
    detail: Optional[List[PayrollExportDetailModel]] = Field([], title='Detail')


class PriceAllRequest(BaseModel):
    as_of: Optional[datetime] = Field(None, title='As Of')
    last_change_date: Optional[datetime] = Field(None, title='Last Change Date')
    terminals: Optional[List[str]] = Field(None, title='Terminals')
    suppliers: Optional[List[str]] = Field(None, title='Suppliers')
    products: Optional[List[str]] = Field(None, title='Products')
    price_types: Optional[List[PriceType]] = Field(None, title='Price Types')
    product_groups: Optional[List[ProductGroups]] = Field(None, title='Product Groups')


class PriceResponse(BaseModel):
    curve_id: str = Field(..., title='Curve Id')
    price_id: str = Field(..., title='Price Id')
    city: Optional[str] = Field(None, title='City')
    contract: Optional[str] = Field(None, title='Contract')
    product: Optional[str] = Field(None, title='Product')
    product_id: str = Field(..., title='Product Id')
    supplier: Optional[str] = Field(None, title='Supplier')
    supplier_id: str = Field(..., title='Supplier Id')
    counterparty: Optional[str] = Field(None, title='Counterparty')
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    terminal: Optional[str] = Field(None, title='Terminal')
    terminal_id: str = Field(..., title='Terminal Id')
    store_number: Optional[str] = Field(None, title='Store Number')
    store_id: Optional[str] = Field(None, title='Store Id')
    price_type: str = Field(..., title='Price Type')
    product_group: Optional[str] = Field(None, title='Product Group')
    price: float = Field(..., title='Price')
    effective_from: datetime = Field(..., title='Effective From')
    effective_to: datetime = Field(..., title='Effective To')
    expire: Optional[datetime] = Field(None, title='Expire')
    disabled: bool = Field(..., title='Disabled')
    disabled_by: Optional[str] = Field(None, title='Disabled By')
    disabled_until: Optional[datetime] = Field(None, title='Disabled Until')
    disabled_reason: Optional[str] = Field(None, title='Disabled Reason')
    updated_by: Optional[str] = Field(None, title='Updated By')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    group_id: Optional[str] = Field(None, title='Group Id')
    group_effective_cutover: Optional[datetime] = Field(
        None, title='Group Effective Cutover'
    )
    group_effective_cutover_timezone: Optional[str] = Field(
        None, title='Group Effective Cutover Timezone'
    )
    group_identifier: Optional[str] = Field(None, title='Group Identifier')
    group_name: Optional[str] = Field(None, title='Group Name')
    min_constraint: Optional[float] = Field(None, title='Min Constraint')
    max_constraint: Optional[float] = Field(None, title='Max Constraint')
    created_on: Optional[datetime] = Field(None, title='Created On')
    net_or_gross_type: Optional[BillableVolumeType] = None
    contract_lifting_valuation_method: Optional[BillableDateType] = None


class ProductView(BaseModel):
    id: str = Field(..., title='Id')
    name: str = Field(..., title='Name')
    short_name: Optional[str] = Field(None, title='Short Name')
    group: str = Field(..., title='Group')
    weight_group: str = Field(..., title='Weight Group')
    icon: str = Field(..., title='Icon')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system: Optional[str] = Field(None, title='Source System')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')
    blends: Optional[List[BlendView]] = Field([], title='Blends')
    alternate_products: Optional[List[str]] = Field([], title='Alternate Products')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    tank_lid_code_id: Optional[str] = Field(None, title='Tank Lid Code Id')
    supply_map: Optional[List[SourceMap]] = Field([], title='Supply Map')


class SaveDropReq(BaseModel):
    mode: Optional[SaveDropMode] = Field(
        default_factory=lambda: SaveDropMode.model_validate('append')
    )
    order_id: str = Field(..., title='Order Id')
    location_id: str = Field(..., title='Location Id')
    details: List[SaveDropDetail] = Field(..., title='Details')


class StoreV2(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    field_id: Optional[PydanticObjectId] = Field(
        None, alias='_id', description='MongoDB document ObjectID'
    )
    store_number: Optional[str] = Field(None, title='Store Number')
    name: Optional[str] = Field(None, title='Name')
    market: Optional[str] = Field(None, title='Market')
    market_id: Optional[str] = Field(None, title='Market Id')
    sector: Optional[str] = Field(None, title='Sector')
    sector_id: Optional[str] = Field(None, title='Sector Id')
    tanks: Optional[List[StoreTank]] = Field([], title='Tanks')
    lat: Optional[float] = Field(None, title='Lat')
    lon: Optional[float] = Field(None, title='Lon')
    address: Optional[str] = Field(None, title='Address')
    city: Optional[str] = Field(None, title='City')
    state: Optional[str] = Field(None, title='State')
    postal_code: Optional[str] = Field(None, title='Postal Code')
    contact_name: Optional[str] = Field(None, title='Contact Name')
    phone_number: Optional[str] = Field(None, title='Phone Number')
    emails: Optional[List[str]] = Field([], title='Emails')
    hours: Optional[str] = Field('', title='Hours')
    timezone: Optional[str] = Field('US/Central', title='Timezone')
    status: Optional[StoreStatus] = Field(
        default_factory=lambda: StoreStatus.model_validate('open')
    )
    drop_workflow: Optional[DropWorkflow] = Field(
        default_factory=lambda: DropWorkflow.model_validate('Sticking')
    )
    open_date: Optional[datetime] = Field(None, title='Open Date')
    close_date: Optional[datetime] = Field(None, title='Close Date')
    unavailable_hours: Optional[List[UnavailableHours]] = Field(
        [], title='Unavailable Hours'
    )
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    counterparty_name: Optional[str] = Field(None, title='Counterparty Name')
    in_network_terminals: Optional[List[InNetworkTerminal]] = Field(
        [], title='In Network Terminals'
    )
    in_network_supply_zones: Optional[List[InNetworkSupplyZone]] = Field(
        [], title='In Network Supply Zones'
    )
    supply_owner_id: Optional[str] = Field(None, title='Supply Owner Id')
    supply_owner_name: Optional[str] = Field(None, title='Supply Owner Name')
    freight_customer_id: Optional[str] = Field(None, title='Freight Customer Id')
    freight_customer_name: Optional[str] = Field(None, title='Freight Customer Name')
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')
    layout_file: Optional[str] = Field(None, title='Layout File')
    layout_file_uploaded: Optional[datetime] = Field(None, title='Layout File Uploaded')
    auto_order_disabled: Optional[bool] = Field(False, title='Auto Order Disabled')
    updated_id: Optional[PydanticObjectId] = None
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    monitoring_strategy: Optional[MonitoringStrategy] = Field(
        default_factory=lambda: MonitoringStrategy.model_validate('Unmonitored')
    )
    estick_monitor_override: Optional[str] = Field(
        None, title='Estick Monitor Override'
    )
    notes: Optional[str] = Field(None, title='Notes')
    updated_on: Optional[datetime] = Field(None, title='Updated On')
    updated_by: Optional[str] = Field(None, title='Updated By')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')
    credit_hold: Optional[bool] = Field(None, title='Credit Hold')
    compliance_hold_date: Optional[datetime] = Field(None, title='Compliance Hold Date')
    delivery_window_default_name: Optional[str] = Field(
        None, title='Delivery Window Default Name'
    )
    delivery_window_default_id: Optional[str] = Field(
        None, title='Delivery Window Default Id'
    )
    allow_by_product_request: Optional[bool] = Field(
        False, title='Allow By Product Request'
    )
    geofence: Optional[List[Coordinate]] = Field(None, title='Geofence')


class SupplyPriceUpdateManyRequest(BaseModel):
    id: Optional[str] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    contract: Optional[str] = Field(None, title='Contract')
    timezone: Optional[TimezoneEnum] = Field(
        default_factory=lambda: TimezoneEnum.model_validate('UTC')
    )
    effective_from: datetime = Field(..., title='Effective From')
    effective_to: datetime = Field(..., title='Effective To')
    price: float = Field(..., title='Price')
    price_type: PriceType
    terminal_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Terminal Id'
    )
    terminal_source_id: Optional[str] = Field(None, title='Terminal Source Id')
    terminal_source_system_id: Optional[str] = Field(
        None, title='Terminal Source System Id'
    )
    terminal: Optional[str] = Field(None, title='Terminal')
    product_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Product Id'
    )
    product_source_id: Optional[str] = Field(None, title='Product Source Id')
    product_source_system_id: Optional[str] = Field(
        None, title='Product Source System Id'
    )
    product: Optional[str] = Field(None, title='Product')
    supplier_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Supplier Id'
    )
    supplier_source_id: Optional[str] = Field(None, title='Supplier Source Id')
    supplier_source_system_id: Optional[str] = Field(
        None, title='Supplier Source System Id'
    )
    supplier: Optional[str] = Field(None, title='Supplier')
    counterparty_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Counterparty Id'
    )
    counterparty_source_id: Optional[str] = Field(None, title='Counterparty Source Id')
    counterparty_source_system_id: Optional[str] = Field(
        None, title='Counterparty Source System Id'
    )
    counterparty: Optional[str] = Field(None, title='Counterparty')
    store_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Store Id'
    )
    store_source_id: Optional[str] = Field(None, title='Store Source Id')
    store_source_system_id: Optional[str] = Field(None, title='Store Source System Id')
    store_number: Optional[str] = Field(None, title='Store Number')
    enabled: Optional[bool] = Field(True, title='Enabled')
    disabled_until: Optional[datetime] = Field(None, title='Disabled Until')
    expire: Optional[datetime] = Field(None, title='Expire')
    min_quantity: Optional[int] = Field(None, title='Min Quantity')
    max_quantity: Optional[int] = Field(None, title='Max Quantity')
    curve_id: Optional[str] = Field(None, title='Curve Id')
    error: Optional[str] = Field(None, title='Error')
    row: Optional[int] = Field(None, title='Row')
    net_or_gross_type: Optional[BillableVolumeType] = None
    contract_lifting_valuation_method: Optional[BillableDateType] = None


class SurchargeAllReq(BaseModel):
    counterparty_name: Optional[str] = Field(None, title='Counterparty Name')
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    book_type: Optional[RateBookType] = None
    as_of: Optional[datetime] = Field(None, title='As Of')
    product_group: Optional[ProductGroups] = None
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')


class SurchargeAllResp(BaseModel):
    id: PydanticObjectId
    counterparty: str = Field(..., title='Counterparty')
    counterparty_id: str = Field(..., title='Counterparty Id')
    product_group: Optional[ProductGroups] = None
    book_type: RateBookType
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    type: SurchargeType
    effective_from: Optional[datetime] = Field(None, title='Effective From')
    effective_to: Optional[datetime] = Field(None, title='Effective To')
    surcharge: Optional[float] = Field(None, title='Surcharge')
    created_on: datetime = Field(..., title='Created On')
    created_by: Optional[str] = Field(None, title='Created By')


class SurchargeCreateReq(BaseModel):
    counterparty_name: Optional[str] = Field(None, title='Counterparty Name')
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    product_group: Optional[ProductGroups] = None
    book_type: RateBookType
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    type: SurchargeType
    effective_from: datetime = Field(..., title='Effective From')
    effective_to: Optional[datetime] = Field(None, title='Effective To')
    surcharge: Optional[float] = Field(None, title='Surcharge')


class UpdateResponse(BaseModel):
    created: Optional[int] = Field(0, title='Created')
    end_dated: Optional[int] = Field(0, title='End Dated')
    bad_data: List[SupplyPriceUpdateResponse] = Field(..., title='Bad Data')
    duplicates: List[SupplyPriceUpdateResponse] = Field(..., title='Duplicates')
    exact_match: List[SupplyPriceUpdateResponse] = Field(..., title='Exact Match')


class UploadIMSRequest(BaseModel):
    store: str = Field(..., title='Store')
    tank: Union[str, int] = Field(..., title='Tank')
    timezone: Optional[TimezoneEnum] = None
    date: datetime = Field(..., title='Date')
    inches: Optional[int] = Field(None, title='Inches')
    volume: Optional[float] = Field(None, title='Volume')
    payload: Optional[Dict[str, Any]] = Field(None, title='Payload')


class UpsertLocationRequest(BaseModel):
    id: Optional[constr(min_length=24, max_length=24)] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    name: str = Field(..., title='Name')
    short_name: str = Field(..., title='Short Name')
    address: Optional[str] = Field(None, title='Address')
    type: TerminalType
    city: Optional[str] = Field(None, title='City')
    state: Optional[str] = Field(None, title='State')
    postal_code: Optional[str] = Field(None, title='Postal Code')
    market_id: Optional[str] = Field(None, title='Market Id')
    market: str = Field(..., title='Market')
    lat: float = Field(..., title='Lat')
    lon: float = Field(..., title='Lon')
    hours: Optional[str] = Field(None, title='Hours')
    contact: Optional[str] = Field(None, title='Contact')
    contact_phone: Optional[str] = Field(None, title='Contact Phone')
    active: Optional[bool] = Field(True, title='Active')
    include_in_backhaul: Optional[bool] = Field(False, title='Include In Backhaul')
    start_time: Optional[datetime] = Field(None, title='Start Time')
    end_time: Optional[datetime] = Field(None, title='End Time')
    requires_card: Optional[bool] = Field(False, title='Requires Card')
    splash_blending: Optional[bool] = Field(True, title='Splash Blending')
    split_load_terminals: Optional[List[str]] = Field([], title='Split Load Terminals')
    authorized_carriers: Optional[List[str]] = Field([], title='Authorized Carriers')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    geofence: Optional[List[Union[Coordinate, List, str]]] = Field(
        None, title='Geofence'
    )
    supply_zones: Optional[List[str]] = Field([], title='Supply Zones')
    supply_map: Optional[List[SourceMap]] = Field(None, title='Supply Map')


class UpsertManyCounterpartyRequest(BaseModel):
    id: Optional[constr(min_length=24, max_length=24)] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    name: str = Field(..., title='Name')
    types: List[str] = Field(..., title='Types')
    carrier_type: Optional[str] = Field(None, title='Carrier Type')
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    emails: Optional[List[EmailStr]] = Field([], title='Emails')
    sourcing_strategy: Optional[SourcingStrategy] = None
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    goid: Optional[str] = Field(None, title='Goid')
    allow_short_loads: Optional[bool] = Field(False, title='Allow Short Loads')
    order_notification_preferences: Optional[List[OrderReqNotificationStates]] = Field(
        [], title='Order Notification Preferences'
    )
    supply_map: Optional[List[SourceMap]] = Field(None, title='Supply Map')
    available_credit: Optional[float] = Field(None, title='Available Credit')
    hold: Optional[bool] = Field(False, title='Hold')


class UpsertManyDriverRequest(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    id: Optional[constr(min_length=24, max_length=24)] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    name: str = Field(..., title='Name')
    username: str = Field(..., title='Username')
    email: Optional[EmailStr] = Field(None, title='Email')
    title: Optional[str] = Field(None, title='Title')
    hire_date: datetime = Field(..., title='Hire Date')
    termination_date: Optional[datetime] = Field(None, title='Termination Date')
    depot: Optional[str] = Field(None, title='Depot')
    depot_id: Optional[str] = Field(None, title='Depot Id')
    in_cab_trip_mode: Optional[InCabTripMode] = None
    in_cab_supply_option_mode: Optional[InCabSupplyOptionMode] = None
    preferred_template: Optional[str] = Field(None, title='Preferred Template')
    shift_preference: Shift
    shift_length_hours: Optional[float] = Field(None, title='Shift Length Hours')
    tractor_number: Optional[str] = Field(None, title='Tractor Number')
    tractor_id: Optional[str] = Field(None, title='Tractor Id')
    trailer_number: Optional[str] = Field(None, title='Trailer Number')
    trailer_id: Optional[str] = Field(None, title='Trailer Id')
    carded_terminals: Optional[List[str]] = Field(None, title='Carded Terminals')
    supervisor: Optional[str] = Field(None, title='Supervisor')
    active: Optional[bool] = Field(True, title='Active')


class UpsertManyStoreRequest(BaseModel):
    id: Optional[constr(min_length=24, max_length=24)] = Field(None, title='Id')
    store_number: str = Field(..., title='Store Number')
    name: Optional[str] = Field(None, title='Name')
    address: Optional[str] = Field(None, title='Address')
    city: Optional[str] = Field(None, title='City')
    state: Optional[str] = Field(None, title='State')
    postal_code: Optional[str] = Field(None, title='Postal Code')
    phone_number: Optional[str] = Field(None, title='Phone Number')
    emails: Optional[List[str]] = Field(None, title='Emails')
    hours: Optional[str] = Field(None, title='Hours')
    market: Optional[str] = Field(None, title='Market')
    market_id: Optional[str] = Field(None, title='Market Id')
    sector: Optional[str] = Field(None, title='Sector')
    sector_id: Optional[str] = Field(None, title='Sector Id')
    trailer_config: Optional[str] = Field(None, title='Trailer Config')
    lat: float = Field(..., title='Lat')
    lon: float = Field(..., title='Lon')
    timezone: Optional[TimezoneEnum] = Field(
        default_factory=lambda: TimezoneEnum.model_validate('America/Chicago')
    )
    status: Optional[StoreStatus] = Field(
        default_factory=lambda: StoreStatus.model_validate('open')
    )
    contact_name: Optional[str] = Field(None, title='Contact Name')
    open_date: Optional[datetime] = Field(None, title='Open Date')
    close_date: Optional[datetime] = Field(None, title='Close Date')
    unavailable_hours: Optional[List[UnavailableHoursRequest]] = Field(
        [], title='Unavailable Hours'
    )
    counterparty_id: Optional[str] = Field(None, title='Counterparty Id')
    counterparty_name: Optional[str] = Field(None, title='Counterparty Name')
    supply_owner_id: Optional[str] = Field(None, title='Supply Owner Id')
    supply_owner_name: Optional[str] = Field(None, title='Supply Owner Name')
    freight_customer_id: Optional[str] = Field(None, title='Freight Customer Id')
    freight_customer_name: Optional[str] = Field(None, title='Freight Customer Name')
    freight_region_name: Optional[str] = Field(None, title='Freight Region Name')
    freight_region_id: Optional[str] = Field(None, title='Freight Region Id')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    monitoring_strategy: MonitoringStrategy
    estick_monitor_override: Optional[str] = Field(
        None, title='Estick Monitor Override'
    )
    drop_workflow: Optional[DropWorkflow] = Field(
        default_factory=lambda: DropWorkflow.model_validate('Sticking')
    )
    credit_hold: Optional[bool] = Field(None, title='Credit Hold')
    compliance_hold_date: Optional[datetime] = Field(None, title='Compliance Hold Date')
    allow_by_product_request: Optional[bool] = Field(
        None, title='Allow By Product Request'
    )
    in_network_terminals: Optional[List[str]] = Field(
        None, title='In Network Terminals'
    )
    delivery_window_default_name: Optional[str] = Field(
        None, title='Delivery Window Default Name'
    )
    delivery_window_default_id: Optional[str] = Field(
        None, title='Delivery Window Default Id'
    )
    geofence: Optional[List[Union[Coordinate, List, str]]] = Field(
        None, title='Geofence'
    )


class UpsertProductRequest(BaseModel):
    group: str = Field(..., title='Group')
    weight_group: Optional[str] = Field(None, title='Weight Group')
    extra_data: Optional[Dict[str, Any]] = Field(None, title='Extra Data')
    id: Optional[constr(min_length=24, max_length=24)] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    name: str = Field(..., title='Name')
    alias: Optional[str] = Field(None, title='Alias')
    enabled: Optional[bool] = Field(None, title='Enabled')
    specific_gravity: Optional[float] = Field(None, title='Specific Gravity')
    short_name: Optional[constr(max_length=10)] = Field(None, title='Short Name')
    icon: Optional[TankLidEnum] = None
    tank_lid_code_id: Optional[str] = Field(None, title='Tank Lid Code Id')
    supply_map: Optional[List[SourceMap]] = Field(None, title='Supply Map')


class UpsertTankRequest(BaseModel):
    id: Optional[str] = Field(None, title='Id')
    source_id: Optional[str] = Field(None, title='Source Id')
    source_system_id: Optional[str] = Field(None, title='Source System Id')
    store_id: Optional[constr(min_length=24, max_length=24)] = Field(
        None, title='Store Id'
    )
    tank_id: conint(gt=-1) = Field(..., title='Tank Id')
    island: Optional[str] = Field(None, title='Island')
    icon: Optional[TankLidEnum] = None
    product_id: Optional[str] = Field(None, title='Product Id')
    product: str = Field(..., title='Product')
    description: Optional[constr(max_length=1000)] = Field(None, title='Description')
    tank_chart: Optional[str] = Field(None, title='Tank Chart')
    storage_max: Optional[float] = Field(None, title='Storage Max')
    tank_size: Optional[float] = Field(None, title='Tank Size')
    fuel_bottom: Optional[float] = Field(None, title='Fuel Bottom')
    manufacturer: Optional[str] = Field(None, title='Manufacturer')
    dimensions: Optional[str] = Field(None, title='Dimensions')
    tank_color: Optional[str] = Field(None, title='Tank Color')
    minimum_load_size: Optional[int] = Field(None, title='Minimum Load Size')
    maximum_load_size: Optional[int] = Field(None, title='Maximum Load Size')
    strapping_table: Optional[str] = Field(None, title='Strapping Table')
    target_min: Optional[float] = Field(None, title='Target Min')
    target_max: Optional[float] = Field(None, title='Target Max')
    inventory_strategy: Optional[str] = Field(None, title='Inventory Strategy')
    load_tags: Optional[List[str]] = Field([], title='Load Tags')
    filter_tags: Optional[List[str]] = Field([], title='Filter Tags')
    split_me: Optional[bool] = Field(None, title='Split Me')
    water_reading_requirement: Optional[WaterReadingRequirement] = None
    requires_pump: Optional[bool] = Field(None, title='Requires Pump')
    carrier_id: Optional[str] = Field(None, title='Carrier Id')
    carrier: Optional[str] = Field(None, title='Carrier')
    extra_data: Optional[Dict[str, Any]] = Field({}, title='Extra Data')
    active: Optional[bool] = Field(True, title='Active')
    manifold_id: Optional[str] = Field(None, title='Manifold Id')
    apportion_percentage: Optional[float] = Field(None, title='Apportion Percentage')
    compliance_hold: Optional[bool] = Field(None, title='Compliance Hold')
    demand_model_tank_profile: Optional[str] = Field(
        None, title='Demand Model Tank Profile'
    )
    store_number: Optional[str] = Field(None, title='Store Number')
