from typing import Dict, List

from netbox.settings import configuration

__all__ = (
    "ds_influxdb",
    "ds_netbox",
    "ds_postgresql",
    "ds_test",
)


ds_influxdb: Dict = {
    "orgId": 0,
    "name": "InfluxDB",
    "type": "influxdb",
    "typeName": "InfluxDB",
    "typeLogoUrl": "public/app/plugins/datasource/influxdb/img/influxdb_logo.svg",
    "access": "proxy",
    "url": "https://data.dev.sens.solutions",
    "user": "",
    "database": "",
    "basicAuth": True,
    "isDefault": True,
    "jsonData": {
        "defaultBucket": "admin",
        "httpMode": "POST",
        "organization": "inchildhealth",
        "version": "Flux",
    },
    "readOnly": False,
}
ds_netbox: Dict = {
    "orgId": 0,
    "name": "Netbox",
    "type": "marcusolsson-json-datasource",
    "typeName": "JSON API",
    "typeLogoUrl": "public/plugins/marcusolsson-json-datasource/img/logo.svg",
    "access": "proxy",
    "url": "https://backend.dev.sens.solutions/",
    "user": "",
    "database": "",
    "basicAuth": False,
    "isDefault": False,
    "jsonData": {
        "httpHeaderName1": "Authorization",
        "httpHeaderValue1": "Token 01b14f512f2f0bc9659f7fef9ac3a9bb7ca6bd38",
        "httpHeaderName2": "Content-Type",
        "httpHeaderValue2": "application/json",
        "httpHeaderName3": "Accept",
        "httpHeaderValue3": "*/*",
    },
    "readOnly": False,
}
ds_postgresql: Dict = {
    "orgId": 0,
    "name": "PostgreSQL",
    "type": "postgres",
    "typeName": "PostgreSQL",
    "typeLogoUrl": "public/app/plugins/datasource/postgres/img/postgresql_logo.svg",
    "access": "proxy",
    "url": configuration.DATABASE["HOST"],
    "user": configuration.DATABASE["USER"],
    "database": configuration.DATABASE["NAME"],
    "password": configuration.DATABASE["PASSWORD"],
    "basicAuth": False,
    "isDefault": False,
    "jsonData": {
        "connMaxLifetime": 14400,
        "database": "netbox",
        "maxIdleConns": 100,
        "maxIdleConnsAuto": True,
        "maxOpenConns": 100,
        "postgresVersion": 1200,
        "sslmode": "disable",
    },
    "readOnly": False,
}


ds_test: List = [
    {
        "datasource": {
            "id": 23,
            "uid": "d88f58a9-b0f8-4540-a961-83a5d48d6a11",
            "orgId": 57,
            "name": "PostgreSQL",
            "type": "postgres",
            "typeLogoUrl": "",
            "access": "proxy",
            "url": "postgres",
            "user": "netbox",
            "database": "netbox",
            "basicAuth": False,
            "basicAuthUser": "",
            "withCredentials": False,
            "isDefault": False,
            "jsonData": {
                "connMaxLifetime": 14400,
                "database": "netbox",
                "maxIdleConns": 100,
                "maxIdleConnsAuto": True,
                "maxOpenConns": 100,
                "postgresVersion": 1200,
                "sslmode": "disable",
            },
            "secureJsonFields": {},
            "version": 1,
            "readOnly": False,
        },
        "id": 23,
        "message": "Datasource added",
        "name": "PostgreSQL",
    },
    {
        "datasource": {
            "id": 24,
            "uid": "a9a6f609-9435-49d0-9faf-888d52a886b0",
            "orgId": 57,
            "name": "Netbox",
            "type": "marcusolsson-json-datasource",
            "typeLogoUrl": "",
            "access": "proxy",
            "url": "https://backend.dev.sens.solutions/",
            "user": "",
            "database": "",
            "basicAuth": False,
            "basicAuthUser": "",
            "withCredentials": False,
            "isDefault": False,
            "jsonData": {
                "httpHeaderName1": "Authorization",
                "httpHeaderName2": "Content-Type",
                "httpHeaderName3": "Accept",
            },
            "secureJsonFields": {},
            "version": 1,
            "readOnly": False,
        },
        "id": 24,
        "message": "Datasource added",
        "name": "Netbox",
    },
    {
        "datasource": {
            "id": 25,
            "uid": "ee6f7b6d-eaae-431a-a99e-71f5b9a7a29b",
            "orgId": 57,
            "name": "InfluxDB",
            "type": "influxdb",
            "typeLogoUrl": "",
            "access": "proxy",
            "url": "https://data.dev.sens.solutions",
            "user": "",
            "database": "",
            "basicAuth": True,
            "basicAuthUser": "",
            "withCredentials": False,
            "isDefault": True,
            "jsonData": {
                "defaultBucket": "admin",
                "httpMode": "POST",
                "organization": "inchildhealth",
                "version": "Flux",
            },
            "secureJsonFields": {},
            "version": 1,
            "readOnly": False,
        },
        "id": 25,
        "message": "Datasource added",
        "name": "InfluxDB",
    },
]
