# Copyright (c) 2024, JINGROW
# For license information, please see license.txt
from __future__ import annotations

from jcloud.jcloud.pagetype.site_plan.plan import Plan


class ServerPlan(Plan):
	# begin: auto-generated types
	# This code is auto-generated. Do not modify anything in this block.

	from typing import TYPE_CHECKING

	if TYPE_CHECKING:
		from jingrow.core.pagetype.has_role.has_role import HasRole
		from jingrow.types import DF

		cluster: DF.Link | None
		disk: DF.Int
		enabled: DF.Check
		instance_type: DF.Data | None
		memory: DF.Int
		platform: DF.Literal["x86_64", "arm64"]
		premium: DF.Check
		price_cny: DF.Currency
		price_usd: DF.Currency
		roles: DF.Table[HasRole]
		server_type: DF.Literal["Server", "Database Server", "Proxy Server", "Self Hosted Server", "Jsite Server"]
		title: DF.Data | None
		vcpu: DF.Int
	# end: auto-generated types

	dashboard_fields = (
		"title",
		"price_cny",
		"price_usd",
		"vcpu",
		"memory",
		"disk",
		"platform",
		"premium",
	)

	def get_pg(self, pg):
		pg["price_per_day_cny"] = self.get_price_per_day("CNY")
		pg["price_per_day_usd"] = self.get_price_per_day("USD")
		return pg
