{
	"$schema":"https://json-schema.org/draft/2020-12/schema",
	"$id":"http://www.itu.int/schema/video-slice-info-list",
	"description":"Structure definition of video slice list",	
	"type":"array",
	"items":{
		"$ref":"#/$defs/videoSliceInfo"
	},
	"$defs":{
		"videoSliceInfo":{
			"type":"object",
			"description":"Video slice object content definition",
			"properties" : {
				"VideoID":{
					"description":"Tollgate ID",
					"$ref":"/schema/components#/$defs/basicObjectId"
				},
				"InfoKind":{
					"$ref":"/schema/components#/$defs/infoKind"
				},
				"VideoSourcePos":{
					"description":"Video capture part, key public area part, A\\d{6}",
					"type":"string",
					"deprecated":true
				},
				"IsAbstractVideo":{
					"description":"Abstract video flag, true: abstract video; false: original video",
					"type":"boolean"
				},
				"EventSort":{
					"description":"Video image content analysis event type. 01: car passing; 02: cars tripping wires; 03: cars intruding; 04: cars wandering; 05: cars and objects disappear; 06: vehicles in violation of traffic regulations; 07: objects left behind; 08: cars are stranded; 99: Others",
					"enum":["01","02","03","04","05","06","07","08","99"]
				},
				"DeviceID": {
					"description": " Acquisition device code",
					"$ref": "/schema/components#/$defs/deviceID"
				},
				"StoragePath":{
					"description":"Storage path",
					"$ref":"/schema/components#/$defs/storagePath"
				},
				"ThumbnailStoragePath":{
					"description":"Thumbnail storage path",
					"$ref":"/schema/components#/$defs/storagePath"
				},
				"FileHash":{
					"description":"Video slice hash",
					"type:":"string",
					"oneOf":[
						{	"maxLength":128,	"minLength":128	   },
						{	"maxLength":256,	"minLength":256	   }]
				},
				"FileFormat":{
					"description":"Video format. Mpg:MPEG-1 MPG;M2ts:MPEG-2 TS;Ps:MPEG-2 PS",
					 "enum":["Mpg","Mov","Avi","Rm","Rmvb","Flv","Vob","M2ts","Mp4","Es","Ps","Ts","Wmv","Other"]
				},
				"VideoEncodeFormat":{
					"description":"coding format. 01:AVC/H.264;02:MPEG-4;03:MPEG-2;04:MJPEG;05:H.263;06:HEVC/H.265; 99:Other",
					"enum":["01","02","03","04","05","06","99"]
				},
				"AudioFlag":{
					"description":"Audio flag",
					"$ref":"/schema/components#/$defs/flag"
				},
				"AudioEncodeFormat":{
					"description":"Audio coding format. 01:G.711a;02:G.711u;03:G.723;04:G.729;05:G.726;06:AAC ;99:other",
					"enum":["01","02","03","04","05","06","99"]
				},
				"Title":{
					"description":"Video title description",
					"type":"string"
				},
				"TitleNote":{
					"description":"Title supplements and remarks",
					"type":"string"
				},
				"SpecialName":{
					"description":"Name of the subject to which the video belongs",
					"type":"string"
				},
				"Keyword":{
					"description":"Words or phrases with retrieval significance that express the main content of video material",
					"type":"string"
				},
				"ContentDescription":{
					"description":"Brief description of video content.",
					"type":"string"
				},
				"ShotPlaceCode":{
					"description":"Shooting location area code",
					"$ref":"/schema/ape-list#/$defs/ape/properties/PlaceCode"
				},
				"ShotPlaceFullAdress":{
					"$ref":"/schema/ape-list#/$defs/ape/properties/Place"
				},
				"ShotPlaceLongitude":{
					"$ref":"/schema/ape-list#/$defs/ape/properties/Longitude"
				},
				"ShoPlacetLatitude":{
					"$ref":"/schema/ape-list#/$defs/ape/properties/Latitude"
				},
				"HorizontalShotDirection":{
					"description":"Horizontal shooting direction",
					"$ref":"/schema/components#/$defs/hDirection"
				},
				"VerticalShotDirection":{
					"description":"Vertical shooting direction",
					"$ref":"/schema/components#/$defs/vDirection"
				},
				"SecurityLevel":{
					"$ref":"/schema/components#/$defs/securityLevel"
				},
				"VideoLen":{
					"description":"Duration of video slice, in seconds.",
					"type":"number",
					"format":"long",
					"minimum":1,
					"maximum":99999999
				},
				"BeginTime":{
					"description":"Video start time",
					"type":"string",
					"format":"dateTime"
				},
				"EndTime":{
					"description":"Video end time",
					"type":"string",
					"format":"dateTime"
				},
				"TimeErr":{
					"description":"Time error, in seconds",
					"type":"integer"
				},
				"Width":{
					"description":"Width in pixels",
					"type":"integer"
				},
				"Height":{
					"description":"Height in pixels",
					"type":"integer"
				},
				"QualityGrade":{
					"description":"Video quality level. 1: worst; 2: bad; 3: normal; 4: fine; 5: best",
					"enum":[1,2,3,4,5]
				},
				"CollectorName":{
					"description":"The name of the person who collected the video data or the name of the acquisition  system/platform",
					"type":"string"
				},
				"CollectorOrg":{
					"description":"The name of the video acquisition unit",
					"type":"string"
				},
				"CollectorPhone":{
					"description":"Contact number of the person who collected the video.",
					"type":"string"
				},
				"EntryClrk":{
					"description":"The name of the entry person of the video or the name of the entry system",
					"type":"string"
				},
				"EntryClrkOrg":{
					"description":"The name of storage unit of video materials",
					"type":"string"
				},
				"EntryTime":{
					"description":"Entry time, this attribute is not needed in the POST method, it is automatically generated when creating",
					"type":"string",
					"format":"dateTime"
				},
				"VideoProcFlag": {
					"description": "Video processing flag",
					"$ref": "/schema/components#/$defs/flag"
				},
				"FileSize":{
					"description":"Video slice size, in bytes",
					"type":"number",
					"format":"long"
				},
				"FileData":{
					"$ref":"/schema/components#/$defs/binary"
				}
			},
			
			"required":["InfoKind","VideoSourcePos","FileFormat","VideoEncodeFormat","AudioFlag","Title","ContentDescription","ShotPlaceCode","ShotPlaceFullAdress","VideoLen","BeginTime","EndTime","TimeErr","Width","Height"],
			
			"allOf":[
			{
				"if":{
					"properties":{	"IsAbstractVideo":true	}
				},
				"then":{
					"properties":{
						"anyOf":[{
							"OriginVideoID":{
								"description":"Original video ID",
								"$ref":"/schema/components#/$defs/basicObjectId"
							}
						},{
							"OriginVideoURL":{
								"description":"Original video URL",
								"$ref":"/schema/components#/$defs/storagePath"
							}
						}]
					}
				}			
			},
			{
				"if":{
					"properties":{	"InfoKind":1	}
				},
				"then":{
					"required":["EventSort"]
				}
			},
			{
				"if":{
					"properties":{	"InfoKind":2	}
				},
				"then":{
					"required":["VideoID","CollectorName","CollectorOrg","EntryClrk","EntryClrkOrg"]
				}
			}
			]
			
		}
	}
}
