"""cellpointapi.

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

# ruff: noqa: E501

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

    Segment of the journey.
    Given an the following `ItineraryType`, here are the example JourneySegment to
    use:
    <table>
    <thead>
      <tr>
        <th>Itinerary Type</th>
        <th>Journey Segment</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>ONE_WAY</td>
        <td>OUTBOUND</td>
        <td>Single Journey</td>
      </tr>
      <tr>
        <td>ROUND_TRIP</td>
        <td>OUTBOUND</td>
        <td>First Journey, leaving.</td>
      </tr>
      <tr>
        <td>ROUND_TRIP</td>
        <td>INBOUND</td>
        <td>Second Journey, returning.</td>
      </tr>
      <tr>
        <td>MULTI_CITY</td>
        <td>MULTI_CITY_1</td>
        <td>First Journey </td>
      </tr>
      <tr>
        <td>MULTI_CITY</td>
        <td>MULTI_CITY_2</td>
        <td>Second Journey </td>
      </tr>
      <tr>
        <td>MULTI_CITY</td>
        <td>MULTI_CITY_3</td>
        <td>Third Journey </td>
      </tr>
    </tbody>
    </table>

    Attributes:
        OUTBOUND: The enum member of type str.
        INBOUND: The enum member of type str.
        MULTI_CITY_1: The enum member of type str.
        MULTI_CITY_2: The enum member of type str.
        MULTI_CITY_3: The enum member of type str.
        MULTI_CITY_4: The enum member of type str.
        MULTI_CITY_5: The enum member of type str.
        MULTI_CITY_6: The enum member of type str.
        MULTI_CITY_7: The enum member of type str.
        MULTI_CITY_8: The enum member of type str.
        MULTI_CITY_9: The enum member of type str.

    """

    _all_values = ["OUTBOUND", "INBOUND", "MULTI_CITY_1", "MULTI_CITY_2",
        "MULTI_CITY_3", "MULTI_CITY_4", "MULTI_CITY_5", "MULTI_CITY_6",
        "MULTI_CITY_7", "MULTI_CITY_8", "MULTI_CITY_9"]
    OUTBOUND = "OUTBOUND"

    INBOUND = "INBOUND"

    MULTI_CITY_1 = "MULTI_CITY_1"

    MULTI_CITY_2 = "MULTI_CITY_2"

    MULTI_CITY_3 = "MULTI_CITY_3"

    MULTI_CITY_4 = "MULTI_CITY_4"

    MULTI_CITY_5 = "MULTI_CITY_5"

    MULTI_CITY_6 = "MULTI_CITY_6"

    MULTI_CITY_7 = "MULTI_CITY_7"

    MULTI_CITY_8 = "MULTI_CITY_8"

    MULTI_CITY_9 = "MULTI_CITY_9"

    @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
