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

# import jingrow
from jingrow.model.page import Page


class DomainOwner(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 jingrow.types import DF

		c_adr: DF.Data | None
		c_adr_m: DF.Data | None
		c_co: DF.Data | None
		c_ct: DF.Data | None
		c_ct_m: DF.Data | None
		c_dt_m: DF.Data | None
		c_em: DF.Data | None
		c_fn: DF.Data | None
		c_fn_m: DF.Data | None
		c_idnum_gswl: DF.Data | None
		c_idtype_gswl: DF.Data | None
		c_ln: DF.Data | None
		c_ln_m: DF.Data | None
		c_org: DF.Data | None
		c_org_m: DF.Data | None
		c_pc: DF.Data | None
		c_ph: DF.Data | None
		c_ph_code: DF.Data | None
		c_ph_fj: DF.Data | None
		c_ph_num: DF.Data | None
		c_ph_type: DF.Literal["0", "1"]
		c_regtype: DF.Literal["", "I", "E"]
		c_st: DF.Data | None
		c_st_m: DF.Data | None
		c_status: DF.Literal["0", "1", "2", "3", "4"]
		c_sysid: DF.Data | None
		cocode: DF.Data | None
		fullname: DF.Data | None
		r_status: DF.Literal["0", "1", "2", "3", "4", "5"]
		reg_contact_type: DF.Literal["", "cg", "hk", "tw", "jingwai"]
		team: DF.Link | None
		title: DF.Data | None
	# end: auto-generated types

	dashboard_fields = (
		"fullname",
		"title",
		"c_fn",
		"c_ln",
		"c_em",
		"c_ph",
		"c_ph_num",
		"c_ph_type",
		"c_org",
		"c_adr",
		"c_ct",
		"c_st",
		"c_pc",
		"c_regtype",
		"reg_contact_type",
		"team",
		"cocode",
		"c_idtype_gswl",
		"c_idnum_gswl",
		"c_sysid",
		"r_status"
	)

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

	def get_pg(self, pg):
		return pg
