{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "https://docs.vega.space/schemas/forwarded-pass.schema.json",
	"title": "Vega forwarded pass",
	"description": "The `pass` object of POST /api/v1/frontend/organizations/{organization_id}/forwarded_passes. See https://docs.vega.space/api-reference/sending-passes",
	"type": "object",
	"required": ["station", "frequency_hz", "bandwidth_hz"],
	"anyOf": [
		{
			"required": ["norad_id"]
		},
		{
			"required": ["satellite_name"]
		}
	],
	"allOf": [
		{
			"anyOf": [
				{
					"required": ["measurements"]
				},
				{
					"required": ["waterfall_png_base64", "start", "end"]
				}
			]
		},
		{
			"dependentRequired": {
				"start": ["end"],
				"end": ["start"]
			}
		}
	],
	"properties": {
		"id": {
			"type": "string",
			"description": "Your own pass id. Repeats are idempotent."
		},
		"norad_id": {
			"type": "integer",
			"minimum": 1,
			"description": "The satellite's NORAD catalog number."
		},
		"satellite_name": {
			"type": "string",
			"description": "The satellite's name, as Vega lists it. Use norad_id when two satellites share a name."
		},
		"station": {
			"type": "object",
			"description": "A station Vega already has for your organization, by id or name. Coordinates are refused.",
			"properties": {
				"id": {
					"type": "integer",
					"minimum": 1
				},
				"name": {
					"type": "string"
				}
			},
			"anyOf": [
				{
					"required": ["id"]
				},
				{
					"required": ["name"]
				}
			],
			"additionalProperties": false
		},
		"start": {
			"type": "string",
			"format": "date-time",
			"description": "Optional contact start. Without start and end, Vega uses the satellite's pass over the station that holds the measurements."
		},
		"end": {
			"type": "string",
			"format": "date-time",
			"description": "Optional contact end; sent together with start."
		},
		"frequency_hz": {
			"type": "number",
			"exclusiveMinimum": 0,
			"description": "Downlink centre frequency, Hz."
		},
		"bandwidth_hz": {
			"type": "number",
			"exclusiveMinimum": 0,
			"description": "Receive bandwidth, Hz."
		},
		"modulation": {
			"type": "string",
			"examples": ["BPSK", "QPSK", "8PSK", "16APSK", "FSK", "GFSK", "GMSK"]
		},
		"symbol_rate_baud": {
			"type": "number",
			"exclusiveMinimum": 0
		},
		"bits_per_symbol": {
			"type": "number",
			"exclusiveMinimum": 0
		},
		"fec_code_rate": {
			"oneOf": [
				{
					"type": "string",
					"pattern": "^\\s*\\d+\\s*/\\s*\\d+\\s*$"
				},
				{
					"type": "number",
					"exclusiveMinimum": 0,
					"maximum": 1
				}
			]
		},
		"rolloff": {
			"type": "number",
			"minimum": 0,
			"maximum": 1
		},
		"eirp_dbw": {
			"type": "number"
		},
		"polarization": {
			"type": "string",
			"enum": [
				"linear",
				"horizontal",
				"vertical",
				"rhcp",
				"lhcp",
				"LINEAR",
				"HORIZONTAL",
				"VERTICAL",
				"RHCP",
				"LHCP"
			]
		},
		"noise_bandwidth_hz": {
			"type": "number",
			"exclusiveMinimum": 0,
			"description": "Bandwidth the SNR or noise floor is measured over; defaults to bandwidth_hz."
		},
		"noise_floor_dbm": {
			"type": "number"
		},
		"interval_s": {
			"type": "number",
			"exclusiveMinimum": 0,
			"default": 1
		},
		"uncertainty_db": {
			"type": "number",
			"minimum": 0
		},
		"calibration": {
			"type": "string"
		},
		"measurements": {
			"type": "array",
			"minItems": 1,
			"items": {
				"oneOf": [
					{
						"type": "object",
						"required": ["t", "es_n0_db"],
						"properties": {
							"t": {
								"type": "string",
								"format": "date-time"
							},
							"es_n0_db": {
								"type": "number",
								"description": "Es/N0, dB."
							},
							"uncertainty_db": {
								"type": "number",
								"minimum": 0
							}
						},
						"additionalProperties": false
					},
					{
						"type": "object",
						"required": ["t", "eb_n0_db"],
						"properties": {
							"t": {
								"type": "string",
								"format": "date-time"
							},
							"eb_n0_db": {
								"type": "number",
								"description": "Eb/N0, dB. Needs bits_per_symbol or modulation; fec_code_rate if coded."
							},
							"uncertainty_db": {
								"type": "number",
								"minimum": 0
							}
						},
						"additionalProperties": false
					},
					{
						"type": "object",
						"required": ["t", "c_n0_dbhz"],
						"properties": {
							"t": {
								"type": "string",
								"format": "date-time"
							},
							"c_n0_dbhz": {
								"type": "number",
								"description": "C/N0, dB-Hz. Needs symbol_rate_baud."
							},
							"uncertainty_db": {
								"type": "number",
								"minimum": 0
							}
						},
						"additionalProperties": false
					},
					{
						"type": "object",
						"required": ["t", "snr_db"],
						"properties": {
							"t": {
								"type": "string",
								"format": "date-time"
							},
							"snr_db": {
								"type": "number",
								"description": "SNR, dB over noise_bandwidth_hz. Needs symbol_rate_baud."
							},
							"uncertainty_db": {
								"type": "number",
								"minimum": 0
							}
						},
						"additionalProperties": false
					},
					{
						"type": "object",
						"required": ["t", "rssi_dbm"],
						"properties": {
							"t": {
								"type": "string",
								"format": "date-time"
							},
							"rssi_dbm": {
								"type": "number",
								"description": "Received power, dBm. Needs symbol_rate_baud and noise_floor_dbm."
							},
							"uncertainty_db": {
								"type": "number",
								"minimum": 0
							}
						},
						"additionalProperties": false
					}
				]
			}
		},
		"waterfall_png_base64": {
			"type": "string",
			"contentEncoding": "base64",
			"contentMediaType": "image/png"
		},
		"provider": {
			"type": "object",
			"description": "Anything your provider reported, kept as sent."
		},
		"transmitter": {
			"type": "object",
			"deprecated": true,
			"properties": {
				"mode": {
					"type": "string"
				},
				"baud": {
					"type": "number",
					"exclusiveMinimum": 0
				}
			}
		}
	},
	"additionalProperties": false
}
