# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
"""
This namespace contains the endpoints and data types for working with deliveries.
"""

try:
    from . import stone_validators as bv
    from . import stone_base as bb
except (ImportError, SystemError, ValueError):
    # Catch errors raised when importing a relative module when not in a package.
    # This makes testing this file directly (outside of a package) easier.
    import stone_validators as bv
    import stone_base as bb

class BaseAddress(object):
    """
    Struct with common address fields.

    :ivar firstLine: Human readable text address.
    :ivar secondLine: Address notes.
    :ivar floor: Floor number.
    :ivar apartment: Apartment number.
    :ivar zone: Zone where the address is located.
    :ivar district: District where the address is located.
    """

    __slots__ = [
        '_stone_firstLine_value',
        '_stone_firstLine_present',
        '_stone_secondLine_value',
        '_stone_secondLine_present',
        '_stone_floor_value',
        '_stone_floor_present',
        '_stone_apartment_value',
        '_stone_apartment_present',
        '_stone_zone_value',
        '_stone_zone_present',
        '_stone_district_value',
        '_stone_district_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 firstLine=None,
                 secondLine=None,
                 floor=None,
                 apartment=None,
                 zone=None,
                 district=None):
        self._stone_firstLine_value = None
        self._stone_firstLine_present = False
        self._stone_secondLine_value = None
        self._stone_secondLine_present = False
        self._stone_floor_value = None
        self._stone_floor_present = False
        self._stone_apartment_value = None
        self._stone_apartment_present = False
        self._stone_zone_value = None
        self._stone_zone_present = False
        self._stone_district_value = None
        self._stone_district_present = False
        if firstLine is not None:
            self.firstLine = firstLine
        if secondLine is not None:
            self.secondLine = secondLine
        if floor is not None:
            self.floor = floor
        if apartment is not None:
            self.apartment = apartment
        if zone is not None:
            self.zone = zone
        if district is not None:
            self.district = district

    @property
    def firstLine(self):
        """
        Human readable text address.

        :rtype: str
        """
        if self._stone_firstLine_present:
            return self._stone_firstLine_value
        else:
            raise AttributeError("missing required field 'firstLine'")

    @firstLine.setter
    def firstLine(self, val):
        val = self._stone_firstLine_validator.validate(val)
        self._stone_firstLine_value = val
        self._stone_firstLine_present = True

    @firstLine.deleter
    def firstLine(self):
        self._stone_firstLine_value = None
        self._stone_firstLine_present = False

    @property
    def secondLine(self):
        """
        Address notes.

        :rtype: str
        """
        if self._stone_secondLine_present:
            return self._stone_secondLine_value
        else:
            return None

    @secondLine.setter
    def secondLine(self, val):
        if val is None:
            del self.secondLine
            return
        val = self._stone_secondLine_validator.validate(val)
        self._stone_secondLine_value = val
        self._stone_secondLine_present = True

    @secondLine.deleter
    def secondLine(self):
        self._stone_secondLine_value = None
        self._stone_secondLine_present = False

    @property
    def floor(self):
        """
        Floor number.

        :rtype: long
        """
        if self._stone_floor_present:
            return self._stone_floor_value
        else:
            return None

    @floor.setter
    def floor(self, val):
        if val is None:
            del self.floor
            return
        val = self._stone_floor_validator.validate(val)
        self._stone_floor_value = val
        self._stone_floor_present = True

    @floor.deleter
    def floor(self):
        self._stone_floor_value = None
        self._stone_floor_present = False

    @property
    def apartment(self):
        """
        Apartment number.

        :rtype: long
        """
        if self._stone_apartment_present:
            return self._stone_apartment_value
        else:
            return None

    @apartment.setter
    def apartment(self, val):
        if val is None:
            del self.apartment
            return
        val = self._stone_apartment_validator.validate(val)
        self._stone_apartment_value = val
        self._stone_apartment_present = True

    @apartment.deleter
    def apartment(self):
        self._stone_apartment_value = None
        self._stone_apartment_present = False

    @property
    def zone(self):
        """
        Zone where the address is located.

        :rtype: str
        """
        if self._stone_zone_present:
            return self._stone_zone_value
        else:
            return None

    @zone.setter
    def zone(self, val):
        if val is None:
            del self.zone
            return
        val = self._stone_zone_validator.validate(val)
        self._stone_zone_value = val
        self._stone_zone_present = True

    @zone.deleter
    def zone(self):
        self._stone_zone_value = None
        self._stone_zone_present = False

    @property
    def district(self):
        """
        District where the address is located.

        :rtype: str
        """
        if self._stone_district_present:
            return self._stone_district_value
        else:
            return None

    @district.setter
    def district(self, val):
        if val is None:
            del self.district
            return
        val = self._stone_district_validator.validate(val)
        self._stone_district_value = val
        self._stone_district_present = True

    @district.deleter
    def district(self):
        self._stone_district_value = None
        self._stone_district_present = False

    def __repr__(self):
        return 'BaseAddress(firstLine={!r}, secondLine={!r}, floor={!r}, apartment={!r}, zone={!r}, district={!r})'.format(
            self._stone_firstLine_value,
            self._stone_secondLine_value,
            self._stone_floor_value,
            self._stone_apartment_value,
            self._stone_zone_value,
            self._stone_district_value,
        )

BaseAddress_validator = bv.Struct(BaseAddress)

class Address(BaseAddress):
    """
    Address for requests.

    :ivar geoLocation: Latitude and Longitude.
    :ivar city: City code where the address belongs to.
    """

    __slots__ = [
        '_stone_geoLocation_value',
        '_stone_geoLocation_present',
        '_stone_city_value',
        '_stone_city_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 firstLine=None,
                 city=None,
                 secondLine=None,
                 floor=None,
                 apartment=None,
                 zone=None,
                 district=None,
                 geoLocation=None):
        super(Address, self).__init__(firstLine,
                                      secondLine,
                                      floor,
                                      apartment,
                                      zone,
                                      district)
        self._stone_geoLocation_value = None
        self._stone_geoLocation_present = False
        self._stone_city_value = None
        self._stone_city_present = False
        if geoLocation is not None:
            self.geoLocation = geoLocation
        if city is not None:
            self.city = city

    @property
    def geoLocation(self):
        """
        Latitude and Longitude.

        :rtype: list of [float]
        """
        if self._stone_geoLocation_present:
            return self._stone_geoLocation_value
        else:
            return None

    @geoLocation.setter
    def geoLocation(self, val):
        if val is None:
            del self.geoLocation
            return
        val = self._stone_geoLocation_validator.validate(val)
        self._stone_geoLocation_value = val
        self._stone_geoLocation_present = True

    @geoLocation.deleter
    def geoLocation(self):
        self._stone_geoLocation_value = None
        self._stone_geoLocation_present = False

    @property
    def city(self):
        """
        City code where the address belongs to.

        :rtype: str
        """
        if self._stone_city_present:
            return self._stone_city_value
        else:
            raise AttributeError("missing required field 'city'")

    @city.setter
    def city(self, val):
        val = self._stone_city_validator.validate(val)
        self._stone_city_value = val
        self._stone_city_present = True

    @city.deleter
    def city(self):
        self._stone_city_value = None
        self._stone_city_present = False

    def __repr__(self):
        return 'Address(firstLine={!r}, city={!r}, secondLine={!r}, floor={!r}, apartment={!r}, zone={!r}, district={!r}, geoLocation={!r})'.format(
            self._stone_firstLine_value,
            self._stone_city_value,
            self._stone_secondLine_value,
            self._stone_floor_value,
            self._stone_apartment_value,
            self._stone_zone_value,
            self._stone_district_value,
            self._stone_geoLocation_value,
        )

Address_validator = bv.Struct(Address)

class City(object):
    """
    A city.

    :ivar _id: ID of the city.
    :ivar name: Name of the city.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_name_value',
        '_stone_name_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 name=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_name_value = None
        self._stone_name_present = False
        if _id is not None:
            self._id = _id
        if name is not None:
            self.name = name

    @property
    def _id(self):
        """
        ID of the city.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def name(self):
        """
        Name of the city.

        :rtype: str
        """
        if self._stone_name_present:
            return self._stone_name_value
        else:
            raise AttributeError("missing required field 'name'")

    @name.setter
    def name(self, val):
        val = self._stone_name_validator.validate(val)
        self._stone_name_value = val
        self._stone_name_present = True

    @name.deleter
    def name(self):
        self._stone_name_value = None
        self._stone_name_present = False

    def __repr__(self):
        return 'City(_id={!r}, name={!r})'.format(
            self._stone__id_value,
            self._stone_name_value,
        )

City_validator = bv.Struct(City)

class CreateDeliveryArg(object):
    """
    :ivar receiver: Delivery receiver details object.
    :ivar pickupAddress: Delivery pickup address.
    :ivar dropOffAddress: Delivery destination address.
    :ivar notes: Instructions for the Bosta star or Bosta admins regarding the
        delivery.
    :ivar cod: Cash on delivery amount if required.
    :ivar type: Integer representation of the required service type.
    :ivar isSameDay: Whether or not the delivery should be performed on the same
        day.
    :ivar businessReference: Reference number from the client system.
    :ivar webhookUrl: URL where HTTP POST requests of state updates should be
        sent to.
    """

    __slots__ = [
        '_stone_receiver_value',
        '_stone_receiver_present',
        '_stone_pickupAddress_value',
        '_stone_pickupAddress_present',
        '_stone_dropOffAddress_value',
        '_stone_dropOffAddress_present',
        '_stone_notes_value',
        '_stone_notes_present',
        '_stone_cod_value',
        '_stone_cod_present',
        '_stone_type_value',
        '_stone_type_present',
        '_stone_isSameDay_value',
        '_stone_isSameDay_present',
        '_stone_businessReference_value',
        '_stone_businessReference_present',
        '_stone_webhookUrl_value',
        '_stone_webhookUrl_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 receiver=None,
                 type=None,
                 pickupAddress=None,
                 dropOffAddress=None,
                 notes=None,
                 cod=None,
                 isSameDay=None,
                 businessReference=None,
                 webhookUrl=None):
        self._stone_receiver_value = None
        self._stone_receiver_present = False
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False
        self._stone_notes_value = None
        self._stone_notes_present = False
        self._stone_cod_value = None
        self._stone_cod_present = False
        self._stone_type_value = None
        self._stone_type_present = False
        self._stone_isSameDay_value = None
        self._stone_isSameDay_present = False
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False
        self._stone_webhookUrl_value = None
        self._stone_webhookUrl_present = False
        if receiver is not None:
            self.receiver = receiver
        if pickupAddress is not None:
            self.pickupAddress = pickupAddress
        if dropOffAddress is not None:
            self.dropOffAddress = dropOffAddress
        if notes is not None:
            self.notes = notes
        if cod is not None:
            self.cod = cod
        if type is not None:
            self.type = type
        if isSameDay is not None:
            self.isSameDay = isSameDay
        if businessReference is not None:
            self.businessReference = businessReference
        if webhookUrl is not None:
            self.webhookUrl = webhookUrl

    @property
    def receiver(self):
        """
        Delivery receiver details object.

        :rtype: Receiver
        """
        if self._stone_receiver_present:
            return self._stone_receiver_value
        else:
            raise AttributeError("missing required field 'receiver'")

    @receiver.setter
    def receiver(self, val):
        self._stone_receiver_validator.validate_type_only(val)
        self._stone_receiver_value = val
        self._stone_receiver_present = True

    @receiver.deleter
    def receiver(self):
        self._stone_receiver_value = None
        self._stone_receiver_present = False

    @property
    def pickupAddress(self):
        """
        Delivery pickup address.

        :rtype: Address
        """
        if self._stone_pickupAddress_present:
            return self._stone_pickupAddress_value
        else:
            return None

    @pickupAddress.setter
    def pickupAddress(self, val):
        if val is None:
            del self.pickupAddress
            return
        self._stone_pickupAddress_validator.validate_type_only(val)
        self._stone_pickupAddress_value = val
        self._stone_pickupAddress_present = True

    @pickupAddress.deleter
    def pickupAddress(self):
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False

    @property
    def dropOffAddress(self):
        """
        Delivery destination address.

        :rtype: Address
        """
        if self._stone_dropOffAddress_present:
            return self._stone_dropOffAddress_value
        else:
            return None

    @dropOffAddress.setter
    def dropOffAddress(self, val):
        if val is None:
            del self.dropOffAddress
            return
        self._stone_dropOffAddress_validator.validate_type_only(val)
        self._stone_dropOffAddress_value = val
        self._stone_dropOffAddress_present = True

    @dropOffAddress.deleter
    def dropOffAddress(self):
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False

    @property
    def notes(self):
        """
        Instructions for the Bosta star or Bosta admins regarding the delivery.

        :rtype: str
        """
        if self._stone_notes_present:
            return self._stone_notes_value
        else:
            return None

    @notes.setter
    def notes(self, val):
        if val is None:
            del self.notes
            return
        val = self._stone_notes_validator.validate(val)
        self._stone_notes_value = val
        self._stone_notes_present = True

    @notes.deleter
    def notes(self):
        self._stone_notes_value = None
        self._stone_notes_present = False

    @property
    def cod(self):
        """
        Cash on delivery amount if required.

        :rtype: float
        """
        if self._stone_cod_present:
            return self._stone_cod_value
        else:
            return None

    @cod.setter
    def cod(self, val):
        if val is None:
            del self.cod
            return
        val = self._stone_cod_validator.validate(val)
        self._stone_cod_value = val
        self._stone_cod_present = True

    @cod.deleter
    def cod(self):
        self._stone_cod_value = None
        self._stone_cod_present = False

    @property
    def type(self):
        """
        Integer representation of the required service type.

        :rtype: long
        """
        if self._stone_type_present:
            return self._stone_type_value
        else:
            raise AttributeError("missing required field 'type'")

    @type.setter
    def type(self, val):
        val = self._stone_type_validator.validate(val)
        self._stone_type_value = val
        self._stone_type_present = True

    @type.deleter
    def type(self):
        self._stone_type_value = None
        self._stone_type_present = False

    @property
    def isSameDay(self):
        """
        Whether or not the delivery should be performed on the same day.

        :rtype: bool
        """
        if self._stone_isSameDay_present:
            return self._stone_isSameDay_value
        else:
            return None

    @isSameDay.setter
    def isSameDay(self, val):
        if val is None:
            del self.isSameDay
            return
        val = self._stone_isSameDay_validator.validate(val)
        self._stone_isSameDay_value = val
        self._stone_isSameDay_present = True

    @isSameDay.deleter
    def isSameDay(self):
        self._stone_isSameDay_value = None
        self._stone_isSameDay_present = False

    @property
    def businessReference(self):
        """
        Reference number from the client system.

        :rtype: str
        """
        if self._stone_businessReference_present:
            return self._stone_businessReference_value
        else:
            return None

    @businessReference.setter
    def businessReference(self, val):
        if val is None:
            del self.businessReference
            return
        val = self._stone_businessReference_validator.validate(val)
        self._stone_businessReference_value = val
        self._stone_businessReference_present = True

    @businessReference.deleter
    def businessReference(self):
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False

    @property
    def webhookUrl(self):
        """
        URL where HTTP POST requests of state updates should be sent to.

        :rtype: str
        """
        if self._stone_webhookUrl_present:
            return self._stone_webhookUrl_value
        else:
            return None

    @webhookUrl.setter
    def webhookUrl(self, val):
        if val is None:
            del self.webhookUrl
            return
        val = self._stone_webhookUrl_validator.validate(val)
        self._stone_webhookUrl_value = val
        self._stone_webhookUrl_present = True

    @webhookUrl.deleter
    def webhookUrl(self):
        self._stone_webhookUrl_value = None
        self._stone_webhookUrl_present = False

    def __repr__(self):
        return 'CreateDeliveryArg(receiver={!r}, type={!r}, pickupAddress={!r}, dropOffAddress={!r}, notes={!r}, cod={!r}, isSameDay={!r}, businessReference={!r}, webhookUrl={!r})'.format(
            self._stone_receiver_value,
            self._stone_type_value,
            self._stone_pickupAddress_value,
            self._stone_dropOffAddress_value,
            self._stone_notes_value,
            self._stone_cod_value,
            self._stone_isSameDay_value,
            self._stone_businessReference_value,
            self._stone_webhookUrl_value,
        )

CreateDeliveryArg_validator = bv.Struct(CreateDeliveryArg)

class CreateDeliveryResult(object):
    """
    :ivar _id: ID of the created delivery.
    :ivar message: Success message.
    :ivar state: State of the created delivery.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_message_value',
        '_stone_message_present',
        '_stone_state_value',
        '_stone_state_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 message=None,
                 state=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_message_value = None
        self._stone_message_present = False
        self._stone_state_value = None
        self._stone_state_present = False
        if _id is not None:
            self._id = _id
        if message is not None:
            self.message = message
        if state is not None:
            self.state = state

    @property
    def _id(self):
        """
        ID of the created delivery.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def message(self):
        """
        Success message.

        :rtype: str
        """
        if self._stone_message_present:
            return self._stone_message_value
        else:
            raise AttributeError("missing required field 'message'")

    @message.setter
    def message(self, val):
        val = self._stone_message_validator.validate(val)
        self._stone_message_value = val
        self._stone_message_present = True

    @message.deleter
    def message(self):
        self._stone_message_value = None
        self._stone_message_present = False

    @property
    def state(self):
        """
        State of the created delivery.

        :rtype: State
        """
        if self._stone_state_present:
            return self._stone_state_value
        else:
            raise AttributeError("missing required field 'state'")

    @state.setter
    def state(self, val):
        self._stone_state_validator.validate_type_only(val)
        self._stone_state_value = val
        self._stone_state_present = True

    @state.deleter
    def state(self):
        self._stone_state_value = None
        self._stone_state_present = False

    def __repr__(self):
        return 'CreateDeliveryResult(_id={!r}, message={!r}, state={!r})'.format(
            self._stone__id_value,
            self._stone_message_value,
            self._stone_state_value,
        )

CreateDeliveryResult_validator = bv.Struct(CreateDeliveryResult)

class DeleteDeliveryArg(object):
    """
    :ivar _id: ID of the delivery to delete.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None):
        self._stone__id_value = None
        self._stone__id_present = False
        if _id is not None:
            self._id = _id

    @property
    def _id(self):
        """
        ID of the delivery to delete.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    def __repr__(self):
        return 'DeleteDeliveryArg(_id={!r})'.format(
            self._stone__id_value,
        )

DeleteDeliveryArg_validator = bv.Struct(DeleteDeliveryArg)

class DeleteDeliveryResult(object):
    """
    :ivar _id: ID of the deleted delivery.
    :ivar message: Success message.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_message_value',
        '_stone_message_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 message=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_message_value = None
        self._stone_message_present = False
        if _id is not None:
            self._id = _id
        if message is not None:
            self.message = message

    @property
    def _id(self):
        """
        ID of the deleted delivery.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def message(self):
        """
        Success message.

        :rtype: str
        """
        if self._stone_message_present:
            return self._stone_message_value
        else:
            raise AttributeError("missing required field 'message'")

    @message.setter
    def message(self, val):
        val = self._stone_message_validator.validate(val)
        self._stone_message_value = val
        self._stone_message_present = True

    @message.deleter
    def message(self):
        self._stone_message_value = None
        self._stone_message_present = False

    def __repr__(self):
        return 'DeleteDeliveryResult(_id={!r}, message={!r})'.format(
            self._stone__id_value,
            self._stone_message_value,
        )

DeleteDeliveryResult_validator = bv.Struct(DeleteDeliveryResult)

class Delivery(object):
    """
    Delivery details.

    :ivar _id: ID of the delivery.
    :ivar pickupAddress: Address details where delivery is picked up from.
    :ivar dropOffAddress: Address details where delivery is delivered to.
    :ivar receiver: Delivery receiver details.
    :ivar state: The current state of the delivery.
    :ivar trackingNumber: Bosta tracking number.
    :ivar notes: Instructions for the Bosta star or Bosta admins regarding the
        delivery.
    :ivar cod: Cash on delivery amount if required.
    :ivar businessReference: Reference number from the client system.
    :ivar type: The service type of the delivery.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_pickupAddress_value',
        '_stone_pickupAddress_present',
        '_stone_dropOffAddress_value',
        '_stone_dropOffAddress_present',
        '_stone_receiver_value',
        '_stone_receiver_present',
        '_stone_state_value',
        '_stone_state_present',
        '_stone_trackingNumber_value',
        '_stone_trackingNumber_present',
        '_stone_notes_value',
        '_stone_notes_present',
        '_stone_cod_value',
        '_stone_cod_present',
        '_stone_businessReference_value',
        '_stone_businessReference_present',
        '_stone_type_value',
        '_stone_type_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 pickupAddress=None,
                 dropOffAddress=None,
                 receiver=None,
                 state=None,
                 trackingNumber=None,
                 notes=None,
                 cod=None,
                 businessReference=None,
                 type=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False
        self._stone_receiver_value = None
        self._stone_receiver_present = False
        self._stone_state_value = None
        self._stone_state_present = False
        self._stone_trackingNumber_value = None
        self._stone_trackingNumber_present = False
        self._stone_notes_value = None
        self._stone_notes_present = False
        self._stone_cod_value = None
        self._stone_cod_present = False
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False
        self._stone_type_value = None
        self._stone_type_present = False
        if _id is not None:
            self._id = _id
        if pickupAddress is not None:
            self.pickupAddress = pickupAddress
        if dropOffAddress is not None:
            self.dropOffAddress = dropOffAddress
        if receiver is not None:
            self.receiver = receiver
        if state is not None:
            self.state = state
        if trackingNumber is not None:
            self.trackingNumber = trackingNumber
        if notes is not None:
            self.notes = notes
        if cod is not None:
            self.cod = cod
        if businessReference is not None:
            self.businessReference = businessReference
        if type is not None:
            self.type = type

    @property
    def _id(self):
        """
        ID of the delivery.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def pickupAddress(self):
        """
        Address details where delivery is picked up from.

        :rtype: ResultAddress
        """
        if self._stone_pickupAddress_present:
            return self._stone_pickupAddress_value
        else:
            raise AttributeError("missing required field 'pickupAddress'")

    @pickupAddress.setter
    def pickupAddress(self, val):
        self._stone_pickupAddress_validator.validate_type_only(val)
        self._stone_pickupAddress_value = val
        self._stone_pickupAddress_present = True

    @pickupAddress.deleter
    def pickupAddress(self):
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False

    @property
    def dropOffAddress(self):
        """
        Address details where delivery is delivered to.

        :rtype: ResultAddress
        """
        if self._stone_dropOffAddress_present:
            return self._stone_dropOffAddress_value
        else:
            raise AttributeError("missing required field 'dropOffAddress'")

    @dropOffAddress.setter
    def dropOffAddress(self, val):
        self._stone_dropOffAddress_validator.validate_type_only(val)
        self._stone_dropOffAddress_value = val
        self._stone_dropOffAddress_present = True

    @dropOffAddress.deleter
    def dropOffAddress(self):
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False

    @property
    def receiver(self):
        """
        Delivery receiver details.

        :rtype: Receiver
        """
        if self._stone_receiver_present:
            return self._stone_receiver_value
        else:
            raise AttributeError("missing required field 'receiver'")

    @receiver.setter
    def receiver(self, val):
        self._stone_receiver_validator.validate_type_only(val)
        self._stone_receiver_value = val
        self._stone_receiver_present = True

    @receiver.deleter
    def receiver(self):
        self._stone_receiver_value = None
        self._stone_receiver_present = False

    @property
    def state(self):
        """
        The current state of the delivery.

        :rtype: State
        """
        if self._stone_state_present:
            return self._stone_state_value
        else:
            raise AttributeError("missing required field 'state'")

    @state.setter
    def state(self, val):
        self._stone_state_validator.validate_type_only(val)
        self._stone_state_value = val
        self._stone_state_present = True

    @state.deleter
    def state(self):
        self._stone_state_value = None
        self._stone_state_present = False

    @property
    def trackingNumber(self):
        """
        Bosta tracking number.

        :rtype: str
        """
        if self._stone_trackingNumber_present:
            return self._stone_trackingNumber_value
        else:
            raise AttributeError("missing required field 'trackingNumber'")

    @trackingNumber.setter
    def trackingNumber(self, val):
        val = self._stone_trackingNumber_validator.validate(val)
        self._stone_trackingNumber_value = val
        self._stone_trackingNumber_present = True

    @trackingNumber.deleter
    def trackingNumber(self):
        self._stone_trackingNumber_value = None
        self._stone_trackingNumber_present = False

    @property
    def notes(self):
        """
        Instructions for the Bosta star or Bosta admins regarding the delivery.

        :rtype: str
        """
        if self._stone_notes_present:
            return self._stone_notes_value
        else:
            return None

    @notes.setter
    def notes(self, val):
        if val is None:
            del self.notes
            return
        val = self._stone_notes_validator.validate(val)
        self._stone_notes_value = val
        self._stone_notes_present = True

    @notes.deleter
    def notes(self):
        self._stone_notes_value = None
        self._stone_notes_present = False

    @property
    def cod(self):
        """
        Cash on delivery amount if required.

        :rtype: float
        """
        if self._stone_cod_present:
            return self._stone_cod_value
        else:
            return None

    @cod.setter
    def cod(self, val):
        if val is None:
            del self.cod
            return
        val = self._stone_cod_validator.validate(val)
        self._stone_cod_value = val
        self._stone_cod_present = True

    @cod.deleter
    def cod(self):
        self._stone_cod_value = None
        self._stone_cod_present = False

    @property
    def businessReference(self):
        """
        Reference number from the client system.

        :rtype: str
        """
        if self._stone_businessReference_present:
            return self._stone_businessReference_value
        else:
            return None

    @businessReference.setter
    def businessReference(self, val):
        if val is None:
            del self.businessReference
            return
        val = self._stone_businessReference_validator.validate(val)
        self._stone_businessReference_value = val
        self._stone_businessReference_present = True

    @businessReference.deleter
    def businessReference(self):
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False

    @property
    def type(self):
        """
        The service type of the delivery.

        :rtype: Type
        """
        if self._stone_type_present:
            return self._stone_type_value
        else:
            return None

    @type.setter
    def type(self, val):
        if val is None:
            del self.type
            return
        self._stone_type_validator.validate_type_only(val)
        self._stone_type_value = val
        self._stone_type_present = True

    @type.deleter
    def type(self):
        self._stone_type_value = None
        self._stone_type_present = False

    def __repr__(self):
        return 'Delivery(_id={!r}, pickupAddress={!r}, dropOffAddress={!r}, receiver={!r}, state={!r}, trackingNumber={!r}, notes={!r}, cod={!r}, businessReference={!r}, type={!r})'.format(
            self._stone__id_value,
            self._stone_pickupAddress_value,
            self._stone_dropOffAddress_value,
            self._stone_receiver_value,
            self._stone_state_value,
            self._stone_trackingNumber_value,
            self._stone_notes_value,
            self._stone_cod_value,
            self._stone_businessReference_value,
            self._stone_type_value,
        )

Delivery_validator = bv.Struct(Delivery)

class Error(object):
    """
    Error object returned by the API.

    :ivar code: Error code.
    :ivar message: Error message.
    """

    __slots__ = [
        '_stone_code_value',
        '_stone_code_present',
        '_stone_message_value',
        '_stone_message_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 code=None,
                 message=None):
        self._stone_code_value = None
        self._stone_code_present = False
        self._stone_message_value = None
        self._stone_message_present = False
        if code is not None:
            self.code = code
        if message is not None:
            self.message = message

    @property
    def code(self):
        """
        Error code.

        :rtype: long
        """
        if self._stone_code_present:
            return self._stone_code_value
        else:
            raise AttributeError("missing required field 'code'")

    @code.setter
    def code(self, val):
        val = self._stone_code_validator.validate(val)
        self._stone_code_value = val
        self._stone_code_present = True

    @code.deleter
    def code(self):
        self._stone_code_value = None
        self._stone_code_present = False

    @property
    def message(self):
        """
        Error message.

        :rtype: str
        """
        if self._stone_message_present:
            return self._stone_message_value
        else:
            raise AttributeError("missing required field 'message'")

    @message.setter
    def message(self, val):
        val = self._stone_message_validator.validate(val)
        self._stone_message_value = val
        self._stone_message_present = True

    @message.deleter
    def message(self):
        self._stone_message_value = None
        self._stone_message_present = False

    def __repr__(self):
        return 'Error(code={!r}, message={!r})'.format(
            self._stone_code_value,
            self._stone_message_value,
        )

Error_validator = bv.Struct(Error)

class GeoLocation(object):
    """
    Coordinates to a point on Earth.

    :ivar latitude: North-south position.
    :ivar longitude: East-west position.
    """

    __slots__ = [
        '_stone_latitude_value',
        '_stone_latitude_present',
        '_stone_longitude_value',
        '_stone_longitude_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 latitude=None,
                 longitude=None):
        self._stone_latitude_value = None
        self._stone_latitude_present = False
        self._stone_longitude_value = None
        self._stone_longitude_present = False
        if latitude is not None:
            self.latitude = latitude
        if longitude is not None:
            self.longitude = longitude

    @property
    def latitude(self):
        """
        North-south position.

        :rtype: float
        """
        if self._stone_latitude_present:
            return self._stone_latitude_value
        else:
            raise AttributeError("missing required field 'latitude'")

    @latitude.setter
    def latitude(self, val):
        val = self._stone_latitude_validator.validate(val)
        self._stone_latitude_value = val
        self._stone_latitude_present = True

    @latitude.deleter
    def latitude(self):
        self._stone_latitude_value = None
        self._stone_latitude_present = False

    @property
    def longitude(self):
        """
        East-west position.

        :rtype: float
        """
        if self._stone_longitude_present:
            return self._stone_longitude_value
        else:
            raise AttributeError("missing required field 'longitude'")

    @longitude.setter
    def longitude(self, val):
        val = self._stone_longitude_validator.validate(val)
        self._stone_longitude_value = val
        self._stone_longitude_present = True

    @longitude.deleter
    def longitude(self):
        self._stone_longitude_value = None
        self._stone_longitude_present = False

    def __repr__(self):
        return 'GeoLocation(latitude={!r}, longitude={!r})'.format(
            self._stone_latitude_value,
            self._stone_longitude_value,
        )

GeoLocation_validator = bv.Struct(GeoLocation)

class GetDeliveryArg(object):
    """
    :ivar _id: ID of the requested delivery.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None):
        self._stone__id_value = None
        self._stone__id_present = False
        if _id is not None:
            self._id = _id

    @property
    def _id(self):
        """
        ID of the requested delivery.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    def __repr__(self):
        return 'GetDeliveryArg(_id={!r})'.format(
            self._stone__id_value,
        )

GetDeliveryArg_validator = bv.Struct(GetDeliveryArg)

class GetDeliveryResult(object):
    """
    :ivar delivery: The Delivery object with the given ID.
    """

    __slots__ = [
        '_stone_delivery_value',
        '_stone_delivery_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 delivery=None):
        self._stone_delivery_value = None
        self._stone_delivery_present = False
        if delivery is not None:
            self.delivery = delivery

    @property
    def delivery(self):
        """
        The Delivery object with the given ID.

        :rtype: Delivery
        """
        if self._stone_delivery_present:
            return self._stone_delivery_value
        else:
            raise AttributeError("missing required field 'delivery'")

    @delivery.setter
    def delivery(self, val):
        self._stone_delivery_validator.validate_type_only(val)
        self._stone_delivery_value = val
        self._stone_delivery_present = True

    @delivery.deleter
    def delivery(self):
        self._stone_delivery_value = None
        self._stone_delivery_present = False

    def __repr__(self):
        return 'GetDeliveryResult(delivery={!r})'.format(
            self._stone_delivery_value,
        )

GetDeliveryResult_validator = bv.Struct(GetDeliveryResult)

class ListDeliveryArg(object):
    """
    :ivar page: Page number if the result is paginated.
    :ivar perPage: The limit of number of deliveries that are retrieved in one
        request.
    """

    __slots__ = [
        '_stone_page_value',
        '_stone_page_present',
        '_stone_perPage_value',
        '_stone_perPage_present',
    ]

    _has_required_fields = False

    def __init__(self,
                 page=None,
                 perPage=None):
        self._stone_page_value = None
        self._stone_page_present = False
        self._stone_perPage_value = None
        self._stone_perPage_present = False
        if page is not None:
            self.page = page
        if perPage is not None:
            self.perPage = perPage

    @property
    def page(self):
        """
        Page number if the result is paginated.

        :rtype: long
        """
        if self._stone_page_present:
            return self._stone_page_value
        else:
            return None

    @page.setter
    def page(self, val):
        if val is None:
            del self.page
            return
        val = self._stone_page_validator.validate(val)
        self._stone_page_value = val
        self._stone_page_present = True

    @page.deleter
    def page(self):
        self._stone_page_value = None
        self._stone_page_present = False

    @property
    def perPage(self):
        """
        The limit of number of deliveries that are retrieved in one request.

        :rtype: long
        """
        if self._stone_perPage_present:
            return self._stone_perPage_value
        else:
            return None

    @perPage.setter
    def perPage(self, val):
        if val is None:
            del self.perPage
            return
        val = self._stone_perPage_validator.validate(val)
        self._stone_perPage_value = val
        self._stone_perPage_present = True

    @perPage.deleter
    def perPage(self):
        self._stone_perPage_value = None
        self._stone_perPage_present = False

    def __repr__(self):
        return 'ListDeliveryArg(page={!r}, perPage={!r})'.format(
            self._stone_page_value,
            self._stone_perPage_value,
        )

ListDeliveryArg_validator = bv.Struct(ListDeliveryArg)

class ListDeliveryResult(object):
    """
    :ivar deliveries: List of Delivery objects created by the business account.
    """

    __slots__ = [
        '_stone_deliveries_value',
        '_stone_deliveries_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 deliveries=None):
        self._stone_deliveries_value = None
        self._stone_deliveries_present = False
        if deliveries is not None:
            self.deliveries = deliveries

    @property
    def deliveries(self):
        """
        List of Delivery objects created by the business account.

        :rtype: list of [Delivery]
        """
        if self._stone_deliveries_present:
            return self._stone_deliveries_value
        else:
            raise AttributeError("missing required field 'deliveries'")

    @deliveries.setter
    def deliveries(self, val):
        val = self._stone_deliveries_validator.validate(val)
        self._stone_deliveries_value = val
        self._stone_deliveries_present = True

    @deliveries.deleter
    def deliveries(self):
        self._stone_deliveries_value = None
        self._stone_deliveries_present = False

    def __repr__(self):
        return 'ListDeliveryResult(deliveries={!r})'.format(
            self._stone_deliveries_value,
        )

ListDeliveryResult_validator = bv.Struct(ListDeliveryResult)

class Receiver(object):
    """
    Receiver of a delivery.

    :ivar firstName: Receiver's first name.
    :ivar lastName: Receiver's last name.
    :ivar phone: Receiver's phone number starting with country code.
    :ivar email: Receiver's email address.
    """

    __slots__ = [
        '_stone_firstName_value',
        '_stone_firstName_present',
        '_stone_lastName_value',
        '_stone_lastName_present',
        '_stone_phone_value',
        '_stone_phone_present',
        '_stone_email_value',
        '_stone_email_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 firstName=None,
                 lastName=None,
                 phone=None,
                 email=None):
        self._stone_firstName_value = None
        self._stone_firstName_present = False
        self._stone_lastName_value = None
        self._stone_lastName_present = False
        self._stone_phone_value = None
        self._stone_phone_present = False
        self._stone_email_value = None
        self._stone_email_present = False
        if firstName is not None:
            self.firstName = firstName
        if lastName is not None:
            self.lastName = lastName
        if phone is not None:
            self.phone = phone
        if email is not None:
            self.email = email

    @property
    def firstName(self):
        """
        Receiver's first name.

        :rtype: str
        """
        if self._stone_firstName_present:
            return self._stone_firstName_value
        else:
            raise AttributeError("missing required field 'firstName'")

    @firstName.setter
    def firstName(self, val):
        val = self._stone_firstName_validator.validate(val)
        self._stone_firstName_value = val
        self._stone_firstName_present = True

    @firstName.deleter
    def firstName(self):
        self._stone_firstName_value = None
        self._stone_firstName_present = False

    @property
    def lastName(self):
        """
        Receiver's last name.

        :rtype: str
        """
        if self._stone_lastName_present:
            return self._stone_lastName_value
        else:
            raise AttributeError("missing required field 'lastName'")

    @lastName.setter
    def lastName(self, val):
        val = self._stone_lastName_validator.validate(val)
        self._stone_lastName_value = val
        self._stone_lastName_present = True

    @lastName.deleter
    def lastName(self):
        self._stone_lastName_value = None
        self._stone_lastName_present = False

    @property
    def phone(self):
        """
        Receiver's phone number starting with country code.

        :rtype: str
        """
        if self._stone_phone_present:
            return self._stone_phone_value
        else:
            raise AttributeError("missing required field 'phone'")

    @phone.setter
    def phone(self, val):
        val = self._stone_phone_validator.validate(val)
        self._stone_phone_value = val
        self._stone_phone_present = True

    @phone.deleter
    def phone(self):
        self._stone_phone_value = None
        self._stone_phone_present = False

    @property
    def email(self):
        """
        Receiver's email address.

        :rtype: str
        """
        if self._stone_email_present:
            return self._stone_email_value
        else:
            return None

    @email.setter
    def email(self, val):
        if val is None:
            del self.email
            return
        val = self._stone_email_validator.validate(val)
        self._stone_email_value = val
        self._stone_email_present = True

    @email.deleter
    def email(self):
        self._stone_email_value = None
        self._stone_email_present = False

    def __repr__(self):
        return 'Receiver(firstName={!r}, lastName={!r}, phone={!r}, email={!r})'.format(
            self._stone_firstName_value,
            self._stone_lastName_value,
            self._stone_phone_value,
            self._stone_email_value,
        )

Receiver_validator = bv.Struct(Receiver)

class RequestError(object):
    """
    :ivar errors: List of errors.
    """

    __slots__ = [
        '_stone_errors_value',
        '_stone_errors_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 errors=None):
        self._stone_errors_value = None
        self._stone_errors_present = False
        if errors is not None:
            self.errors = errors

    @property
    def errors(self):
        """
        List of errors.

        :rtype: list of [Error]
        """
        if self._stone_errors_present:
            return self._stone_errors_value
        else:
            raise AttributeError("missing required field 'errors'")

    @errors.setter
    def errors(self, val):
        val = self._stone_errors_validator.validate(val)
        self._stone_errors_value = val
        self._stone_errors_present = True

    @errors.deleter
    def errors(self):
        self._stone_errors_value = None
        self._stone_errors_present = False

    def __repr__(self):
        return 'RequestError(errors={!r})'.format(
            self._stone_errors_value,
        )

RequestError_validator = bv.Struct(RequestError)

class ResultAddress(BaseAddress):
    """
    An address where a delivery can be picked up or dropped off. This is the
    address object returned by the API.

    :ivar geoLocation: Geographical oordinates of the address.
    :ivar city: City where the address belongs to.
    """

    __slots__ = [
        '_stone_geoLocation_value',
        '_stone_geoLocation_present',
        '_stone_city_value',
        '_stone_city_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 firstLine=None,
                 secondLine=None,
                 floor=None,
                 apartment=None,
                 zone=None,
                 district=None,
                 geoLocation=None,
                 city=None):
        super(ResultAddress, self).__init__(firstLine,
                                            secondLine,
                                            floor,
                                            apartment,
                                            zone,
                                            district)
        self._stone_geoLocation_value = None
        self._stone_geoLocation_present = False
        self._stone_city_value = None
        self._stone_city_present = False
        if geoLocation is not None:
            self.geoLocation = geoLocation
        if city is not None:
            self.city = city

    @property
    def geoLocation(self):
        """
        Geographical oordinates of the address.

        :rtype: GeoLocation
        """
        if self._stone_geoLocation_present:
            return self._stone_geoLocation_value
        else:
            return None

    @geoLocation.setter
    def geoLocation(self, val):
        if val is None:
            del self.geoLocation
            return
        self._stone_geoLocation_validator.validate_type_only(val)
        self._stone_geoLocation_value = val
        self._stone_geoLocation_present = True

    @geoLocation.deleter
    def geoLocation(self):
        self._stone_geoLocation_value = None
        self._stone_geoLocation_present = False

    @property
    def city(self):
        """
        City where the address belongs to.

        :rtype: City
        """
        if self._stone_city_present:
            return self._stone_city_value
        else:
            return None

    @city.setter
    def city(self, val):
        if val is None:
            del self.city
            return
        self._stone_city_validator.validate_type_only(val)
        self._stone_city_value = val
        self._stone_city_present = True

    @city.deleter
    def city(self):
        self._stone_city_value = None
        self._stone_city_present = False

    def __repr__(self):
        return 'ResultAddress(firstLine={!r}, secondLine={!r}, floor={!r}, apartment={!r}, zone={!r}, district={!r}, geoLocation={!r}, city={!r})'.format(
            self._stone_firstLine_value,
            self._stone_secondLine_value,
            self._stone_floor_value,
            self._stone_apartment_value,
            self._stone_zone_value,
            self._stone_district_value,
            self._stone_geoLocation_value,
            self._stone_city_value,
        )

ResultAddress_validator = bv.Struct(ResultAddress)

class State(object):
    """
    State of a delivery.

    :ivar value: Delivery state name.
    :ivar code: Integer representation of delivery state.
    """

    __slots__ = [
        '_stone_value_value',
        '_stone_value_present',
        '_stone_code_value',
        '_stone_code_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 value=None,
                 code=None):
        self._stone_value_value = None
        self._stone_value_present = False
        self._stone_code_value = None
        self._stone_code_present = False
        if value is not None:
            self.value = value
        if code is not None:
            self.code = code

    @property
    def value(self):
        """
        Delivery state name.

        :rtype: str
        """
        if self._stone_value_present:
            return self._stone_value_value
        else:
            raise AttributeError("missing required field 'value'")

    @value.setter
    def value(self, val):
        val = self._stone_value_validator.validate(val)
        self._stone_value_value = val
        self._stone_value_present = True

    @value.deleter
    def value(self):
        self._stone_value_value = None
        self._stone_value_present = False

    @property
    def code(self):
        """
        Integer representation of delivery state.

        :rtype: long
        """
        if self._stone_code_present:
            return self._stone_code_value
        else:
            raise AttributeError("missing required field 'code'")

    @code.setter
    def code(self, val):
        val = self._stone_code_validator.validate(val)
        self._stone_code_value = val
        self._stone_code_present = True

    @code.deleter
    def code(self):
        self._stone_code_value = None
        self._stone_code_present = False

    def __repr__(self):
        return 'State(value={!r}, code={!r})'.format(
            self._stone_value_value,
            self._stone_code_value,
        )

State_validator = bv.Struct(State)

class Type(object):
    """
    Service type.

    :ivar value: Service type name.
    :ivar code: Integer representation of the service type.
    """

    __slots__ = [
        '_stone_value_value',
        '_stone_value_present',
        '_stone_code_value',
        '_stone_code_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 value=None,
                 code=None):
        self._stone_value_value = None
        self._stone_value_present = False
        self._stone_code_value = None
        self._stone_code_present = False
        if value is not None:
            self.value = value
        if code is not None:
            self.code = code

    @property
    def value(self):
        """
        Service type name.

        :rtype: str
        """
        if self._stone_value_present:
            return self._stone_value_value
        else:
            raise AttributeError("missing required field 'value'")

    @value.setter
    def value(self, val):
        val = self._stone_value_validator.validate(val)
        self._stone_value_value = val
        self._stone_value_present = True

    @value.deleter
    def value(self):
        self._stone_value_value = None
        self._stone_value_present = False

    @property
    def code(self):
        """
        Integer representation of the service type.

        :rtype: long
        """
        if self._stone_code_present:
            return self._stone_code_value
        else:
            raise AttributeError("missing required field 'code'")

    @code.setter
    def code(self, val):
        val = self._stone_code_validator.validate(val)
        self._stone_code_value = val
        self._stone_code_present = True

    @code.deleter
    def code(self):
        self._stone_code_value = None
        self._stone_code_present = False

    def __repr__(self):
        return 'Type(value={!r}, code={!r})'.format(
            self._stone_value_value,
            self._stone_code_value,
        )

Type_validator = bv.Struct(Type)

class UpdateDeliveryArg(object):
    """
    :ivar _id: ID of the delivery to update.
    :ivar receiver: Delivery receiver details object.
    :ivar pickupAddress: Delivery pickup address.
    :ivar dropOffAddress: Delivery destination address.
    :ivar notes: Instructions for the Bosta star or Bosta admins regarding the
        delivery.
    :ivar cod: Cash on delivery amount if required.
    :ivar businessReference: Reference number from the client system.
    :ivar webhookUrl: URL where HTTP POST requests of state updates should be
        sent to.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_receiver_value',
        '_stone_receiver_present',
        '_stone_pickupAddress_value',
        '_stone_pickupAddress_present',
        '_stone_dropOffAddress_value',
        '_stone_dropOffAddress_present',
        '_stone_notes_value',
        '_stone_notes_present',
        '_stone_cod_value',
        '_stone_cod_present',
        '_stone_businessReference_value',
        '_stone_businessReference_present',
        '_stone_webhookUrl_value',
        '_stone_webhookUrl_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 receiver=None,
                 pickupAddress=None,
                 dropOffAddress=None,
                 notes=None,
                 cod=None,
                 businessReference=None,
                 webhookUrl=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_receiver_value = None
        self._stone_receiver_present = False
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False
        self._stone_notes_value = None
        self._stone_notes_present = False
        self._stone_cod_value = None
        self._stone_cod_present = False
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False
        self._stone_webhookUrl_value = None
        self._stone_webhookUrl_present = False
        if _id is not None:
            self._id = _id
        if receiver is not None:
            self.receiver = receiver
        if pickupAddress is not None:
            self.pickupAddress = pickupAddress
        if dropOffAddress is not None:
            self.dropOffAddress = dropOffAddress
        if notes is not None:
            self.notes = notes
        if cod is not None:
            self.cod = cod
        if businessReference is not None:
            self.businessReference = businessReference
        if webhookUrl is not None:
            self.webhookUrl = webhookUrl

    @property
    def _id(self):
        """
        ID of the delivery to update.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def receiver(self):
        """
        Delivery receiver details object.

        :rtype: Receiver
        """
        if self._stone_receiver_present:
            return self._stone_receiver_value
        else:
            return None

    @receiver.setter
    def receiver(self, val):
        if val is None:
            del self.receiver
            return
        self._stone_receiver_validator.validate_type_only(val)
        self._stone_receiver_value = val
        self._stone_receiver_present = True

    @receiver.deleter
    def receiver(self):
        self._stone_receiver_value = None
        self._stone_receiver_present = False

    @property
    def pickupAddress(self):
        """
        Delivery pickup address.

        :rtype: Address
        """
        if self._stone_pickupAddress_present:
            return self._stone_pickupAddress_value
        else:
            return None

    @pickupAddress.setter
    def pickupAddress(self, val):
        if val is None:
            del self.pickupAddress
            return
        self._stone_pickupAddress_validator.validate_type_only(val)
        self._stone_pickupAddress_value = val
        self._stone_pickupAddress_present = True

    @pickupAddress.deleter
    def pickupAddress(self):
        self._stone_pickupAddress_value = None
        self._stone_pickupAddress_present = False

    @property
    def dropOffAddress(self):
        """
        Delivery destination address.

        :rtype: Address
        """
        if self._stone_dropOffAddress_present:
            return self._stone_dropOffAddress_value
        else:
            return None

    @dropOffAddress.setter
    def dropOffAddress(self, val):
        if val is None:
            del self.dropOffAddress
            return
        self._stone_dropOffAddress_validator.validate_type_only(val)
        self._stone_dropOffAddress_value = val
        self._stone_dropOffAddress_present = True

    @dropOffAddress.deleter
    def dropOffAddress(self):
        self._stone_dropOffAddress_value = None
        self._stone_dropOffAddress_present = False

    @property
    def notes(self):
        """
        Instructions for the Bosta star or Bosta admins regarding the delivery.

        :rtype: str
        """
        if self._stone_notes_present:
            return self._stone_notes_value
        else:
            return None

    @notes.setter
    def notes(self, val):
        if val is None:
            del self.notes
            return
        val = self._stone_notes_validator.validate(val)
        self._stone_notes_value = val
        self._stone_notes_present = True

    @notes.deleter
    def notes(self):
        self._stone_notes_value = None
        self._stone_notes_present = False

    @property
    def cod(self):
        """
        Cash on delivery amount if required.

        :rtype: long
        """
        if self._stone_cod_present:
            return self._stone_cod_value
        else:
            return None

    @cod.setter
    def cod(self, val):
        if val is None:
            del self.cod
            return
        val = self._stone_cod_validator.validate(val)
        self._stone_cod_value = val
        self._stone_cod_present = True

    @cod.deleter
    def cod(self):
        self._stone_cod_value = None
        self._stone_cod_present = False

    @property
    def businessReference(self):
        """
        Reference number from the client system.

        :rtype: str
        """
        if self._stone_businessReference_present:
            return self._stone_businessReference_value
        else:
            return None

    @businessReference.setter
    def businessReference(self, val):
        if val is None:
            del self.businessReference
            return
        val = self._stone_businessReference_validator.validate(val)
        self._stone_businessReference_value = val
        self._stone_businessReference_present = True

    @businessReference.deleter
    def businessReference(self):
        self._stone_businessReference_value = None
        self._stone_businessReference_present = False

    @property
    def webhookUrl(self):
        """
        URL where HTTP POST requests of state updates should be sent to.

        :rtype: str
        """
        if self._stone_webhookUrl_present:
            return self._stone_webhookUrl_value
        else:
            return None

    @webhookUrl.setter
    def webhookUrl(self, val):
        if val is None:
            del self.webhookUrl
            return
        val = self._stone_webhookUrl_validator.validate(val)
        self._stone_webhookUrl_value = val
        self._stone_webhookUrl_present = True

    @webhookUrl.deleter
    def webhookUrl(self):
        self._stone_webhookUrl_value = None
        self._stone_webhookUrl_present = False

    def __repr__(self):
        return 'UpdateDeliveryArg(_id={!r}, receiver={!r}, pickupAddress={!r}, dropOffAddress={!r}, notes={!r}, cod={!r}, businessReference={!r}, webhookUrl={!r})'.format(
            self._stone__id_value,
            self._stone_receiver_value,
            self._stone_pickupAddress_value,
            self._stone_dropOffAddress_value,
            self._stone_notes_value,
            self._stone_cod_value,
            self._stone_businessReference_value,
            self._stone_webhookUrl_value,
        )

UpdateDeliveryArg_validator = bv.Struct(UpdateDeliveryArg)

class UpdateDeliveryResult(object):
    """
    :ivar _id: ID of the updated delivery.
    :ivar message: Success message.
    """

    __slots__ = [
        '_stone__id_value',
        '_stone__id_present',
        '_stone_message_value',
        '_stone_message_present',
    ]

    _has_required_fields = True

    def __init__(self,
                 _id=None,
                 message=None):
        self._stone__id_value = None
        self._stone__id_present = False
        self._stone_message_value = None
        self._stone_message_present = False
        if _id is not None:
            self._id = _id
        if message is not None:
            self.message = message

    @property
    def _id(self):
        """
        ID of the updated delivery.

        :rtype: str
        """
        if self._stone__id_present:
            return self._stone__id_value
        else:
            raise AttributeError("missing required field '_id'")

    @_id.setter
    def _id(self, val):
        val = self._stone__id_validator.validate(val)
        self._stone__id_value = val
        self._stone__id_present = True

    @_id.deleter
    def _id(self):
        self._stone__id_value = None
        self._stone__id_present = False

    @property
    def message(self):
        """
        Success message.

        :rtype: str
        """
        if self._stone_message_present:
            return self._stone_message_value
        else:
            raise AttributeError("missing required field 'message'")

    @message.setter
    def message(self, val):
        val = self._stone_message_validator.validate(val)
        self._stone_message_value = val
        self._stone_message_present = True

    @message.deleter
    def message(self):
        self._stone_message_value = None
        self._stone_message_present = False

    def __repr__(self):
        return 'UpdateDeliveryResult(_id={!r}, message={!r})'.format(
            self._stone__id_value,
            self._stone_message_value,
        )

UpdateDeliveryResult_validator = bv.Struct(UpdateDeliveryResult)

BaseAddress._stone_firstLine_validator = bv.String()
BaseAddress._stone_secondLine_validator = bv.Nullable(bv.String())
BaseAddress._stone_floor_validator = bv.Nullable(bv.Int32())
BaseAddress._stone_apartment_validator = bv.Nullable(bv.Int32())
BaseAddress._stone_zone_validator = bv.Nullable(bv.String())
BaseAddress._stone_district_validator = bv.Nullable(bv.String())
BaseAddress._all_field_names_ = set([
    'firstLine',
    'secondLine',
    'floor',
    'apartment',
    'zone',
    'district',
])
BaseAddress._all_fields_ = [
    ('firstLine', BaseAddress._stone_firstLine_validator),
    ('secondLine', BaseAddress._stone_secondLine_validator),
    ('floor', BaseAddress._stone_floor_validator),
    ('apartment', BaseAddress._stone_apartment_validator),
    ('zone', BaseAddress._stone_zone_validator),
    ('district', BaseAddress._stone_district_validator),
]

Address._stone_geoLocation_validator = bv.Nullable(bv.List(bv.Float32(), max_items=2))
Address._stone_city_validator = bv.String(pattern='^EG-0(1|2)$')
Address._all_field_names_ = BaseAddress._all_field_names_.union(set([
    'geoLocation',
    'city',
]))
Address._all_fields_ = BaseAddress._all_fields_ + [
    ('geoLocation', Address._stone_geoLocation_validator),
    ('city', Address._stone_city_validator),
]

City._stone__id_validator = bv.String()
City._stone_name_validator = bv.String()
City._all_field_names_ = set([
    '_id',
    'name',
])
City._all_fields_ = [
    ('_id', City._stone__id_validator),
    ('name', City._stone_name_validator),
]

CreateDeliveryArg._stone_receiver_validator = Receiver_validator
CreateDeliveryArg._stone_pickupAddress_validator = bv.Nullable(Address_validator)
CreateDeliveryArg._stone_dropOffAddress_validator = bv.Nullable(Address_validator)
CreateDeliveryArg._stone_notes_validator = bv.Nullable(bv.String())
CreateDeliveryArg._stone_cod_validator = bv.Nullable(bv.Float32())
CreateDeliveryArg._stone_type_validator = bv.Int32()
CreateDeliveryArg._stone_isSameDay_validator = bv.Nullable(bv.Boolean())
CreateDeliveryArg._stone_businessReference_validator = bv.Nullable(bv.String())
CreateDeliveryArg._stone_webhookUrl_validator = bv.Nullable(bv.String())
CreateDeliveryArg._all_field_names_ = set([
    'receiver',
    'pickupAddress',
    'dropOffAddress',
    'notes',
    'cod',
    'type',
    'isSameDay',
    'businessReference',
    'webhookUrl',
])
CreateDeliveryArg._all_fields_ = [
    ('receiver', CreateDeliveryArg._stone_receiver_validator),
    ('pickupAddress', CreateDeliveryArg._stone_pickupAddress_validator),
    ('dropOffAddress', CreateDeliveryArg._stone_dropOffAddress_validator),
    ('notes', CreateDeliveryArg._stone_notes_validator),
    ('cod', CreateDeliveryArg._stone_cod_validator),
    ('type', CreateDeliveryArg._stone_type_validator),
    ('isSameDay', CreateDeliveryArg._stone_isSameDay_validator),
    ('businessReference', CreateDeliveryArg._stone_businessReference_validator),
    ('webhookUrl', CreateDeliveryArg._stone_webhookUrl_validator),
]

CreateDeliveryResult._stone__id_validator = bv.String()
CreateDeliveryResult._stone_message_validator = bv.String()
CreateDeliveryResult._stone_state_validator = State_validator
CreateDeliveryResult._all_field_names_ = set([
    '_id',
    'message',
    'state',
])
CreateDeliveryResult._all_fields_ = [
    ('_id', CreateDeliveryResult._stone__id_validator),
    ('message', CreateDeliveryResult._stone_message_validator),
    ('state', CreateDeliveryResult._stone_state_validator),
]

DeleteDeliveryArg._stone__id_validator = bv.String()
DeleteDeliveryArg._all_field_names_ = set(['_id'])
DeleteDeliveryArg._all_fields_ = [('_id', DeleteDeliveryArg._stone__id_validator)]

DeleteDeliveryResult._stone__id_validator = bv.String()
DeleteDeliveryResult._stone_message_validator = bv.String()
DeleteDeliveryResult._all_field_names_ = set([
    '_id',
    'message',
])
DeleteDeliveryResult._all_fields_ = [
    ('_id', DeleteDeliveryResult._stone__id_validator),
    ('message', DeleteDeliveryResult._stone_message_validator),
]

Delivery._stone__id_validator = bv.String()
Delivery._stone_pickupAddress_validator = ResultAddress_validator
Delivery._stone_dropOffAddress_validator = ResultAddress_validator
Delivery._stone_receiver_validator = Receiver_validator
Delivery._stone_state_validator = State_validator
Delivery._stone_trackingNumber_validator = bv.String()
Delivery._stone_notes_validator = bv.Nullable(bv.String())
Delivery._stone_cod_validator = bv.Nullable(bv.Float32())
Delivery._stone_businessReference_validator = bv.Nullable(bv.String())
Delivery._stone_type_validator = bv.Nullable(Type_validator)
Delivery._all_field_names_ = set([
    '_id',
    'pickupAddress',
    'dropOffAddress',
    'receiver',
    'state',
    'trackingNumber',
    'notes',
    'cod',
    'businessReference',
    'type',
])
Delivery._all_fields_ = [
    ('_id', Delivery._stone__id_validator),
    ('pickupAddress', Delivery._stone_pickupAddress_validator),
    ('dropOffAddress', Delivery._stone_dropOffAddress_validator),
    ('receiver', Delivery._stone_receiver_validator),
    ('state', Delivery._stone_state_validator),
    ('trackingNumber', Delivery._stone_trackingNumber_validator),
    ('notes', Delivery._stone_notes_validator),
    ('cod', Delivery._stone_cod_validator),
    ('businessReference', Delivery._stone_businessReference_validator),
    ('type', Delivery._stone_type_validator),
]

Error._stone_code_validator = bv.Int32()
Error._stone_message_validator = bv.String()
Error._all_field_names_ = set([
    'code',
    'message',
])
Error._all_fields_ = [
    ('code', Error._stone_code_validator),
    ('message', Error._stone_message_validator),
]

GeoLocation._stone_latitude_validator = bv.Float32()
GeoLocation._stone_longitude_validator = bv.Float32()
GeoLocation._all_field_names_ = set([
    'latitude',
    'longitude',
])
GeoLocation._all_fields_ = [
    ('latitude', GeoLocation._stone_latitude_validator),
    ('longitude', GeoLocation._stone_longitude_validator),
]

GetDeliveryArg._stone__id_validator = bv.String()
GetDeliveryArg._all_field_names_ = set(['_id'])
GetDeliveryArg._all_fields_ = [('_id', GetDeliveryArg._stone__id_validator)]

GetDeliveryResult._stone_delivery_validator = Delivery_validator
GetDeliveryResult._all_field_names_ = set(['delivery'])
GetDeliveryResult._all_fields_ = [('delivery', GetDeliveryResult._stone_delivery_validator)]

ListDeliveryArg._stone_page_validator = bv.Nullable(bv.Int32())
ListDeliveryArg._stone_perPage_validator = bv.Nullable(bv.Int32())
ListDeliveryArg._all_field_names_ = set([
    'page',
    'perPage',
])
ListDeliveryArg._all_fields_ = [
    ('page', ListDeliveryArg._stone_page_validator),
    ('perPage', ListDeliveryArg._stone_perPage_validator),
]

ListDeliveryResult._stone_deliveries_validator = bv.List(Delivery_validator)
ListDeliveryResult._all_field_names_ = set(['deliveries'])
ListDeliveryResult._all_fields_ = [('deliveries', ListDeliveryResult._stone_deliveries_validator)]

Receiver._stone_firstName_validator = bv.String()
Receiver._stone_lastName_validator = bv.String()
Receiver._stone_phone_validator = bv.String()
Receiver._stone_email_validator = bv.Nullable(bv.String())
Receiver._all_field_names_ = set([
    'firstName',
    'lastName',
    'phone',
    'email',
])
Receiver._all_fields_ = [
    ('firstName', Receiver._stone_firstName_validator),
    ('lastName', Receiver._stone_lastName_validator),
    ('phone', Receiver._stone_phone_validator),
    ('email', Receiver._stone_email_validator),
]

RequestError._stone_errors_validator = bv.List(Error_validator)
RequestError._all_field_names_ = set(['errors'])
RequestError._all_fields_ = [('errors', RequestError._stone_errors_validator)]

ResultAddress._stone_geoLocation_validator = bv.Nullable(GeoLocation_validator)
ResultAddress._stone_city_validator = bv.Nullable(City_validator)
ResultAddress._all_field_names_ = BaseAddress._all_field_names_.union(set([
    'geoLocation',
    'city',
]))
ResultAddress._all_fields_ = BaseAddress._all_fields_ + [
    ('geoLocation', ResultAddress._stone_geoLocation_validator),
    ('city', ResultAddress._stone_city_validator),
]

State._stone_value_validator = bv.String()
State._stone_code_validator = bv.Int32()
State._all_field_names_ = set([
    'value',
    'code',
])
State._all_fields_ = [
    ('value', State._stone_value_validator),
    ('code', State._stone_code_validator),
]

Type._stone_value_validator = bv.String()
Type._stone_code_validator = bv.Int32()
Type._all_field_names_ = set([
    'value',
    'code',
])
Type._all_fields_ = [
    ('value', Type._stone_value_validator),
    ('code', Type._stone_code_validator),
]

UpdateDeliveryArg._stone__id_validator = bv.String()
UpdateDeliveryArg._stone_receiver_validator = bv.Nullable(Receiver_validator)
UpdateDeliveryArg._stone_pickupAddress_validator = bv.Nullable(Address_validator)
UpdateDeliveryArg._stone_dropOffAddress_validator = bv.Nullable(Address_validator)
UpdateDeliveryArg._stone_notes_validator = bv.Nullable(bv.String())
UpdateDeliveryArg._stone_cod_validator = bv.Nullable(bv.Int32())
UpdateDeliveryArg._stone_businessReference_validator = bv.Nullable(bv.String())
UpdateDeliveryArg._stone_webhookUrl_validator = bv.Nullable(bv.String())
UpdateDeliveryArg._all_field_names_ = set([
    '_id',
    'receiver',
    'pickupAddress',
    'dropOffAddress',
    'notes',
    'cod',
    'businessReference',
    'webhookUrl',
])
UpdateDeliveryArg._all_fields_ = [
    ('_id', UpdateDeliveryArg._stone__id_validator),
    ('receiver', UpdateDeliveryArg._stone_receiver_validator),
    ('pickupAddress', UpdateDeliveryArg._stone_pickupAddress_validator),
    ('dropOffAddress', UpdateDeliveryArg._stone_dropOffAddress_validator),
    ('notes', UpdateDeliveryArg._stone_notes_validator),
    ('cod', UpdateDeliveryArg._stone_cod_validator),
    ('businessReference', UpdateDeliveryArg._stone_businessReference_validator),
    ('webhookUrl', UpdateDeliveryArg._stone_webhookUrl_validator),
]

UpdateDeliveryResult._stone__id_validator = bv.String()
UpdateDeliveryResult._stone_message_validator = bv.String()
UpdateDeliveryResult._all_field_names_ = set([
    '_id',
    'message',
])
UpdateDeliveryResult._all_fields_ = [
    ('_id', UpdateDeliveryResult._stone__id_validator),
    ('message', UpdateDeliveryResult._stone_message_validator),
]

create = bb.Route(
    'create',
    False,
    CreateDeliveryArg_validator,
    CreateDeliveryResult_validator,
    RequestError_validator,
    {'url_param': None,
     'query_params': None,
     'has_body': True},
)
delete = bb.Route(
    'delete',
    False,
    DeleteDeliveryArg_validator,
    DeleteDeliveryResult_validator,
    RequestError_validator,
    {'url_param': '_id',
     'query_params': None,
     'has_body': False},
)
get = bb.Route(
    'get',
    False,
    GetDeliveryArg_validator,
    GetDeliveryResult_validator,
    RequestError_validator,
    {'url_param': '_id',
     'query_params': None,
     'has_body': False},
)
list = bb.Route(
    'list',
    False,
    ListDeliveryArg_validator,
    ListDeliveryResult_validator,
    RequestError_validator,
    {'url_param': None,
     'query_params': 'page, perPage',
     'has_body': False},
)
update = bb.Route(
    'update',
    False,
    UpdateDeliveryArg_validator,
    UpdateDeliveryResult_validator,
    RequestError_validator,
    {'url_param': '_id',
     'query_params': None,
     'has_body': True},
)

ROUTES = {
    'create': create,
    'delete': delete,
    'get': get,
    'list': list,
    'update': update,
}

