"""Schema for top markets endpoint.""" from marshmallow import fields from analytics.schemas.common import BaseSchema, SourceSchema class TopMarketsItemSchema(BaseSchema): """Marshmallow schema for top markets items section.""" country_code = fields.String(data_key="country_code") orchard_region_name = fields.String(data_key="region") streams_7_days = fields.Integer(data_key="streams") growth_percentage = fields.Float(data_key="growth_percentage") class TopMarketsSchema(BaseSchema): """Marshmallow schema for top markets.""" isrc = fields.String() items = fields.Nested(TopMarketsItemSchema, many=True, data_key="items") sources = fields.Nested(SourceSchema, many=True)