"""cellpointapi.

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

# ruff: noqa: E501

class ItineraryType(object):
    """Implementation of the 'ItineraryType' enum.

    Type of itinerary being booked for travel.
    <table>
    <thead>
      <tr>
        <th>Itinerary Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>ONE_WAY</td>
        <td>Only a single journey is being taken, with no return journey booked.</td>
      </tr>
      <tr>
        <td>ROUND_TRIP</td>
        <td>Two journeys are being booked, one outbound and one inbound. Final
    inbound journey will be returning to where the traveler started.</td>
      </tr>
      <tr>
        <td>MULTI_CITY</td>
        <td>Multiple journeys are being booked at once between various cities.</td>
      </tr>
    </tbody>
    </table>

    Attributes:
        ONE_WAY: The enum member of type str.
        ROUND_TRIP: The enum member of type str.
        MULTI_CITY: The enum member of type str.

    """

    _all_values = ["ONE_WAY", "ROUND_TRIP", "MULTI_CITY"]
    ONE_WAY = "ONE_WAY"

    ROUND_TRIP = "ROUND_TRIP"

    MULTI_CITY = "MULTI_CITY"

    @classmethod
    def validate(cls, value):
        """Validate value contains in enum

        Args:
            value: the value to be validated

        Returns:
            boolean : if value is valid enum values.

        """
        return value in cls._all_values

    @classmethod
    def from_value(cls, value, default=None):
        """Return the matching enum value for the given input."""
        if value is None:
            return default

        # If numeric and matches directly
        if isinstance(value, int):
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and val == value:
                    return val

        # If string, perform case-insensitive match
        if isinstance(value, str):
            value_lower = value.lower()
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and (
                    name.lower() == value_lower or str(val).lower() == value_lower
                ):
                    return val

        # Fallback to default
        return default
