# Path: roulier/api.py
# class ApiParcel(BaseApi):
#     """Define expected fields of carriers.
# 
#     This class should be overriden by each carrier.
#     """
# 
#     def _address(self):
#         return {
#             "company": {"type": "string", "default": ""},
#             "name": {"type": "string", "default": "", "required": True, "empty": False},
#             "street1": {"type": "string", "default": ""},
#             "street2": {"type": "string", "default": ""},
#             "country": {"type": "string", "default": ""},
#             # , 'description': 'ISO 3166-1 alpha-2 '},
#             "city": {"type": "string", "default": ""},
#             "zip": {"type": "string", "default": ""},
#             "phone": {"type": "string", "default": ""},
#             "email": {"type": "string", "default": ""},
#         }
# 
#     def _from_address(self):
#         address = self._address()
#         return address
# 
#     def _to_address(self):
#         address = self._address()
#         address["street1"].update({"required": True, "empty": False})
#         address["country"].update({"required": True, "empty": False})
#         address["city"].update({"required": True, "empty": False})
#         address["zip"].update({"required": True, "empty": False})
#         return address
# 
#     def _parcel(self):
#         return {
#             "weight": {
#                 "type": "float",
#                 "default": "",
#                 "required": True,
#                 "empty": False,
#             },
#             # reference of parcel in external app
#             # This ref should be attached to the label in roulier response so the
#             # external app is able to link a label file/tracking ref to the corresponding
#             # parcel.
#             "reference": {"type": "string"},
#         }
#         # 'description': 'Weight in kg',
# 
#     def _parcels(self):
#         return {
#             "type": "list",
#             "schema": {"schema": self._parcel(), "type": "dict"},
#         }
# 
#     def _service(self):
#         return {
#             "product": {"default": ""},
#             "agencyId": {"default": ""},
#             "customerId": {"default": ""},
#             "shippingId": {"default": ""},
#             # 'description': 'When the carrier has the package. Format: YYYY/MM/DD'
#             "shippingDate": {"type": "date", "required": True, "empty": False,},
#             # 'description': 'Additionnal info visible by the client. Example : order number'
#             "reference1": {"type": "string", "default": ""},
#             "reference2": {"type": "string", "default": ""},
#             "reference3": {"type": "string", "default": ""},
#             # 'description': 'Format of output (usually pdf or zpl)'
#             "labelFormat": {"default": ""},
#             # 'description': 'Additionnal instructions for delivery',
#             "instructions": {"default": ""},
#         }
# 
#     def _schemas(self):
#         return {
#             "service": self._service(),
#             "auth": self._auth(),
#             "parcels": self._parcels(),
#             "from_address": self._from_address(),
#             "to_address": self._to_address(),
#         }
# 
# Path: roulier/carriers/gls_fr/rest/constants.py
# SERVICE_CHOICES = {
#     SERVICE_STANDARD,
#     SERVICE_FDS,
#     SERVICE_SHD,
#     SERVICE_SRS,
#     SERVICE_PandS,
#     SERVICE_PandR,
# }
# 
# Path: roulier/carriers/gls_fr/rest/constants.py
# SERVICE_STANDARD = "Standard"


from roulier.api import ApiParcel
from .constants import SERVICE_CHOICES
from .constants import SERVICE_STANDARD
        schema.update(
            {
                "id": {"type": "string", "minlength": 0, "maxlength": 20},
                "street2": string_0_35,
                "street3": string_0_35,
                "blockNo1": string_1_10,
                "province": string_2_35,
                "contact": string_2_35,
                "mobile": schema["phone"],
            }
        )
        return schema

    def _opt_schema(self, schema):
        return {
            "type": "dict",
            "required": False,
            "schema": schema,
        }

    def _parcel(self):
        schema = super()._parcel()
        schema.update(
            {
                "services": {
                    "type": "list",
                    "schema": {
                        "schema": {
                            "product": {
                                "type": "string",

# Path: roulier/api.py
# class ApiParcel(BaseApi):
#     """Define expected fields of carriers.
# 
#     This class should be overriden by each carrier.
#     """
# 
#     def _address(self):
#         return {
#             "company": {"type": "string", "default": ""},
#             "name": {"type": "string", "default": "", "required": True, "empty": False},
#             "street1": {"type": "string", "default": ""},
#             "street2": {"type": "string", "default": ""},
#             "country": {"type": "string", "default": ""},
#             # , 'description': 'ISO 3166-1 alpha-2 '},
#             "city": {"type": "string", "default": ""},
#             "zip": {"type": "string", "default": ""},
#             "phone": {"type": "string", "default": ""},
#             "email": {"type": "string", "default": ""},
#         }
# 
#     def _from_address(self):
#         address = self._address()
#         return address
# 
#     def _to_address(self):
#         address = self._address()
#         address["street1"].update({"required": True, "empty": False})
#         address["country"].update({"required": True, "empty": False})
#         address["city"].update({"required": True, "empty": False})
#         address["zip"].update({"required": True, "empty": False})
#         return address
# 
#     def _parcel(self):
#         return {
#             "weight": {
#                 "type": "float",
#                 "default": "",
#                 "required": True,
#                 "empty": False,
#             },
#             # reference of parcel in external app
#             # This ref should be attached to the label in roulier response so the
#             # external app is able to link a label file/tracking ref to the corresponding
#             # parcel.
#             "reference": {"type": "string"},
#         }
#         # 'description': 'Weight in kg',
# 
#     def _parcels(self):
#         return {
#             "type": "list",
#             "schema": {"schema": self._parcel(), "type": "dict"},
#         }
# 
#     def _service(self):
#         return {
#             "product": {"default": ""},
#             "agencyId": {"default": ""},
#             "customerId": {"default": ""},
#             "shippingId": {"default": ""},
#             # 'description': 'When the carrier has the package. Format: YYYY/MM/DD'
#             "shippingDate": {"type": "date", "required": True, "empty": False,},
#             # 'description': 'Additionnal info visible by the client. Example : order number'
#             "reference1": {"type": "string", "default": ""},
#             "reference2": {"type": "string", "default": ""},
#             "reference3": {"type": "string", "default": ""},
#             # 'description': 'Format of output (usually pdf or zpl)'
#             "labelFormat": {"default": ""},
#             # 'description': 'Additionnal instructions for delivery',
#             "instructions": {"default": ""},
#         }
# 
#     def _schemas(self):
#         return {
#             "service": self._service(),
#             "auth": self._auth(),
#             "parcels": self._parcels(),
#             "from_address": self._from_address(),
#             "to_address": self._to_address(),
#         }
# 
# Path: roulier/carriers/gls_fr/rest/constants.py
# SERVICE_CHOICES = {
#     SERVICE_STANDARD,
#     SERVICE_FDS,
#     SERVICE_SHD,
#     SERVICE_SRS,
#     SERVICE_PandS,
#     SERVICE_PandR,
# }
# 
# Path: roulier/carriers/gls_fr/rest/constants.py
# SERVICE_STANDARD = "Standard"


# Path: roulier/carriers/gls_fr/rest/api.py
from roulier.api import ApiParcel
from .constants import SERVICE_CHOICES
from .constants import SERVICE_STANDARD

        schema.update(
            {
                "id": {"type": "string", "minlength": 0, "maxlength": 20},
                "street2": string_0_35,
                "street3": string_0_35,
                "blockNo1": string_1_10,
                "province": string_2_35,
                "contact": string_2_35,
                "mobile": schema["phone"],
            }
        )
        return schema

    def _opt_schema(self, schema):
        return {
            "type": "dict",
            "required": False,
            "schema": schema,
        }

    def _parcel(self):
        schema = super()._parcel()
        schema.update(
            {
                "services": {
                    "type": "list",
                    "schema": {
                        "schema": {
                            "product": {
                                "type": "string",

                                "allowed": tuple(SERVICE_CHOICES),