"""User device schema.""" from enum import Enum from marshmallow import fields, Schema from marshmallow.validate import OneOf from marshmallow_enum import EnumField from users import constants class PlatformType(Enum): """Platform type enum.""" ios = 'ios' android = 'android' class DeviceSchema(Schema): """Push notification device schema. Properties: identity_id (str): auth0 id push_token (str): push notification token device_id (str): device id platform_type (str): the type of platform (can be 'android' or 'ios') localization (str): Language set on the device brand (str): App brand ie orchard, awal, sme """ identity_id = fields.String(required=True) push_token = fields.String(required=True) device_id = fields.String(required=False) platform_type = EnumField(PlatformType, required=True) localization = fields.String(required=False) brand = fields.String(validate=OneOf(constants.BRAND_TYPES), default=constants.ORCHARD_BRAND)