var $schema = "../schema.json";
var schemaVersion = "v1";
var pluginType = "grafana-bigquery-datasource";
var pluginName = "Google BigQuery";
var docURL = "https://grafana.com/grafana/plugins/grafana-bigquery-datasource/";
var fields = [
	{
		id: "jsonData.authenticationType",
		key: "authenticationType",
		label: "Authentication type",
		description: "Google Cloud authentication mechanism.",
		valueType: "string",
		target: "jsonData",
		required: true,
		defaultValue: "jwt",
		validations: [
			{
				type: "allowedValues",
				values: [
					"jwt",
					"gce",
					"forwardOAuthIdentity"
				]
			}
		],
		ui: {
			component: "select",
			options: [
				{
					label: "Google JWT File",
					value: "jwt"
				},
				{
					label: "GCE Default Service Account",
					value: "gce"
				},
				{
					label: "Forward OAuth Identity",
					value: "forwardOAuthIdentity"
				}
			]
		},
		effects: [
			{
				when: "value == 'jwt'",
				set: {
					"virtual.jwtUpload": "upload",
					"jsonData.oauthPassThru": false
				}
			},
			{
				when: "value == 'gce'",
				set: {
					"virtual.jwtUpload": "manual",
					"jsonData.oauthPassThru": false
				}
			},
			{
				when: "value == 'forwardOAuthIdentity'",
				set: {
					"virtual.jwtUpload": "",
					"jsonData.oauthPassThru": true
				}
			}
		]
	},
	{
		id: "virtual.jwtUpload",
		key: "jwtUpload",
		label: "JWT Token",
		description: "Upload or paste a Google service account JSON key file. The file contents are parsed and the relevant fields are populated automatically.",
		valueType: "string",
		kind: "virtual",
		defaultValue: "upload",
		dependsOn: "jsonData.authenticationType == 'jwt'",
		storage: {
			type: "computed",
			read: "jsonData.clientEmail ? 'manual' : 'upload'"
		},
		ui: {
			component: "fileUpload",
			accept: [
				".json"
			],
			placeholder: "Paste Google JWT token here",
			fileMapping: {
				project_id: "jsonData.defaultProject",
				client_email: "jsonData.clientEmail",
				token_uri: "jsonData.tokenUri",
				private_key: "secureJsonData.privateKey"
			}
		}
	},
	{
		id: "jsonData.defaultProject",
		key: "defaultProject",
		label: "Project ID",
		description: "GCP project ID. In JWT mode, auto-filled from the service account JSON.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "virtual.jwtUpload == 'manual'"
	},
	{
		id: "jsonData.clientEmail",
		key: "clientEmail",
		label: "Client Email",
		description: "Service account email address for JWT authentication.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "virtual.jwtUpload == 'manual'"
	},
	{
		id: "jsonData.tokenUri",
		key: "tokenUri",
		label: "Token URI",
		description: "OAuth2 token endpoint URI.",
		valueType: "string",
		target: "jsonData",
		defaultValue: "https://oauth2.googleapis.com/token",
		dependsOn: "virtual.jwtUpload == 'manual'"
	},
	{
		id: "virtual.privateKeyMode",
		key: "privateKeyMode",
		label: "Private key",
		valueType: "string",
		kind: "virtual",
		defaultValue: "paste",
		dependsOn: "virtual.jwtUpload == 'manual'",
		storage: {
			type: "computed",
			read: "jsonData.privateKeyPath ? 'path' : 'paste'"
		},
		ui: {
			component: "radio",
			options: [
				{
					label: "Paste private key",
					value: "paste"
				},
				{
					label: "Provide path to private key file",
					value: "path"
				}
			]
		}
	},
	{
		id: "secureJsonData.privateKey",
		key: "privateKey",
		label: "Private Key",
		description: "Service account private key for JWT authentication.",
		valueType: "string",
		semanticType: "token",
		target: "secureJsonData",
		dependsOn: "virtual.privateKeyMode == 'paste'"
	},
	{
		id: "jsonData.privateKeyPath",
		key: "privateKeyPath",
		label: "Private Key Path",
		description: "Path to a local private key file on the Grafana server. Not supported in hosted environments.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "virtual.privateKeyMode == 'path'",
		ui: {
			component: "input",
			placeholder: "File location of your private key (e.g. /etc/secrets/bigquery.pem)"
		}
	},
	{
		id: "jsonData.defaultProjectNonJwt",
		key: "defaultProject",
		label: "Default Project",
		description: "Default GCP project for queries.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "jsonData.authenticationType != 'jwt'"
	},
	{
		id: "jsonData.oauthPassThru",
		key: "oauthPassThru",
		label: "Forward OAuth Identity",
		description: "Forward the user's OAuth token to BigQuery.",
		valueType: "boolean",
		target: "jsonData",
		tags: [
			"managed-by:jsonData.authenticationType"
		]
	},
	{
		id: "jsonData.usingImpersonation",
		key: "usingImpersonation",
		label: "Enable service account impersonation",
		description: "Read more about service account impersonation.",
		valueType: "boolean",
		target: "jsonData",
		dependsOn: "jsonData.authenticationType != 'forwardOAuthIdentity'",
		ui: {
			component: "switch"
		}
	},
	{
		id: "jsonData.serviceAccountToImpersonate",
		key: "serviceAccountToImpersonate",
		label: "Service account to impersonate",
		description: "Email of the service account to impersonate.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "jsonData.authenticationType != 'forwardOAuthIdentity' && jsonData.usingImpersonation == true"
	},
	{
		id: "jsonData.processingLocation",
		key: "processingLocation",
		label: "Processing Location",
		description: "BigQuery processing location.",
		valueType: "string",
		target: "jsonData",
		ui: {
			component: "select",
			options: [
				{
					label: "Automatic location selection",
					value: ""
				},
				{
					label: "United States (US)",
					value: "US"
				},
				{
					label: "European Union (EU)",
					value: "EU"
				},
				{
					label: "Columbus, Ohio (us-east5)",
					value: "us-east5"
				},
				{
					label: "Dallas (us-south1)",
					value: "us-south1"
				},
				{
					label: "Iowa (us-central1)",
					value: "us-central1"
				},
				{
					label: "Los Angeles (us-west2)",
					value: "us-west2"
				},
				{
					label: "Las Vegas (us-west4)",
					value: "us-west4"
				},
				{
					label: "Montréal (northamerica-northeast1)",
					value: "northamerica-northeast1"
				},
				{
					label: "Northern Virginia (us-east4)",
					value: "us-east4"
				},
				{
					label: "Oregon (us-west1)",
					value: "us-west1"
				},
				{
					label: "Salt Lake City (us-west3)",
					value: "us-west3"
				},
				{
					label: "São Paulo (southamerica-east1)",
					value: "southamerica-east1"
				},
				{
					label: "Santiago (southamerica-west1)",
					value: "southamerica-west1"
				},
				{
					label: "South Carolina (us-east1)",
					value: "us-east1"
				},
				{
					label: "Toronto (northamerica-northeast2)",
					value: "northamerica-northeast2"
				},
				{
					label: "Belgium (europe-west1)",
					value: "europe-west1"
				},
				{
					label: "Berlin (europe-west10)",
					value: "europe-west10"
				},
				{
					label: "Finland (europe-north1)",
					value: "europe-north1"
				},
				{
					label: "Frankfurt (europe-west3)",
					value: "europe-west3"
				},
				{
					label: "London (europe-west2)",
					value: "europe-west2"
				},
				{
					label: "Madrid (europe-southwest1)",
					value: "europe-southwest1"
				},
				{
					label: "Milan (europe-west8)",
					value: "europe-west8"
				},
				{
					label: "Netherlands (europe-west4)",
					value: "europe-west4"
				},
				{
					label: "Paris (europe-west9)",
					value: "europe-west9"
				},
				{
					label: "Turin (europe-west12)",
					value: "europe-west12"
				},
				{
					label: "Warsaw (europe-central2)",
					value: "europe-central2"
				},
				{
					label: "Zürich (europe-west6)",
					value: "europe-west6"
				},
				{
					label: "Delhi (asia-south2)",
					value: "asia-south2"
				},
				{
					label: "Hong Kong (asia-east2)",
					value: "asia-east2"
				},
				{
					label: "Jakarta (asia-southeast2)",
					value: "asia-southeast2"
				},
				{
					label: "Melbourne (australia-southeast2)",
					value: "australia-southeast2"
				},
				{
					label: "Mumbai (asia-south1)",
					value: "asia-south1"
				},
				{
					label: "Osaka (asia-northeast2)",
					value: "asia-northeast2"
				},
				{
					label: "Seoul (asia-northeast3)",
					value: "asia-northeast3"
				},
				{
					label: "Singapore (asia-southeast1)",
					value: "asia-southeast1"
				},
				{
					label: "Sydney (australia-southeast1)",
					value: "australia-southeast1"
				},
				{
					label: "Taiwan (asia-east1)",
					value: "asia-east1"
				},
				{
					label: "Tokyo (asia-northeast1)",
					value: "asia-northeast1"
				},
				{
					label: "Dammam (me-central2)",
					value: "me-central2"
				},
				{
					label: "Doha (me-central1)",
					value: "me-central1"
				},
				{
					label: "Tel Aviv (me-west1)",
					value: "me-west1"
				}
			]
		}
	},
	{
		id: "jsonData.serviceEndpoint",
		key: "serviceEndpoint",
		label: "Service Endpoint",
		description: "Custom BigQuery API endpoint URL.",
		valueType: "string",
		target: "jsonData",
		ui: {
			component: "input",
			placeholder: "Optional, example https://bigquery.googleapis.com/bigquery/v2/"
		}
	},
	{
		id: "jsonData.MaxBytesBilled",
		key: "MaxBytesBilled",
		label: "Max Bytes Billed",
		description: "Limits the bytes billed per query. Queries exceeding this limit will fail.",
		valueType: "number",
		target: "jsonData",
		ui: {
			component: "input",
			placeholder: "Optional, example 5242880"
		}
	},
	{
		id: "jsonData.queryPriority",
		key: "queryPriority",
		label: "Query Priority",
		description: "BigQuery query priority.",
		valueType: "string",
		target: "jsonData",
		ui: {
			component: "select",
			options: [
				{
					label: "Interactive",
					value: "INTERACTIVE"
				},
				{
					label: "Batch",
					value: "BATCH"
				}
			]
		}
	},
	{
		id: "jsonData.flatRateProject",
		key: "flatRateProject",
		label: "Flat Rate Project",
		description: "Project used for flat-rate billing reservation.",
		valueType: "string",
		target: "jsonData"
	},
	{
		id: "jsonData.enableSecureSocksProxy",
		key: "enableSecureSocksProxy",
		label: "Secure Socks Proxy",
		description: "Enable secure SOCKS proxy.",
		valueType: "boolean",
		target: "jsonData",
		ui: {
			component: "switch"
		}
	}
];
var groups = [
	{
		id: "auth",
		title: "Authentication",
		fieldRefs: [
			"jsonData.authenticationType",
			"virtual.jwtUpload",
			"jsonData.defaultProject",
			"jsonData.clientEmail",
			"jsonData.tokenUri",
			"virtual.privateKeyMode",
			"secureJsonData.privateKey",
			"jsonData.privateKeyPath",
			"jsonData.defaultProjectNonJwt"
		]
	},
	{
		id: "impersonation",
		title: "Service account impersonation",
		optional: true,
		fieldRefs: [
			"jsonData.usingImpersonation",
			"jsonData.serviceAccountToImpersonate"
		]
	},
	{
		id: "additional",
		title: "Additional settings",
		optional: true,
		fieldRefs: [
			"jsonData.processingLocation",
			"jsonData.serviceEndpoint",
			"jsonData.MaxBytesBilled",
			"jsonData.queryPriority",
			"jsonData.flatRateProject",
			"jsonData.enableSecureSocksProxy"
		]
	}
];
var grafanaBigqueryDatasourceSchema = {
	$schema: $schema,
	schemaVersion: schemaVersion,
	pluginType: pluginType,
	pluginName: pluginName,
	docURL: docURL,
	fields: fields,
	groups: groups
};

export { $schema, grafanaBigqueryDatasourceSchema as default, docURL, fields, groups, pluginName, pluginType, schemaVersion };
//# sourceMappingURL=grafana-bigquery-datasource.schema.json.js.map
