"""Constants for the teslemetry tests."""

from homeassistant.components.teslemetry.const import DOMAIN, TeslemetryState
from homeassistant.const import CONF_ACCESS_TOKEN

from tests.common import load_json_object_fixture

UNIQUE_ID = "abc-123"
CONFIG_V1 = {CONF_ACCESS_TOKEN: "abc-123"}

WAKE_UP_ONLINE = {"response": {"state": TeslemetryState.ONLINE}, "error": None}
WAKE_UP_ASLEEP = {"response": {"state": TeslemetryState.ASLEEP}, "error": None}

PRODUCTS = load_json_object_fixture("products.json", DOMAIN)
PRODUCTS_MODERN = load_json_object_fixture("products.json", DOMAIN)
PRODUCTS_MODERN["response"][0]["command_signing"] = "required"
VEHICLE_DATA = load_json_object_fixture("vehicle_data.json", DOMAIN)
VEHICLE_DATA_ASLEEP = load_json_object_fixture("vehicle_data.json", DOMAIN)
VEHICLE_DATA_ASLEEP["response"]["state"] = TeslemetryState.OFFLINE
VEHICLE_DATA_ALT = load_json_object_fixture("vehicle_data_alt.json", DOMAIN)
LIVE_STATUS = load_json_object_fixture("live_status.json", DOMAIN)
SITE_INFO = load_json_object_fixture("site_info.json", DOMAIN)
SITE_INFO_WEEK_CROSSING = load_json_object_fixture(
    "site_info_week_crossing.json", DOMAIN
)
SITE_INFO_MULTI_SEASON = load_json_object_fixture("site_info_multi_season.json", DOMAIN)
ENERGY_HISTORY = load_json_object_fixture("energy_history.json", DOMAIN)
ENERGY_HISTORY_EMPTY = load_json_object_fixture("energy_history_empty.json", DOMAIN)

COMMAND_OK = {"response": {"result": True, "reason": ""}}
COMMAND_REASON = {"response": {"result": False, "reason": "already closed"}}
COMMAND_IGNORED_REASON = {"response": {"result": False, "reason": "already_set"}}
COMMAND_NOREASON = {"response": {"result": False}}  # Unexpected
COMMAND_ERROR = {
    "response": None,
    "error": "vehicle unavailable: vehicle is offline or asleep",
    "error_description": "",
}
COMMAND_NOERROR = {"answer": 42}
COMMAND_ERRORS = (COMMAND_REASON, COMMAND_NOREASON, COMMAND_ERROR, COMMAND_NOERROR)

RESPONSE_OK = {"response": {}, "error": None}

METADATA = {
    "uid": UNIQUE_ID,
    "region": "NA",
    "scopes": [
        "openid",
        "offline_access",
        "user_data",
        "vehicle_device_data",
        "vehicle_cmds",
        "vehicle_charging_cmds",
        "vehicle_location",
        "energy_device_data",
        "energy_cmds",
    ],
    "vehicles": {
        "LRW3F7EK4NC700000": {
            "proxy": True,
            "access": True,
            "polling": False,
            "firmware": "2026.0.0",
            "discounted": False,
            "fleet_telemetry": "1.0.2",
            "name": "Home Assistant",
        }
    },
    "energy_sites": {
        "123456": {
            "access": True,
            "name": "Energy Site",
        }
    },
}
METADATA_LEGACY = {
    "uid": UNIQUE_ID,
    "region": "NA",
    "scopes": [
        "openid",
        "offline_access",
        "user_data",
        "vehicle_device_data",
        "vehicle_cmds",
        "vehicle_charging_cmds",
        "vehicle_location",
        "energy_device_data",
        "energy_cmds",
    ],
    "vehicles": {
        "LRW3F7EK4NC700000": {
            "proxy": False,
            "access": True,
            "polling": True,
            "firmware": "2026.0.0",
            "discounted": True,
            "fleet_telemetry": "unknown",
            "name": "Home Assistant",
        }
    },
    "energy_sites": {
        "123456": {
            "access": True,
            "name": "Energy Site",
        }
    },
}
METADATA_NOSCOPE = {
    "uid": UNIQUE_ID,
    "region": "NA",
    "scopes": ["openid", "offline_access", "vehicle_device_data"],
    "vehicles": {
        "LRW3F7EK4NC700000": {
            "proxy": False,
            "access": True,
            "polling": True,
            "firmware": "2026.0.0",
            "discounted": True,
            "fleet_telemetry": "unknown",
            "name": "Home Assistant",
        }
    },
    "energy_sites": {
        "123456": {
            "access": True,
            "name": "Energy Site",
        }
    },
}
