from marshmallow import Schema, fields class ChartRankingsAggregatedValuesDataloaded: """Response schema for getting /chart-rankings/aggregated-values-dataloaded/ API""" class Request(Schema): class NestedItem(Schema): chart_id = fields.UUID(required=True) public_sound_recording_id = fields.UUID(required=True, allow_none=True) chartmetric_track_id = fields.String(required=True, allow_none=True) public_product_id = fields.UUID(required=True, allow_none=True) chart_rankings_aggregated = fields.Nested(NestedItem, many=True) class Response(Schema): class NestedResponseItem(Schema): chartId = fields.UUID() publicSoundRecordingId = fields.UUID(allow_none=True) trackId = fields.String(allow_none=True) publicProductId = fields.UUID(allow_none=True) peakTimestamp = fields.String() peakDate = fields.Date() peakPosition = fields.Integer() appearances = fields.Integer() isrc = fields.String(allow_none=True) firstDate = fields.Date() firstPosition = fields.Integer() mostRecentDate = fields.Date() mostRecentPosition = fields.Integer() previousDate = fields.Date(allow_none=True) previousPosition = fields.Integer(allow_none=True) data = fields.Nested(NestedResponseItem, required=True)