# Copyright (c) 2025, Jingrow and contributors
# For license information, please see license.txt

import jingrow
from jingrow.model.page import Page


class JsiteDomain(Page):
	# 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 jcloud.jcloud.pagetype.dns_resolution.dns_resolution import DnsResolution
		from jingrow.types import DF

		admin_password: DF.Password | None
		auto_renew: DF.Check
		description: DF.SmallText | None
		dns_host1: DF.Data | None
		dns_host2: DF.Data | None
		dns_host3: DF.Data | None
		dns_host4: DF.Data | None
		dns_host5: DF.Data | None
		dns_host6: DF.Data | None
		dns_resolution: DF.Table[DnsResolution]
		domain: DF.Data
		domain_owner: DF.Link | None
		domain_registrar: DF.Data | None
		end_date: DF.Datetime | None
		group: DF.Data | None
		order_id: DF.Data | None
		period: DF.Int
		price: DF.Int
		registration_date: DF.Datetime | None
		status: DF.Literal["ok", "clienthold", "clientHold", "clientupdateprohibited", "clientUpdateProhibited", "clienttransferprohibited", "clientTransferProhibited", "clientdeleteprohibited", "clientDeleteProhibited", "clientrenewprohibited", "clientRenewProhibited"]
		team: DF.Link | None
		whois_protection: DF.Check
	# end: auto-generated types

	dashboard_fields = (
		"domain",
		"status",
		"domain_owner",
		"domain_registrar",
		"registration_date",
		"end_date",
		"price",
		"period",
		"auto_renew",
		"team",
		"order_id",
		"description",
		"whois_protection",
		"admin_password",
		"group",
		"dns_host1",
		"dns_host2",
		"dns_host3",
		"dns_host4",
		"dns_host5",
		"dns_host6"
	)

	@staticmethod
	def get_list_query(query):
		JsiteDomain = jingrow.qb.PageType("Jsite Domain")
		query = query.where(JsiteDomain.team == jingrow.local.team().name)
		return query.run(as_dict=True)

	def get_pg(self, pg):
		return pg
