var $schema = "../schema.json";
var schemaVersion = "v1";
var pluginType = "grafana-postgresql-datasource";
var pluginName = "PostgreSQL";
var docURL = "https://grafana.com/docs/grafana/latest/datasources/postgres/";
var fields = [
	{
		id: "root.url",
		key: "url",
		label: "Host URL",
		description: "PostgreSQL host and port.",
		valueType: "string",
		target: "root",
		required: true,
		ui: {
			component: "input",
			placeholder: "localhost:5432"
		}
	},
	{
		id: "jsonData.database",
		key: "database",
		label: "Database name",
		description: "PostgreSQL database name.",
		valueType: "string",
		target: "jsonData",
		required: true,
		storage: {
			type: "computed",
			read: "root.database"
		},
		ui: {
			component: "input",
			placeholder: "Database"
		}
	},
	{
		id: "root.user",
		key: "user",
		label: "Username",
		description: "Database username.",
		valueType: "string",
		target: "root",
		required: true,
		ui: {
			component: "input",
			placeholder: "Username"
		}
	},
	{
		id: "secureJsonData.password",
		key: "password",
		label: "Password",
		description: "Database password.",
		valueType: "string",
		semanticType: "password",
		target: "secureJsonData"
	},
	{
		id: "jsonData.sslmode",
		key: "sslmode",
		label: "TLS/SSL Mode",
		description: "Determines whether or with what priority a secure TLS/SSL TCP/IP connection will be negotiated with the server.",
		valueType: "string",
		target: "jsonData",
		defaultValue: "require",
		validations: [
			{
				type: "allowedValues",
				values: [
					"disable",
					"require",
					"verify-ca",
					"verify-full"
				]
			}
		],
		ui: {
			component: "select",
			options: [
				{
					label: "disable",
					value: "disable"
				},
				{
					label: "require",
					value: "require"
				},
				{
					label: "verify-ca",
					value: "verify-ca"
				},
				{
					label: "verify-full",
					value: "verify-full"
				}
			]
		}
	},
	{
		id: "jsonData.tlsConfigurationMethod",
		key: "tlsConfigurationMethod",
		label: "TLS/SSL Method",
		description: "How TLS/SSL certificates are configured. File system path specifies paths to certificates on the local file system. Certificate content stores certificate data encrypted in Grafana's database.",
		valueType: "string",
		target: "jsonData",
		defaultValue: "file-path",
		dependsOn: "jsonData.sslmode != 'disable'",
		validations: [
			{
				type: "allowedValues",
				values: [
					"file-path",
					"file-content"
				]
			}
		],
		ui: {
			component: "select",
			options: [
				{
					label: "File system path",
					value: "file-path"
				},
				{
					label: "Certificate content",
					value: "file-content"
				}
			]
		}
	},
	{
		id: "jsonData.sslRootCertFile",
		key: "sslRootCertFile",
		label: "TLS/SSL Root Certificate",
		description: "Path to the root certificate file. Required if TLS/SSL mode is verify-ca or verify-full.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod != 'file-content'",
		ui: {
			component: "input",
			placeholder: "TLS/SSL root cert file"
		}
	},
	{
		id: "jsonData.sslCertFile",
		key: "sslCertFile",
		label: "TLS/SSL Client Certificate",
		description: "Path to the client certificate file for TLS/SSL client authentication.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod != 'file-content'",
		ui: {
			component: "input",
			placeholder: "TLS/SSL client cert file"
		}
	},
	{
		id: "jsonData.sslKeyFile",
		key: "sslKeyFile",
		label: "TLS/SSL Client Key",
		description: "Path to the client key file for TLS/SSL client authentication.",
		valueType: "string",
		target: "jsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod != 'file-content'",
		ui: {
			component: "input",
			placeholder: "TLS/SSL client key file"
		}
	},
	{
		id: "secureJsonData.tlsClientCert",
		key: "tlsClientCert",
		label: "TLS/SSL Client Certificate",
		description: "PEM-encoded client certificate content.",
		valueType: "string",
		target: "secureJsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod == 'file-content'",
		ui: {
			component: "textarea",
			rows: 7
		}
	},
	{
		id: "secureJsonData.tlsCACert",
		key: "tlsCACert",
		label: "TLS/SSL Root Certificate",
		description: "PEM-encoded root CA certificate content. Required for verify-ca and verify-full modes.",
		valueType: "string",
		target: "secureJsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod == 'file-content'",
		ui: {
			component: "textarea",
			rows: 7
		}
	},
	{
		id: "secureJsonData.tlsClientKey",
		key: "tlsClientKey",
		label: "TLS/SSL Client Key",
		description: "PEM-encoded client private key content.",
		valueType: "string",
		semanticType: "token",
		target: "secureJsonData",
		dependsOn: "jsonData.sslmode != 'disable' && jsonData.tlsConfigurationMethod == 'file-content'",
		ui: {
			component: "textarea",
			rows: 7
		}
	},
	{
		id: "jsonData.postgresVersion",
		key: "postgresVersion",
		label: "Version",
		description: "PostgreSQL server version. Controls what functions are available in the query builder.",
		valueType: "number",
		target: "jsonData",
		defaultValue: 903,
		ui: {
			component: "select",
			options: [
				{
					label: "9.0",
					value: 900
				},
				{
					label: "9.1",
					value: 901
				},
				{
					label: "9.2",
					value: 902
				},
				{
					label: "9.3",
					value: 903
				},
				{
					label: "9.4",
					value: 904
				},
				{
					label: "9.5",
					value: 905
				},
				{
					label: "9.6",
					value: 906
				},
				{
					label: "10",
					value: 1000
				},
				{
					label: "11",
					value: 1100
				},
				{
					label: "12",
					value: 1200
				},
				{
					label: "13",
					value: 1300
				},
				{
					label: "14",
					value: 1400
				},
				{
					label: "15",
					value: 1500
				}
			]
		}
	},
	{
		id: "jsonData.timeInterval",
		key: "timeInterval",
		label: "Min time interval",
		description: "A lower limit for the auto group-by time interval. Recommended to be set to write frequency, for example 1m if your data is written every minute.",
		valueType: "string",
		semanticType: "duration",
		target: "jsonData",
		ui: {
			component: "input",
			placeholder: "1m"
		}
	},
	{
		id: "jsonData.timescaledb",
		key: "timescaledb",
		label: "TimescaleDB",
		description: "TimescaleDB is a time-series database built as a PostgreSQL extension. If enabled, Grafana will use time_bucket in the $__timeGroup macro and display TimescaleDB specific aggregate functions in the query builder.",
		valueType: "boolean",
		target: "jsonData",
		ui: {
			component: "switch"
		}
	},
	{
		id: "jsonData.maxOpenConns",
		key: "maxOpenConns",
		label: "Max open",
		description: "Maximum number of open connections to the database. Default is 100.",
		valueType: "number",
		target: "jsonData",
		defaultValue: 100,
		validations: [
			{
				type: "range",
				min: 0
			}
		]
	},
	{
		id: "jsonData.connMaxLifetime",
		key: "connMaxLifetime",
		label: "Max lifetime",
		description: "Maximum lifetime of a connection in seconds. Default is 14400 (4 hours). Set to 0 to reuse connections forever.",
		valueType: "number",
		target: "jsonData",
		defaultValue: 14400,
		validations: [
			{
				type: "range",
				min: 0
			}
		]
	}
];
var groups = [
	{
		id: "connection",
		title: "Connection",
		fieldRefs: [
			"root.url",
			"jsonData.database"
		]
	},
	{
		id: "auth",
		title: "Authentication",
		fieldRefs: [
			"root.user",
			"secureJsonData.password"
		]
	},
	{
		id: "tls",
		title: "TLS/SSL Settings",
		fieldRefs: [
			"jsonData.sslmode",
			"jsonData.tlsConfigurationMethod",
			"jsonData.sslRootCertFile",
			"jsonData.sslCertFile",
			"jsonData.sslKeyFile",
			"secureJsonData.tlsClientCert",
			"secureJsonData.tlsCACert",
			"secureJsonData.tlsClientKey"
		]
	},
	{
		id: "postgres-options",
		title: "PostgreSQL Options",
		fieldRefs: [
			"jsonData.postgresVersion",
			"jsonData.timeInterval",
			"jsonData.timescaledb"
		]
	},
	{
		id: "connection-limits",
		title: "Connection limits",
		fieldRefs: [
			"jsonData.maxOpenConns",
			"jsonData.connMaxLifetime"
		]
	}
];
var relationships = [
	{
		type: "pair",
		fields: [
			"root.user",
			"secureJsonData.password"
		],
		description: "Database credentials"
	},
	{
		type: "pair",
		fields: [
			"secureJsonData.tlsClientCert",
			"secureJsonData.tlsClientKey"
		],
		description: "TLS client certificate and key"
	}
];
var grafanaPostgresqlDatasourceSchema = {
	$schema: $schema,
	schemaVersion: schemaVersion,
	pluginType: pluginType,
	pluginName: pluginName,
	docURL: docURL,
	fields: fields,
	groups: groups,
	relationships: relationships
};

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