package cloud_storage

type AWSProfile struct {
	AccountId  string `json:"account_id"`
	ExternalId string `json:"external_id"`
}

func GetAWSProfile(stage, region string) *AWSProfile {
	// Currently, we use the same external ID within the same region. The long-term plan is to make it different for each org/project/cluster,
	// but this may cause breaking changes, so we need to find a feasible implementation approach.
	switch stage {
	case "dev":
		return &AWSProfile{
			AccountId:  "385595570414",
			ExternalId: "696e6672612d6170696cd2d628c999b4b6a51db7e6b53a7cc1",
		}
	case "staging":
		return &AWSProfile{
			AccountId:  "385595570414",
			ExternalId: "696e6672612d6170692ad3e0eafa58e477fe2346d10bd1f824",
		}
	case "prod":
		res := &AWSProfile{
			AccountId: "380838443567",
		}
		switch region {
		case "ap-southeast-1":
			res.ExternalId = "696e6672612d61706931fca62a335517f6b417066a0a8f8baa"
			return res
		case "us-east-1":
			res.ExternalId = "696e6672612d6170699c338937a3f78064ac1ff4627b73506f"
			return res
		case "us-west-2":
			res.ExternalId = "696e6672612d617069ba71bd78fc6275aba1ee46726c2ac9ab"
			return res
		case "eu-central-1":
			res.ExternalId = "696e6672612d617069c7cf454887ef248fef5e4ea8cc0c0321"
			return res
		case "ap-northeast-1":
			res.ExternalId = "696e6672612d61706909a0969673a280c25b5cee1c73f014cd"
			return res
		case "ap-east-1":
			res.ExternalId = "696e6672612d617069536fa2af9f65e5e90d66dc8bf1be6d4c"
			return res
		case "ap-south-1":
			res.ExternalId = "696e6672612d617069c44ce37cc6bd784a960bcc44ade3881c"
			return res
		case "sa-east-1":
			res.ExternalId = "696e6672612d617069cd16fcc8f85ceeb37f2ee2019b271657"
			return res
		default:
			return nil
		}
	}
	return nil
}

func GetAWSProfileV2(stage, clusterId string) *AWSProfile {
	switch stage {
	case "dev":
		return &AWSProfile{
			AccountId:  "385595570414",
			ExternalId: clusterId,
		}
	case "staging":
		return &AWSProfile{
			AccountId:  "385595570414",
			ExternalId: clusterId,
		}
	case "prod":
		return &AWSProfile{
			AccountId:  "380838443567",
			ExternalId: clusterId,
		}
	}
	return nil
}
