"""Schema to create relationship between a Profile and a Resource.""" from marshmallow import fields from marshmallow.validate import OneOf from permissions.constants import constants from permissions.validations import ma class ResourceToProfileSchema(ma.Schema): """Schema to add a resource access to a Profile. Properties: - resource_type (str): Type of resource. (e.g: 'Vendor', 'ArtistInfo', Subaccount') - resource_id (int): Identifier for that resource. - profile_type (str): the type of profile (e.g. 'ArtistProfile', 'LabelProfile') - profile_id (int): Identifier for that profile. - roles (list): list of role. (e.g: ['marketing', 'analytics']) """ resource_type = fields.Str(validate=OneOf(constants.RESOURCE_TYPES)) resource_id = fields.Str(required=True) profile_type = fields.Str(validate=OneOf(constants.PROFILE_TYPES)) profile_id = fields.Int(required=True) profile_uuid = fields.Str(required=False) roles = fields.List(fields.String(validate=OneOf(constants.PROFILE_ROLE_TYPES)), required=False)