"""Profile schema.""" from enum import Enum from marshmallow import fields, Schema from marshmallow.validate import Length, OneOf from marshmallow_enum import EnumField from users import constants class ProfileType(Enum): """Profile type enum.""" ArtistProfile = 'ArtistProfile' AudienceProfile = 'AudienceProfile' CollaboratorsProfile = 'CollaboratorsProfile' ContentProfile = 'ContentProfile' DistributionProfile = 'DistributionProfile' LabelProfile = 'LabelProfile' PodcastProfile = 'PodcastProfile' InsightsProfile = 'InsightsProfile' OrchAdminProfile = 'OrchAdminProfile' DistroDevProfile = 'DistroDevProfile' AbacusProfile = 'AbacusProfile' PublishingProfile = 'PublishingProfile' MoneyhubProfile = 'MoneyhubProfile' SettingsProfile = 'SettingsProfile' SongwhipProfile = 'SongwhipProfile' DocumentsProfile = 'DocumentsProfile' Account360Profile = 'Account360Profile' class Profile(Schema): """Profile schema. Properties: - orchard_identity_id (str): auth0 id - profile_id (int): the id for this profile - LabelProfile = vend_contact_id - ArtistProfile = auto-id - profile_name (str): name for the profile - first_name (str): first name. - last_name (str): last name. - profile_type (str): the type of profile (e.g. 'ArtistProfile', 'LabelProfile') - roles (list): list of role strings """ orchard_identity_id = fields.String(required=True, validate=Length(min=22, max=36)) profile_id = fields.Integer() profile_name = fields.String(required=True) uuid = fields.String(required=False) first_name = fields.String(required=False) last_name = fields.String(required=False) profile_type = EnumField(ProfileType, required=True) brand = fields.String(validate=OneOf(constants.BRAND_TYPES), required=False) roles = fields.List( fields.String(validate=OneOf(constants.PROFILE_ROLE_TYPES)), required=True, validate=Length(min=1), )