{"openapi":"3.0.3","info":{"title":"Ad Marker Core API","version":"1.0.0","description":"OpenAPI specification for Ad Marker Core API."},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/asdasdasd-bee/Test/1.0.0"},{"url":"/"}],"paths":{"/dash/ad-schedules":{"post":{"tags":["Ad Schedules"],"summary":"Create ad schedule","description":"Create an ad schedule period and its schedule slots for a channel.","operationId":"postDashAdSchedules","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdSchedulePayload"},"examples":{"default":{"value":{"channel":{"xid":"ABC123"},"startDate":"2026-03-01","endDate":"2026-03-30","schedules":[{"slotTime":"10:00:00","duration":"00:00:30","adName":"Ads A","adDescription":"Ads description"},{"slotTime":"13:30:00","duration":"00:00:45","adName":"Ads B","adDescription":null}]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdScheduleResponse"},"examples":{"default":{"value":{"success":true,"code":"OK","message":"Success","data":{"xid":"CO5AZJ","channel":{"xid":"ABC123","name":"TV One"},"startDate":"2026-03-01","endDate":"2026-03-30","schedules":[{"slotTime":"10:00:00","duration":"00:00:30","adName":"Ads A","adDescription":"Ads description","hash":"d4ec7b93f15e7f4897e1f0a6cb76bd96fdff6754e162f98f90db8fbc0dc88d8f"},{"slotTime":"13:30:00","duration":"00:00:45","adName":"Ads B","adDescription":null,"hash":"a2962cb4e1284d2041861f8853b58ee67c0e7e36f3ced0745e004bce0d3d4e8d"}]}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"badRequest":{"summary":"Invalid request body or validation failed","value":{"success":false,"code":"400","message":"Bad Request","data":null}},"resourceNotFound":{"summary":"Channel not found","value":{"success":false,"code":"ad-marker-core:E_COMM_1","message":"Resource not found","data":null}},"duplicateResource":{"summary":"Duplicate ad schedule period or slot","value":{"success":false,"code":"ad-marker-core:E_COMM_3","message":"Duplicate resource","data":null}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"unauthorized":{"value":{"success":false,"code":"401","message":"Unauthorized","data":null}},"inactiveResource":{"summary":"Inactive session or resource","value":{"success":false,"code":"ad-marker-core:E_AUTH_4","message":"Inactive Resource","data":null}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"forbidden":{"value":{"success":false,"code":"403","message":"Forbidden","data":null}}}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"internalError":{"value":{"success":false,"code":"500","message":"Internal Error","data":null}}}}}}}}},"/dash/ad-schedules/{channelXid}":{"get":{"tags":["Ad Schedules"],"summary":"Get detail ad schedule","description":"Get all ad schedule periods and their schedule slots for a channel.","operationId":"getDashAdScheduleByChannel","security":[{"bearerAuth":[]}],"parameters":[{"name":"channelXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":6},"description":"Channel XID.","example":"ABC123"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAdScheduleResponse"},"examples":{"default":{"value":{"success":true,"code":"OK","message":"Success","data":{"channel":{"xid":"ABC123","name":"TV One"},"periods":[{"xid":"CO5AZJ","startDate":"2026-03-01","endDate":"2026-03-30","schedules":[{"slotTime":"10:00:00","duration":"00:00:30","adName":"Ads A","adDescription":"Ads description","hash":"d4ec7b93f15e7f4897e1f0a6cb76bd96fdff6754e162f98f90db8fbc0dc88d8f"},{"slotTime":"13:30:00","duration":"00:00:45","adName":"Ads B","adDescription":null,"hash":"a2962cb4e1284d2041861f8853b58ee67c0e7e36f3ced0745e004bce0d3d4e8d"}]},{"xid":"DF7LMN","startDate":"2026-04-01","endDate":"2026-04-30","schedules":[{"slotTime":"09:00:00","duration":"00:00:30","adName":"Ads C","adDescription":"Ads C description","hash":"8c5bbfd1d7fd46642f4d397f8b9a26f9a9f5e1630b5c5b14d2fa9db9c3d11111"}]}]}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"resourceNotFound":{"summary":"Channel or ad schedule not found","value":{"success":false,"code":"ad-marker-core:E_COMM_1","message":"Resource not found","data":null}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"unauthorized":{"value":{"success":false,"code":"401","message":"Unauthorized","data":null}},"inactiveResource":{"summary":"Inactive session or resource","value":{"success":false,"code":"ad-marker-core:E_AUTH_4","message":"Inactive Resource","data":null}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"forbidden":{"value":{"success":false,"code":"403","message":"Forbidden","data":null}}}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"internalError":{"value":{"success":false,"code":"500","message":"Internal Error","data":null}}}}}}}}},"/dash/ad-schedules/{channelXid}/period/{channelAdPeriodXid}":{"put":{"tags":["Ad Schedules"],"summary":"Update ad schedule","description":"Update an ad schedule period by replacing all existing schedule slots with the new payload for the specified channel period. Channel is identified from the path parameter.","operationId":"putDashAdSchedulePeriod","security":[{"bearerAuth":[]}],"parameters":[{"name":"channelXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":6},"description":"Channel XID.","example":"ABC123"},{"name":"channelAdPeriodXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":36},"description":"Channel ad period XID.","example":"CO5AZJ"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdSchedulePayload"},"examples":{"default":{"value":{"startDate":"2026-03-01","endDate":"2026-03-30","schedules":[{"slotTime":"10:00:00","duration":"00:00:30","adName":"Ads A","adDescription":"Ads description"},{"slotTime":"13:30:00","duration":"00:00:45","adName":"Ads B","adDescription":null}]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAdScheduleResponse"},"examples":{"default":{"value":{"success":true,"code":"OK","message":"Success","data":{"xid":"CO5AZJ","channel":{"xid":"ABC123","name":"TV One"},"startDate":"2026-03-01","endDate":"2026-03-30","schedules":[{"slotTime":"10:00:00","duration":"00:00:30","adName":"Ads A","adDescription":"Ads description","hash":"d4ec7b93f15e7f4897e1f0a6cb76bd96fdff6754e162f98f90db8fbc0dc88d8f"},{"slotTime":"13:30:00","duration":"00:00:45","adName":"Ads B","adDescription":null,"hash":"a2962cb4e1284d2041861f8853b58ee67c0e7e36f3ced0745e004bce0d3d4e8d"}]}}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"badRequest":{"summary":"Invalid request body or validation failed","value":{"success":false,"code":"400","message":"Bad Request","data":null}},"resourceNotFound":{"summary":"Channel or ad schedule period not found","value":{"success":false,"code":"ad-marker-core:E_COMM_1","message":"Resource not found","data":null}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"unauthorized":{"value":{"success":false,"code":"401","message":"Unauthorized","data":null}},"inactiveResource":{"summary":"Inactive session or resource","value":{"success":false,"code":"ad-marker-core:E_AUTH_4","message":"Inactive Resource","data":null}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"forbidden":{"value":{"success":false,"code":"403","message":"Forbidden","data":null}}}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"internalError":{"value":{"success":false,"code":"500","message":"Internal Error","data":null}}}}}}}},"delete":{"tags":["Ad Schedules"],"summary":"Delete ad schedule period","description":"Delete an ad schedule period and all its associated schedules for a given channel.","operationId":"deleteDashAdSchedulePeriod","security":[{"bearerAuth":[]}],"parameters":[{"name":"channelXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":6},"description":"Channel XID.","example":"ABC123"},{"name":"channelAdPeriodXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":36},"description":"Channel ad period XID.","example":"CO5AZJ"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseSuccessResponse"},"examples":{"default":{"value":{"success":true,"code":"OK","message":"Success","data":null}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"resourceNotFound":{"summary":"Channel or ad schedule period not found","value":{"success":false,"code":"ad-marker-core:E_COMM_1","message":"Resource not found","data":null}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"unauthorized":{"value":{"success":false,"code":"401","message":"Unauthorized","data":null}},"inactiveResource":{"summary":"Inactive session or resource","value":{"success":false,"code":"ad-marker-core:E_AUTH_4","message":"Inactive Resource","data":null}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"forbidden":{"value":{"success":false,"code":"403","message":"Forbidden","data":null}}}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"internalError":{"value":{"success":false,"code":"500","message":"Internal Error","data":null}}}}}}}}},"/dash/ad-schedules/{channelXid}/period/{channelAdPeriodXid}/schedules":{"delete":{"tags":["Ad Schedules"],"summary":"Delete ad schedules","description":"Delete specific ad schedules (slots) based on their hashes for a given channel and period.","operationId":"deleteDashAdSchedules","security":[{"bearerAuth":[]}],"parameters":[{"name":"channelXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":6},"description":"Channel XID.","example":"ABC123"},{"name":"channelAdPeriodXid","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":36},"description":"Channel ad period XID.","example":"CO5AZJ"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAdSchedulesPayload"},"examples":{"default":{"value":{"schedules":[{"hash":"d4ec7b93f15e7f4897e1f0a6cb76bd96fdff6754e162f98f90db8fbc0dc88d8f"},{"hash":"a2962cb4e1284d2041861f8853b58ee67c0e7e36f3ced0745e004bce0d3d4e8d"}]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseSuccessResponse"},"examples":{"default":{"value":{"success":true,"code":"OK","message":"Success","data":null}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"badRequest":{"summary":"Invalid request body or validation failed","value":{"success":false,"code":"400","message":"Bad Request","data":null}},"resourceNotFound":{"summary":"Channel or ad schedule period not found","value":{"success":false,"code":"ad-marker-core:E_COMM_1","message":"Resource not found","data":null}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"unauthorized":{"value":{"success":false,"code":"401","message":"Unauthorized","data":null}},"inactiveResource":{"summary":"Inactive session or resource","value":{"success":false,"code":"ad-marker-core:E_AUTH_4","message":"Inactive Resource","data":null}}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"forbidden":{"value":{"success":false,"code":"403","message":"Forbidden","data":null}}}}}},"500":{"description":"Internal Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"internalError":{"value":{"success":false,"code":"500","message":"Internal Error","data":null}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateAdSchedulePayload":{"type":"object","required":["channel","startDate","endDate","schedules"],"properties":{"channel":{"$ref":"#/components/schemas/CreateAdScheduleChannelPayload"},"startDate":{"type":"string","format":"date","description":"Ad schedule period start date.","example":"2026-03-01"},"endDate":{"type":"string","format":"date","description":"Ad schedule period end date. Must be greater than or equal to startDate.","example":"2026-03-30"},"schedules":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/CreateAdScheduleItemPayload"}}}},"CreateAdScheduleChannelPayload":{"type":"object","required":["xid"],"properties":{"xid":{"type":"string","description":"Channel XID.","minLength":1,"maxLength":6,"example":"ABC123"}}},"CreateAdScheduleItemPayload":{"type":"object","required":["slotTime","duration"],"properties":{"slotTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","description":"Schedule slot time in HH:MM:SS format.","example":"10:00:00"},"duration":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","description":"Ad duration in HH:MM:SS format.","example":"00:00:30"},"adName":{"type":"string","nullable":true,"maxLength":255,"description":"Optional ad name.","example":"Ads A"},"adDescription":{"type":"string","nullable":true,"description":"Optional ad description.","example":"Ads description"}}},"CreateAdScheduleResponse":{"allOf":[{"$ref":"#/components/schemas/BaseSuccessResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AdScheduleResult"}}}]},"UpdateAdSchedulePayload":{"type":"object","required":["startDate","endDate","schedules"],"properties":{"startDate":{"type":"string","format":"date","description":"Ad schedule period start date.","example":"2026-03-01"},"endDate":{"type":"string","format":"date","description":"Ad schedule period end date. Must be greater than or equal to startDate.","example":"2026-03-30"},"schedules":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/CreateAdScheduleItemPayload"}}}},"UpdateAdScheduleResponse":{"allOf":[{"$ref":"#/components/schemas/BaseSuccessResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AdScheduleResult"}}}]},"DeleteAdSchedulesPayload":{"type":"object","required":["schedules"],"properties":{"schedules":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/DeleteAdScheduleItemPayload"}}}},"DeleteAdScheduleItemPayload":{"type":"object","required":["hash"],"properties":{"hash":{"type":"string","description":"SHA-256 hash of the schedule to be deleted.","minLength":64,"maxLength":64}}},"GetAdScheduleResponse":{"allOf":[{"$ref":"#/components/schemas/BaseSuccessResponse"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/GetAdScheduleDetailResult"}}}]},"GetAdScheduleDetailResult":{"type":"object","required":["channel","periods"],"properties":{"channel":{"$ref":"#/components/schemas/AdScheduleChannelResult"},"periods":{"type":"array","items":{"$ref":"#/components/schemas/AdSchedulePeriodResult"}}}},"AdScheduleResult":{"type":"object","required":["xid","channel","startDate","endDate","schedules"],"properties":{"xid":{"type":"string","minLength":1,"maxLength":6,"example":"CO5AZJ"},"channel":{"$ref":"#/components/schemas/AdScheduleChannelResult"},"startDate":{"type":"string","format":"date","example":"2026-03-01"},"endDate":{"type":"string","format":"date","example":"2026-03-30"},"schedules":{"type":"array","items":{"$ref":"#/components/schemas/AdScheduleItemResult"}}}},"AdSchedulePeriodResult":{"type":"object","required":["xid","startDate","endDate","schedules"],"properties":{"xid":{"type":"string","minLength":1,"maxLength":6,"example":"CO5AZJ"},"startDate":{"type":"string","format":"date","example":"2026-03-01"},"endDate":{"type":"string","format":"date","example":"2026-03-30"},"schedules":{"type":"array","items":{"$ref":"#/components/schemas/AdScheduleItemResult"}}}},"AdScheduleChannelResult":{"type":"object","required":["xid","name"],"properties":{"xid":{"type":"string","example":"ch-abc123"},"name":{"type":"string","example":"TV One"}}},"AdScheduleItemResult":{"type":"object","required":["slotTime","duration","hash"],"properties":{"slotTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","example":"10:00:00"},"duration":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$","example":"00:00:30"},"adName":{"type":"string","nullable":true,"example":"Ads A"},"adDescription":{"type":"string","nullable":true,"example":"Ads description"},"hash":{"type":"string","description":"SHA-256 hash of startDate:endDate:slotTime.","minLength":64,"maxLength":64,"example":"d4ec7b93f15e7f4897e1f0a6cb76bd96fdff6754e162f98f90db8fbc0dc88d8f"}}},"BaseSuccessResponse":{"type":"object","required":["success","code","message","data"],"properties":{"success":{"type":"boolean","example":true},"code":{"type":"string","example":"OK"},"message":{"type":"string","example":"Success"},"data":{"nullable":true}}},"ErrorResponse":{"type":"object","required":["success","code","message","data"],"properties":{"success":{"type":"boolean","example":false},"code":{"type":"string","example":"400"},"message":{"type":"string","example":"Bad Request"},"data":{"nullable":true,"example":null}}}}}}