"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


class Leg(object):
    """Implementation of the 'Leg' model.

    Attributes:
        carrier_code (str): IATA code for the carrier for this leg of the trip.
            Format: English characters only. Restricted string data type that
            indicates a sequence of letters, numbers, and spaces; special characters
            are not included. Optional request field for travel legs.
        flight_number (str): Flight number for this leg of the trip. Restrictions are
            limitations for the ticket based on the type of fare, such as a
            nonrefundable ticket or a 3-day minimum stay. Format: English characters
            only. Optional request field for travel legs.
        originating_airport_code (str): IATA code for the originating airport for
            this leg of the trip. Format: English characters only. Restricted string
            data type that indicates a sequence of letters, numbers, and spaces;
            special characters are not included. Optional request field for travel
            legs.
        mclass (str): IATA code for the class of service for this leg of the trip.
            Format: English characters only. Restricted string data type that
            indicates a sequence of letters, numbers, and spaces; special characters
            are not included. Optional request field for travel legs.
        stopover_indicator (int): Code that indicates whether a stopover is allowed
            on this leg of the trip. Possible values: - `O` (capital letter “O”)
            (default): Stopover allowed - `X` (capital letter “X”): Stopover not
            allowed Format: English characters only. Restricted string data type that
            indicates a sequence of letters, numbers, and spaces; special characters
            are not included. Optional request field for travel legs.
        departure_date (int): Departure date for the first leg of the trip. Format:
            `YYYYMMDD`. Format: English characters only. Optional request field for
            travel legs.
        destination_airport_code (str): IATA code for the destination airport for
            this leg of the trip. Format: English characters only. Restricted string
            data type that indicates a sequence of letters, numbers, and spaces;
            special characters are not included. Optional request field for travel
            legs.
        fare_basis (str): Code for the fare basis for this leg of the trip. The fare
            basis is assigned by the carriers and indicates a particular ticket type,
            such as business class or discounted/nonrefundable. Restricted string
            data type that indicates a sequence of letters, numbers, and spaces;
            special characters are not included. Format: English characters only.
            Optional request field for travel legs.auto_rental_regular_mileage_cost
        depart_tax_amount (str): Amount of departure tax for this leg of the trip.
        conjunction_ticket (str): Ticket that contains additional coupons for this
            leg of the trip on an itinerary that has more than four segments. Format:
            English characters only. Restricted string data type that indicates a
            sequence of letters, numbers, and spaces; special characters are not
            included. Optional request field for travel legs.
        exchange_ticket_number (str): New ticket number that is issued when the
            ticket is exchanged for this leg of the trip. Restrictions are
            limitations for the ticket based on the type of fare, such as a
            nonrefundable ticket or a 3-day minimum stay. Format: English characters
            only. Optional request field for travel legs.
        coupon_number (str): Coupon number. Each leg on the ticket requires a
            separate coupon, and each coupon is identified by the coupon number.
            Format: English characters only. Restricted string data type that
            indicates a sequence of letters, numbers, and spaces; special characters
            are not included. Optional request field for travel legs.
        departure_time (int): Time of departure for this leg of the trip. The format
            is military time and HHMM: If not all zeros, then the hours must be
            `00-23` and the minutes must be `00-59`. Format: English characters only.
            Optional request field for travel legs.
        departure_time_meridian (str): AM or PM for the departure time. Possible
            values: - A: 12:00 midnight to 11:59 a.m. - P: 12:00 noon to 11:59 p.m
            Format: English characters only. Restricted string data type that
            indicates a sequence of letters, numbers, and spaces; special characters
            are not included. Optional request field for travel legs.
        arrival_time (int): Time of arrival for this leg of the trip. The format is
            military time and HHMM: If not all zeros, then the hours must be `00-23`
            and the minutes must be `00-59` Format: English characters only. Optional
            request field for travel legs.
        arrival_time_meridian (str): AM or PM for the arrival time for this leg of
            the trip. Possible values: - `A`: 12:00 midnight to 11:59 a.m. - `P`:
            12:00 noon to 11:59 p.m. Format: English characters only. Restricted
            string data type that indicates a sequence of letters, numbers, and
            spaces; special characters are not included. Optional request field for
            travel legs.
        endorsements_restrictions (str): Notes or notations about endorsements and
            restrictions for this leg of the trip. Endorsements can be notations
            added by the travel agency, including mandatory government-required
            notations such as value added tax. Restrictions are limitations for the
            ticket based on the type of fare, such as a nonrefundable ticket or a
            3-day minimum stay. Format: English characters only. Optional request
            field for travel legs.
        total_fare_amount (str): Total fare for this leg of the trip. Format: English
            characters only. Optional request field for travel legs.
        fee_amount (str): Fee for this leg of the trip, such as an airport fee or
            country fee. Format: English characters only. Optional request field for
            travel legs.
        tax_amount (str): Tax for this leg of the trip. Format: English characters
            only. Optional request field for travel legs.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "carrier_code": "carrierCode",
        "flight_number": "flightNumber",
        "originating_airport_code": "originatingAirportCode",
        "mclass": "class",
        "stopover_indicator": "stopoverIndicator",
        "departure_date": "departureDate",
        "destination_airport_code": "destinationAirportCode",
        "fare_basis": "fareBasis",
        "depart_tax_amount": "departTaxAmount",
        "conjunction_ticket": "conjunctionTicket",
        "exchange_ticket_number": "exchangeTicketNumber",
        "coupon_number": "couponNumber",
        "departure_time": "departureTime",
        "departure_time_meridian": "departureTimeMeridian",
        "arrival_time": "arrivalTime",
        "arrival_time_meridian": "arrivalTimeMeridian",
        "endorsements_restrictions": "endorsementsRestrictions",
        "total_fare_amount": "totalFareAmount",
        "fee_amount": "feeAmount",
        "tax_amount": "taxAmount",
    }

    _optionals = [
        "carrier_code",
        "flight_number",
        "originating_airport_code",
        "mclass",
        "stopover_indicator",
        "departure_date",
        "destination_airport_code",
        "fare_basis",
        "depart_tax_amount",
        "conjunction_ticket",
        "exchange_ticket_number",
        "coupon_number",
        "departure_time",
        "departure_time_meridian",
        "arrival_time",
        "arrival_time_meridian",
        "endorsements_restrictions",
        "total_fare_amount",
        "fee_amount",
        "tax_amount",
    ]

    def __init__(
        self,
        carrier_code=APIHelper.SKIP,
        flight_number=APIHelper.SKIP,
        originating_airport_code=APIHelper.SKIP,
        mclass=APIHelper.SKIP,
        stopover_indicator=APIHelper.SKIP,
        departure_date=APIHelper.SKIP,
        destination_airport_code=APIHelper.SKIP,
        fare_basis=APIHelper.SKIP,
        depart_tax_amount=APIHelper.SKIP,
        conjunction_ticket=APIHelper.SKIP,
        exchange_ticket_number=APIHelper.SKIP,
        coupon_number=APIHelper.SKIP,
        departure_time=APIHelper.SKIP,
        departure_time_meridian=APIHelper.SKIP,
        arrival_time=APIHelper.SKIP,
        arrival_time_meridian=APIHelper.SKIP,
        endorsements_restrictions=APIHelper.SKIP,
        total_fare_amount=APIHelper.SKIP,
        fee_amount=APIHelper.SKIP,
        tax_amount=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a Leg instance."""
        # Initialize members of the class
        if carrier_code is not APIHelper.SKIP:
            self.carrier_code = carrier_code
        if flight_number is not APIHelper.SKIP:
            self.flight_number = flight_number
        if originating_airport_code is not APIHelper.SKIP:
            self.originating_airport_code = originating_airport_code
        if mclass is not APIHelper.SKIP:
            self.mclass = mclass
        if stopover_indicator is not APIHelper.SKIP:
            self.stopover_indicator = stopover_indicator
        if departure_date is not APIHelper.SKIP:
            self.departure_date = departure_date
        if destination_airport_code is not APIHelper.SKIP:
            self.destination_airport_code = destination_airport_code
        if fare_basis is not APIHelper.SKIP:
            self.fare_basis = fare_basis
        if depart_tax_amount is not APIHelper.SKIP:
            self.depart_tax_amount = depart_tax_amount
        if conjunction_ticket is not APIHelper.SKIP:
            self.conjunction_ticket = conjunction_ticket
        if exchange_ticket_number is not APIHelper.SKIP:
            self.exchange_ticket_number = exchange_ticket_number
        if coupon_number is not APIHelper.SKIP:
            self.coupon_number = coupon_number
        if departure_time is not APIHelper.SKIP:
            self.departure_time = departure_time
        if departure_time_meridian is not APIHelper.SKIP:
            self.departure_time_meridian = departure_time_meridian
        if arrival_time is not APIHelper.SKIP:
            self.arrival_time = arrival_time
        if arrival_time_meridian is not APIHelper.SKIP:
            self.arrival_time_meridian = arrival_time_meridian
        if endorsements_restrictions is not APIHelper.SKIP:
            self.endorsements_restrictions = endorsements_restrictions
        if total_fare_amount is not APIHelper.SKIP:
            self.total_fare_amount = total_fare_amount
        if fee_amount is not APIHelper.SKIP:
            self.fee_amount = fee_amount
        if tax_amount is not APIHelper.SKIP:
            self.tax_amount = tax_amount

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        carrier_code =\
            dictionary.get("carrierCode")\
            if dictionary.get("carrierCode")\
                else APIHelper.SKIP
        flight_number =\
            dictionary.get("flightNumber")\
            if dictionary.get("flightNumber")\
                else APIHelper.SKIP
        originating_airport_code =\
            dictionary.get("originatingAirportCode")\
            if dictionary.get("originatingAirportCode")\
                else APIHelper.SKIP
        mclass =\
            dictionary.get("class")\
            if dictionary.get("class")\
                else APIHelper.SKIP
        stopover_indicator =\
            dictionary.get("stopoverIndicator")\
            if dictionary.get("stopoverIndicator")\
                else APIHelper.SKIP
        departure_date =\
            dictionary.get("departureDate")\
            if dictionary.get("departureDate")\
                else APIHelper.SKIP
        destination_airport_code =\
            dictionary.get("destinationAirportCode")\
            if dictionary.get("destinationAirportCode")\
                else APIHelper.SKIP
        fare_basis =\
            dictionary.get("fareBasis")\
            if dictionary.get("fareBasis")\
                else APIHelper.SKIP
        depart_tax_amount =\
            dictionary.get("departTaxAmount")\
            if dictionary.get("departTaxAmount")\
                else APIHelper.SKIP
        conjunction_ticket =\
            dictionary.get("conjunctionTicket")\
            if dictionary.get("conjunctionTicket")\
                else APIHelper.SKIP
        exchange_ticket_number =\
            dictionary.get("exchangeTicketNumber")\
            if dictionary.get("exchangeTicketNumber")\
                else APIHelper.SKIP
        coupon_number =\
            dictionary.get("couponNumber")\
            if dictionary.get("couponNumber")\
                else APIHelper.SKIP
        departure_time =\
            dictionary.get("departureTime")\
            if dictionary.get("departureTime")\
                else APIHelper.SKIP
        departure_time_meridian =\
            dictionary.get("departureTimeMeridian")\
            if dictionary.get("departureTimeMeridian")\
                else APIHelper.SKIP
        arrival_time =\
            dictionary.get("arrivalTime")\
            if dictionary.get("arrivalTime")\
                else APIHelper.SKIP
        arrival_time_meridian =\
            dictionary.get("arrivalTimeMeridian")\
            if dictionary.get("arrivalTimeMeridian")\
                else APIHelper.SKIP
        endorsements_restrictions =\
            dictionary.get("endorsementsRestrictions")\
            if dictionary.get("endorsementsRestrictions")\
                else APIHelper.SKIP
        total_fare_amount =\
            dictionary.get("totalFareAmount")\
            if dictionary.get("totalFareAmount")\
                else APIHelper.SKIP
        fee_amount =\
            dictionary.get("feeAmount")\
            if dictionary.get("feeAmount")\
                else APIHelper.SKIP
        tax_amount =\
            dictionary.get("taxAmount")\
            if dictionary.get("taxAmount")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(carrier_code,
                   flight_number,
                   originating_airport_code,
                   mclass,
                   stopover_indicator,
                   departure_date,
                   destination_airport_code,
                   fare_basis,
                   depart_tax_amount,
                   conjunction_ticket,
                   exchange_ticket_number,
                   coupon_number,
                   departure_time,
                   departure_time_meridian,
                   arrival_time,
                   arrival_time_meridian,
                   endorsements_restrictions,
                   total_fare_amount,
                   fee_amount,
                   tax_amount,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _carrier_code=(
            self.carrier_code
            if hasattr(self, "carrier_code")
            else None
        )
        _flight_number=(
            self.flight_number
            if hasattr(self, "flight_number")
            else None
        )
        _originating_airport_code=(
            self.originating_airport_code
            if hasattr(self, "originating_airport_code")
            else None
        )
        _mclass=(
            self.mclass
            if hasattr(self, "mclass")
            else None
        )
        _stopover_indicator=(
            self.stopover_indicator
            if hasattr(self, "stopover_indicator")
            else None
        )
        _departure_date=(
            self.departure_date
            if hasattr(self, "departure_date")
            else None
        )
        _destination_airport_code=(
            self.destination_airport_code
            if hasattr(self, "destination_airport_code")
            else None
        )
        _fare_basis=(
            self.fare_basis
            if hasattr(self, "fare_basis")
            else None
        )
        _depart_tax_amount=(
            self.depart_tax_amount
            if hasattr(self, "depart_tax_amount")
            else None
        )
        _conjunction_ticket=(
            self.conjunction_ticket
            if hasattr(self, "conjunction_ticket")
            else None
        )
        _exchange_ticket_number=(
            self.exchange_ticket_number
            if hasattr(self, "exchange_ticket_number")
            else None
        )
        _coupon_number=(
            self.coupon_number
            if hasattr(self, "coupon_number")
            else None
        )
        _departure_time=(
            self.departure_time
            if hasattr(self, "departure_time")
            else None
        )
        _departure_time_meridian=(
            self.departure_time_meridian
            if hasattr(self, "departure_time_meridian")
            else None
        )
        _arrival_time=(
            self.arrival_time
            if hasattr(self, "arrival_time")
            else None
        )
        _arrival_time_meridian=(
            self.arrival_time_meridian
            if hasattr(self, "arrival_time_meridian")
            else None
        )
        _endorsements_restrictions=(
            self.endorsements_restrictions
            if hasattr(self, "endorsements_restrictions")
            else None
        )
        _total_fare_amount=(
            self.total_fare_amount
            if hasattr(self, "total_fare_amount")
            else None
        )
        _fee_amount=(
            self.fee_amount
            if hasattr(self, "fee_amount")
            else None
        )
        _tax_amount=(
            self.tax_amount
            if hasattr(self, "tax_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"carrier_code={_carrier_code!r}, "
            f"flight_number={_flight_number!r}, "
            f"originating_airport_code={_originating_airport_code!r}, "
            f"mclass={_mclass!r}, "
            f"stopover_indicator={_stopover_indicator!r}, "
            f"departure_date={_departure_date!r}, "
            f"destination_airport_code={_destination_airport_code!r}, "
            f"fare_basis={_fare_basis!r}, "
            f"depart_tax_amount={_depart_tax_amount!r}, "
            f"conjunction_ticket={_conjunction_ticket!r}, "
            f"exchange_ticket_number={_exchange_ticket_number!r}, "
            f"coupon_number={_coupon_number!r}, "
            f"departure_time={_departure_time!r}, "
            f"departure_time_meridian={_departure_time_meridian!r}, "
            f"arrival_time={_arrival_time!r}, "
            f"arrival_time_meridian={_arrival_time_meridian!r}, "
            f"endorsements_restrictions={_endorsements_restrictions!r}, "
            f"total_fare_amount={_total_fare_amount!r}, "
            f"fee_amount={_fee_amount!r}, "
            f"tax_amount={_tax_amount!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _carrier_code=(
            self.carrier_code
            if hasattr(self, "carrier_code")
            else None
        )
        _flight_number=(
            self.flight_number
            if hasattr(self, "flight_number")
            else None
        )
        _originating_airport_code=(
            self.originating_airport_code
            if hasattr(self, "originating_airport_code")
            else None
        )
        _mclass=(
            self.mclass
            if hasattr(self, "mclass")
            else None
        )
        _stopover_indicator=(
            self.stopover_indicator
            if hasattr(self, "stopover_indicator")
            else None
        )
        _departure_date=(
            self.departure_date
            if hasattr(self, "departure_date")
            else None
        )
        _destination_airport_code=(
            self.destination_airport_code
            if hasattr(self, "destination_airport_code")
            else None
        )
        _fare_basis=(
            self.fare_basis
            if hasattr(self, "fare_basis")
            else None
        )
        _depart_tax_amount=(
            self.depart_tax_amount
            if hasattr(self, "depart_tax_amount")
            else None
        )
        _conjunction_ticket=(
            self.conjunction_ticket
            if hasattr(self, "conjunction_ticket")
            else None
        )
        _exchange_ticket_number=(
            self.exchange_ticket_number
            if hasattr(self, "exchange_ticket_number")
            else None
        )
        _coupon_number=(
            self.coupon_number
            if hasattr(self, "coupon_number")
            else None
        )
        _departure_time=(
            self.departure_time
            if hasattr(self, "departure_time")
            else None
        )
        _departure_time_meridian=(
            self.departure_time_meridian
            if hasattr(self, "departure_time_meridian")
            else None
        )
        _arrival_time=(
            self.arrival_time
            if hasattr(self, "arrival_time")
            else None
        )
        _arrival_time_meridian=(
            self.arrival_time_meridian
            if hasattr(self, "arrival_time_meridian")
            else None
        )
        _endorsements_restrictions=(
            self.endorsements_restrictions
            if hasattr(self, "endorsements_restrictions")
            else None
        )
        _total_fare_amount=(
            self.total_fare_amount
            if hasattr(self, "total_fare_amount")
            else None
        )
        _fee_amount=(
            self.fee_amount
            if hasattr(self, "fee_amount")
            else None
        )
        _tax_amount=(
            self.tax_amount
            if hasattr(self, "tax_amount")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"carrier_code={_carrier_code!s}, "
            f"flight_number={_flight_number!s}, "
            f"originating_airport_code={_originating_airport_code!s}, "
            f"mclass={_mclass!s}, "
            f"stopover_indicator={_stopover_indicator!s}, "
            f"departure_date={_departure_date!s}, "
            f"destination_airport_code={_destination_airport_code!s}, "
            f"fare_basis={_fare_basis!s}, "
            f"depart_tax_amount={_depart_tax_amount!s}, "
            f"conjunction_ticket={_conjunction_ticket!s}, "
            f"exchange_ticket_number={_exchange_ticket_number!s}, "
            f"coupon_number={_coupon_number!s}, "
            f"departure_time={_departure_time!s}, "
            f"departure_time_meridian={_departure_time_meridian!s}, "
            f"arrival_time={_arrival_time!s}, "
            f"arrival_time_meridian={_arrival_time_meridian!s}, "
            f"endorsements_restrictions={_endorsements_restrictions!s}, "
            f"total_fare_amount={_total_fare_amount!s}, "
            f"fee_amount={_fee_amount!s}, "
            f"tax_amount={_tax_amount!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
