from __future__ import annotations

from typing import Any, Dict, List

from common.models import RegionPlan


VOLC_REMOTE_COMMAND = "bash <(curl -fsSL https://www.wawaapi.com/static/scripts/Volc/volcengine.sh)"
VOLC_REGION_PLANS: List[RegionPlan] = [
    RegionPlan("volc_beijing", "北京", "cn-beijing", 0, 0),
    RegionPlan("volc_shanghai", "上海", "cn-shanghai", 0, 0),
    RegionPlan("volc_guangzhou", "广州", "cn-guangzhou", 0, 0),
]
VOLC_CONFIG_FULL = "full"
VOLC_CONFIG_BIG_FULL = "big_full"
VOLC_SPEC_2C2G = "2c2g"
VOLC_SPEC_2C4G = "2c4g"
VOLC_IP_QUOTA_PER_REGION = 8
VOLC_BALANCE_CHECK_FULL = 100
VOLC_BALANCE_CHECK_BIG_FULL = 100
VOLC_CONFIGS: Dict[str, Dict[str, Any]] = {
    VOLC_CONFIG_FULL: {"label": "中配(24)", "ecs_per_region": 1, "ip_per_region": 8, "total_ips": 24},
    VOLC_CONFIG_BIG_FULL: {"label": "满配(48)", "ecs_per_region": 2, "ip_per_region": 16, "total_ips": 48},
}
VOLC_SPECS: Dict[str, Dict[str, str]] = {
    VOLC_SPEC_2C2G: {"label": "2vCPUs|2GiB", "instance_type": "ecs.e-c1m1.large"},
    VOLC_SPEC_2C4G: {"label": "2vCPUs|4GiB", "instance_type": "ecs.e-c1m2.large"},
}
VOLC_IDENTITY_TIMEOUT = 5.0
VOLC_RESOURCE_API_TIMEOUT = 5.0
VOLC_RESOURCE_SLOW_API_GRACE = 2.0
VOLC_RESOURCE_SCAN_TIMEOUT = 16.0
VOLC_AUTOBUY_SOURCE_MODES = {
    VOLC_CONFIG_FULL: "火山引擎自动购买：中配(24)",
    VOLC_CONFIG_BIG_FULL: "火山引擎自动购买：满配(48)",
}
