package main

import (
	"testing"

	"wdd.io/agent-operator/config"

	image2 "wdd.io/agent-common/image"
	"wdd.io/agent-common/real_project"
	"wdd.io/agent-common/real_project/zhejianyidong_erjipingtai"
	"wdd.io/agent-deploy/z_dep"
)

func TestCmiiEnvDeploy(t *testing.T) {

	// dev
	// devflight
	// devoperation

	deployNamespace := config.DevFlight

	//  deploy to cmii environment
	cmiiDeployCommonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "lab.uavcmlc.com",
		WebPort:                     "",
		HarborIPOrCustomImagePrefix: image2.CmiiHarborPrefix,
		HarborPort:                  "",
		Namespace:                   deployNamespace,
		TagVersion:                  "6.2.0",
		TenantEnv:                   "devflight",
		MinioPublicIP:               "",
		MinioInnerIP:                "127.0.0.1",
		NFSServerIP:                 "123.0.0.1",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeploy(cmiiDeployCommonEnv, false, deployNamespace)

}

func TestCmiiEnvDeploy_WddSuperCluster(t *testing.T) {

	// RDMC项目的部署文件
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "192.168.40.50",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: image2.CmiiHarborPrefix,
		HarborPort:                  "",
		Namespace:                   "wdd-rmdc",
		TagVersion:                  "base-1.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "192.168.0.6",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUas21XAImageList)

}

func TestCmiiEnvDeploy_ChengDuGongYeXueYuan(t *testing.T) {

	// 成都市工业职业技术学院
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "172.22.106.77",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "172.22.106.77",
		HarborPort:                  "8033",
		Namespace:                   "sc-cd-uav-260207",
		TagVersion:                  "2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "192.168.5.141",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUavFlyControlImageList)

}

func TestCmiiEnvDeploy_XinJiangAKeSu(t *testing.T) {

	// 新疆阿克苏 2026年3月3日
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "120.205.80.23",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.5.41",
		HarborPort:                  "8033",
		Namespace:                   "xj-aks-uav-260304",
		TagVersion:                  "2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "192.168.5.141",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUavFlyControlARM64ImageList)

}

func TestCmiiEnvDeploy_MianYangDiKong(t *testing.T) {

	// 绵阳 低空智能飞行
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.133.66.183",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.1.4",
		HarborPort:                  "8033",
		Namespace:                   "sc-my-uav-260202",
		TagVersion:                  "2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "192.168.1.6",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUavFlyControlImageList)

}

func TestCmiiEnvDeploy_XiongAnJianGuanPingTai(t *testing.T) {

	// 雄安空能院 2025年8月7日
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "144.7.97.167",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.22.57.8",
		HarborPort:                  "8033",
		Namespace:                   "xa-dcity-uas-260116",
		TagVersion:                  "uas-2.2",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "10.22.57.3",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUas22ImageList)

}

func TestCmiiEnvDeploy_XiongAnKongNengYuan(t *testing.T) {

	// 雄安空能院 2025年8月7日
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "111.63.69.71",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.0.2",
		HarborPort:                  "8033",
		Namespace:                   "xakny",
		TagVersion:                  "uas-2.1",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "192.168.0.6",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUas21XAImageList)

}

func TestCmiiEnvDeploy_ZhejiangErjiPingTai(t *testing.T) {

	// 浙江二级平台 监管
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "lingyun.zyjctech.com",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.10.3",
		HarborPort:                  "8033",
		Namespace:                   "zjejpt-uas",
		TagVersion:                  "uas-2.1",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.10.2",
		NFSServerIP:                 "192.168.10.3",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUas21ImageList)

}

func TestCmiiEnvDeploy_HuNanErJiPingTaiJianGuan(t *testing.T) {

	// 湖南二级平台 监管
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.137.146.187",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "hncm-fc766f84.ecis.changsha-2.cmecloud.cn/cmii",
		HarborPort:                  "",
		Namespace:                   "zyly",
		TagVersion:                  "uas-2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "helm-minio",
		NFSServerIP:                 "hcms-efs-class",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.CmiiUas2ImageList)

}

func TestCmiiEnvDeploy_ZhuHaiBianFangShengJi(t *testing.T) {

	// 珠海边防升级 6.2.0-demo
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.141.69.163",
		WebPort:                     "8888",
		HarborIPOrCustomImagePrefix: "192.168.233.100",
		HarborPort:                  "8033",
		Namespace:                   "zhbf",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "192.168.233.100",
		MinioInnerIP:                "192.168.233.100",
		NFSServerIP:                 "192.168.233.100",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii620ImageList)

}

func TestCmiiEnvDeploy_ChongQingSanHua(t *testing.T) {

	// chongqing sanhua
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.133.115.164",
		WebPort:                     "58888",
		HarborIPOrCustomImagePrefix: "chongqingcis-9b4a3da9.ecis.chongqing-1.cmecloud.cn/cmii/",
		HarborPort:                  "",
		Namespace:                   "wrj",
		TagVersion:                  "5.6.0",
	}

	CmiiEnvDeploy(commonEnv, true, config.Demo)

}

func TestCmiiEnvDeploy_JiangSuNanTongErJiPingTai(t *testing.T) {

	// 江苏南通二级平台 2025-01
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "10.40.51.5",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.40.51.5",
		HarborPort:                  "8033",
		Namespace:                   "jsntejpt",
		TagVersion:                  "6.1.0",
		TenantEnv:                   "",
		MinioPublicIP:               "10.40.51.5",
		MinioInnerIP:                "10.40.51.5",
		NFSServerIP:                 "10.40.51.5",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii611ImageList)

}

func TestCmiiEnvDeploy_ShenZhenGuiZiXiangMu(t *testing.T) {

	// 深证规自项目 2025-02
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "172.31.2.7",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "172.31.2.7",
		HarborPort:                  "8033/admin",
		Namespace:                   "szgz",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "172.31.2.9",
		MinioInnerIP:                "172.31.2.9",
		NFSServerIP:                 "172.31.2.9",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii620ArmImageList)

}

func TestCmiiEnvDeploy_LiuXiTongGan(t *testing.T) {

	// 刘喜通感
	// 修改
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "10.250.0.200",
		WebPort:                     "8888",
		HarborIPOrCustomImagePrefix: "10.250.0.200",
		HarborPort:                  "8033",
		Namespace:                   "xmyd_6.0.0",
		TagVersion:                  "5.6.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "",
		NFSServerIP:                 "10.250.0.200",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeploy(commonEnv, true, config.Demo)

}

func TestCmiiEnvDeploy_ZheJiangYiDongErJiPingTai(t *testing.T) {

	// 浙江移动二级平台
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "111.2.224.59",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.10.3",
		HarborPort:                  "8033",
		Namespace:                   "zjyd",
		TagVersion:                  "5.7.0",
		NFSServerIP:                 "192.168.10.3",
		MinioInnerIP:                "192.168.10.2",
	}

	CmiiEnvDeployOffline(commonEnv, true, zhejianyidong_erjipingtai.Cmii570ImageList)

}

func TestCmiiEnvDeploy_ZiyangTongGan(t *testing.T) {

	// 资阳通感
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "80.192.1.46",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "80.192.1.46",
		HarborPort:                  "8033",
		Namespace:                   "zygajg",
		TagVersion:                  "6.0.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "80.192.1.48",
		NFSServerIP:                 "80.192.1.48",
		ApplyFilePrefix:             "/root/wddproject/ProjectOctopus/agent-common/real_project/zygajg",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii600ImageList)

}

func TestCmiiEnvDeploy_JiChengCeShiHuanJing(t *testing.T) {

	// 2024上线测试-集成测试环境
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "integration.uavcmlc.com",
		WebPort:                     "",
		HarborIPOrCustomImagePrefix: image2.CmiiHarborPrefix,
		HarborPort:                  "",
		Namespace:                   "uavcloud-dev",
		TagVersion:                  "6.0.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "minio.ig-dev.uavcmlc.com",
		NFSServerIP:                 "10.40.51.5",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeploy(commonEnv, false, "")

}

func TestCmiiEnvDeploy_XinDEMO(t *testing.T) {

	// 202501 新DEMO
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "www.demo.uavcmlc.com",
		WebPort:                     "",
		HarborIPOrCustomImagePrefix: image2.CmiiHarborPrefix,
		HarborPort:                  "",
		Namespace:                   "uavcloud-demo",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.118.15",
		NFSServerIP:                 "192.168.118.15",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeploy(commonEnv, true, "")

}

func TestCmiiEnvDeploy_JiangXiOldShengJi(t *testing.T) {
	// 江西 旧平台 升级
	// 2025年2月20日
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.138.132.240",
		WebPort:                     "30800",
		HarborIPOrCustomImagePrefix: "10.20.1.130",
		HarborPort:                  "8033",
		Namespace:                   "jxyd",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "10.20.1.132",
		NFSServerIP:                 "10.20.1.132",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii620ImageList)
}

func TestCmiiEnvDeploy_JiangXiTongGanErJiPingTai(t *testing.T) {

	// 江西同感二级平台
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.138.111.244",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.20.1.135",
		HarborPort:                  "8033",
		Namespace:                   "jxejpt",
		TagVersion:                  "6.0.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "10.20.1.139",
		NFSServerIP:                 "10.20.1.135",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii600ImageList)

}

func TestCmiiEnvDeploy_ShangDongErJiPingTai(t *testing.T) {

	// 山东二级平台
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "134.80.124.6",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "134.80.124.7",
		HarborPort:                  "8033",
		Namespace:                   "sdejpt",
		TagVersion:                  "6.0.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "134.80.124.15",
		NFSServerIP:                 "134.80.124.21",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii600ImageList)

}

func TestCmiiEnvDeploy_JiangSuNanTong(t *testing.T) {

	// 江苏南通
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "10.40.51.5",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.40.51.5",
		HarborPort:                  "8033",
		Namespace:                   "jsntejpt",
		TagVersion:                  "5.7.0",
		NFSServerIP:                 "10.40.51.5",
		MinioInnerIP:                "10.40.51.5",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii570ImageList)

}

func TestCmiiEnvDeploy_ChongQingErJiPingTai(t *testing.T) {

	// 江苏南通
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.133.115.174",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "chongqingshcis-a189ec98.ecis.chongqing-1.cmecloud.cn/cmii/",
		HarborPort:                  "",
		Namespace:                   "cqejpt",
		TagVersion:                  "5.7.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.9.11",
		NFSServerIP:                 "192.168.9.11",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii570ImageList)

}

func TestCmiiEnvDeploy_YunNanErJiPingTai(t *testing.T) {

	// 江苏南通
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.147.6.78",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.118.14",
		HarborPort:                  "8033",
		Namespace:                   "ynejpt",
		TagVersion:                  "5.7.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.118.15",
		NFSServerIP:                 "192.168.118.15",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii570ImageList)

}

func TestCmiiEnvDeploy_LiaoNingYingJiPingTai(t *testing.T) {

	// 辽宁应急
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "120.201.112.20",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.40.42",
		HarborPort:                  "8033",
		Namespace:                   "lnydyj",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.40.193",
		NFSServerIP:                 "192.168.40.193",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii620ImageList)

}

func TestCmiiEnvDeploy_NeiMengGuEErDuoSiJiChang(t *testing.T) {

	// 内蒙古鄂尔多斯
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "172.16.100.55",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "172.16.100.55",
		HarborPort:                  "8033",
		Namespace:                   "eedsjc-uavms",
		TagVersion:                  "6.2.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "172.16.100.61",
		NFSServerIP:                 "172.16.100.61",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii620ImageList)

}

func TestCmiiEnvDeploy_ZhuHaiHengQing(t *testing.T) {

	// 珠海横琴
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "10.129.80.218",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.129.80.218",
		HarborPort:                  "8033",
		Namespace:                   "zhhq",
		TagVersion:                  "6.0.0",
		TenantEnv:                   "",
		MinioPublicIP:               "10.129.80.223",
		MinioInnerIP:                "10.129.80.223",
		NFSServerIP:                 "10.129.80.217",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii600ImageList)

}

func TestCmiiEnvDeploy_ZheJiangErJiPingTai(t *testing.T) {

	// 浙江二级平台扩容
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "111.2.224.59",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.10.3",
		HarborPort:                  "8033",
		Namespace:                   "zjejpt",
		TagVersion:                  "6.1.0",
		TenantEnv:                   "",
		MinioPublicIP:               "192.168.10.2",
		MinioInnerIP:                "192.168.10.2",
		NFSServerIP:                 "192.168.10.2",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii611ImageList)

}

func TestCmiiEnvDeploy_JiLinYiDong(t *testing.T) {

	// 吉林移动
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "36.135.17.162",
		WebPort:                     "8888",
		HarborIPOrCustomImagePrefix: "172.18.10.251",
		HarborPort:                  "8033",
		Namespace:                   "jlyd",
		TagVersion:                  "5.8.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.118.15",
		NFSServerIP:                 "192.168.118.15",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii580ImageList)

}

func TestCmiiEnvDeploy_GanSuErJiPingTai(t *testing.T) {

	// 甘肃二级平台
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "117.156.17.88",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "10.215.66.85",
		HarborPort:                  "8033",
		Namespace:                   "gsyd-app",
		TagVersion:                  "6.1.1",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "10.215.66.89",
		NFSServerIP:                 "10.215.66.89",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii611ImageList)

}

func TestCmiiEnvDeploy_YunNanErJiXin(t *testing.T) {

	// 云南二级平台-新
	commonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "39.129.174.66",
		WebPort:                     "8088",
		HarborIPOrCustomImagePrefix: "192.168.186.11",
		HarborPort:                  "8033",
		Namespace:                   "ynydapp",
		TagVersion:                  "6.1.0",
		TenantEnv:                   "",
		MinioPublicIP:               "",
		MinioInnerIP:                "192.168.186.15",
		NFSServerIP:                 "192.168.186.15",
		ApplyFilePrefix:             "",
	}

	CmiiEnvDeployOffline(commonEnv, true, real_project.Cmii611ImageList)

}

func TestCmiiNewAppDeploy(t *testing.T) {

	deployNamespace := config.DevOperation

	//  deploy to cmii environment
	cmiiDeployCommonEnv := &z_dep.CommonEnvironmentConfig{
		WebIP:                       "lab.uavcmlc.com",
		WebPort:                     "",
		HarborIPOrCustomImagePrefix: image2.CmiiHarborPrefix,
		HarborPort:                  "",
		Namespace:                   deployNamespace,
		TagVersion:                  "5.6.0",
	}

	CmiiNewAppDeploy(cmiiDeployCommonEnv, deployNamespace)

}
