# This file was generated by liblab | https://liblab.com/

from __future__ import annotations
from typing import List
from .utils.json_map import JsonMap
from .base import BaseModel
from .negotiated_rate_charges_itemized_charges import (
    NegotiatedRateChargesItemizedCharges,
)
from .negotiated_rate_charges_tax_charges import NegotiatedRateChargesTaxCharges
from .negotiated_rate_charges_total_charge import NegotiatedRateChargesTotalCharge
from .negotiated_rate_charges_total_charges_with_taxes import (
    NegotiatedRateChargesTotalChargesWithTaxes,
)


@JsonMap(
    {
        "itemized_charges": "ItemizedCharges",
        "tax_charges": "TaxCharges",
        "total_charge": "TotalCharge",
        "total_charges_with_taxes": "TotalChargesWithTaxes",
    }
)
class RatedShipmentNegotiatedRateCharges(BaseModel):
    """Negotiated Rate Charges Container.  For tiered rates and promotional discounts, if a particular shipment based on zone, origin, destination or even shipment size doesn't qualify for the existing discount then no negotiated rates container will be returned. Published rates will be the applicable rate.

    :param itemized_charges: Itemized Charges are returned only when the subversion element is present and greater than or equal to '1601'.  These charges would be returned only when subversion is greater than or equal to 1601. **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. , defaults to None
    :type itemized_charges: List[NegotiatedRateChargesItemizedCharges], optional
    :param tax_charges: TaxCharges container are returned only when TaxInformationIndicator is present in request. TaxCharges container contains Tax information for a given shipment. **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. , defaults to None
    :type tax_charges: List[NegotiatedRateChargesTaxCharges], optional
    :param total_charge: Total Charges Container.
    :type total_charge: NegotiatedRateChargesTotalCharge
    :param total_charges_with_taxes: TotalChargesWithTaxes container would be returned only if TaxInformationIndicator is present in request. TotalChargesWithTaxes contains total charges including total taxes applied to a shipment., defaults to None
    :type total_charges_with_taxes: NegotiatedRateChargesTotalChargesWithTaxes, optional
    """

    def __init__(
        self,
        total_charge: NegotiatedRateChargesTotalCharge,
        itemized_charges: List[NegotiatedRateChargesItemizedCharges] = None,
        tax_charges: List[NegotiatedRateChargesTaxCharges] = None,
        total_charges_with_taxes: NegotiatedRateChargesTotalChargesWithTaxes = None,
    ):
        if itemized_charges is not None:
            self.itemized_charges = self._define_list(
                itemized_charges, NegotiatedRateChargesItemizedCharges
            )
        if tax_charges is not None:
            self.tax_charges = self._define_list(
                tax_charges, NegotiatedRateChargesTaxCharges
            )
        self.total_charge = self._define_object(
            total_charge, NegotiatedRateChargesTotalCharge
        )
        if total_charges_with_taxes is not None:
            self.total_charges_with_taxes = self._define_object(
                total_charges_with_taxes, NegotiatedRateChargesTotalChargesWithTaxes
            )
