# -*- coding: utf-8 -*-

"""
    easybimehlanding

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

import easybimehlanding.models.zone
import easybimehlanding.models.travel_duration
import easybimehlanding.models.travel_age
import easybimehlanding.models.province
import easybimehlanding.models.shipping_type
import easybimehlanding.models.post_type
import easybimehlanding.models.insurance_data_travel_insurance
import easybimehlanding.models.insurance_policy_condition

class TravelInsurance(object):

    """Implementation of the 'TravelInsurance' model.

    TODO: type model description here.

    Attributes:
        has_plan (bool): TODO: type description here.
        is_saman_insurance (bool): TODO: type description here.
        zones (list of Zone): TODO: type description here.
        travel_durations (list of TravelDuration): TODO: type description
            here.
        travel_ages (list of TravelAge): TODO: type description here.
        provinces (list of Province): TODO: type description here.
        cities (list of string): TODO: type description here.
        city_regions (list of string): TODO: type description here.
        shipping_types (list of ShippingType): TODO: type description here.
        post_types (list of PostType): TODO: type description here.
        insurance_data (InsuranceDataTravelInsurance): TODO: type description
            here.
        insurance_policy_condition (InsurancePolicyCondition): TODO: type
            description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "has_plan":'hasPlan',
        "is_saman_insurance":'isSamanInsurance',
        "zones":'zones',
        "travel_durations":'travelDurations',
        "travel_ages":'travelAges',
        "provinces":'provinces',
        "cities":'cities',
        "city_regions":'cityRegions',
        "shipping_types":'shippingTypes',
        "post_types":'postTypes',
        "insurance_data":'insuranceData',
        "insurance_policy_condition":'insurancePolicyCondition'
    }

    def __init__(self,
                 has_plan=None,
                 is_saman_insurance=None,
                 zones=None,
                 travel_durations=None,
                 travel_ages=None,
                 provinces=None,
                 cities=None,
                 city_regions=None,
                 shipping_types=None,
                 post_types=None,
                 insurance_data=None,
                 insurance_policy_condition=None):
        """Constructor for the TravelInsurance class"""

        # Initialize members of the class
        self.has_plan = has_plan
        self.is_saman_insurance = is_saman_insurance
        self.zones = zones
        self.travel_durations = travel_durations
        self.travel_ages = travel_ages
        self.provinces = provinces
        self.cities = cities
        self.city_regions = city_regions
        self.shipping_types = shipping_types
        self.post_types = post_types
        self.insurance_data = insurance_data
        self.insurance_policy_condition = insurance_policy_condition


    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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 dictionary is None:
            return None

        # Extract variables from the dictionary
        has_plan = dictionary.get('hasPlan')
        is_saman_insurance = dictionary.get('isSamanInsurance')
        zones = None
        if dictionary.get('zones') != None:
            zones = list()
            for structure in dictionary.get('zones'):
                zones.append(easybimehlanding.models.zone.Zone.from_dictionary(structure))
        travel_durations = None
        if dictionary.get('travelDurations') != None:
            travel_durations = list()
            for structure in dictionary.get('travelDurations'):
                travel_durations.append(easybimehlanding.models.travel_duration.TravelDuration.from_dictionary(structure))
        travel_ages = None
        if dictionary.get('travelAges') != None:
            travel_ages = list()
            for structure in dictionary.get('travelAges'):
                travel_ages.append(easybimehlanding.models.travel_age.TravelAge.from_dictionary(structure))
        provinces = None
        if dictionary.get('provinces') != None:
            provinces = list()
            for structure in dictionary.get('provinces'):
                provinces.append(easybimehlanding.models.province.Province.from_dictionary(structure))
        cities = dictionary.get('cities')
        city_regions = dictionary.get('cityRegions')
        shipping_types = None
        if dictionary.get('shippingTypes') != None:
            shipping_types = list()
            for structure in dictionary.get('shippingTypes'):
                shipping_types.append(easybimehlanding.models.shipping_type.ShippingType.from_dictionary(structure))
        post_types = None
        if dictionary.get('postTypes') != None:
            post_types = list()
            for structure in dictionary.get('postTypes'):
                post_types.append(easybimehlanding.models.post_type.PostType.from_dictionary(structure))
        insurance_data = easybimehlanding.models.insurance_data_travel_insurance.InsuranceDataTravelInsurance.from_dictionary(dictionary.get('insuranceData')) if dictionary.get('insuranceData') else None
        insurance_policy_condition = easybimehlanding.models.insurance_policy_condition.InsurancePolicyCondition.from_dictionary(dictionary.get('insurancePolicyCondition')) if dictionary.get('insurancePolicyCondition') else None

        # Return an object of this model
        return cls(has_plan,
                   is_saman_insurance,
                   zones,
                   travel_durations,
                   travel_ages,
                   provinces,
                   cities,
                   city_regions,
                   shipping_types,
                   post_types,
                   insurance_data,
                   insurance_policy_condition)


