import type { Domain } from "@domainops/shared-types";
import { Tag } from "antd";

/**
 * Where a domain is hosted - server group and account as two tags. The one
 * rendering shared by the Domain Inventory list and the domain page, so the
 * two can never read differently.
 */
export function HeldAtTags({ account }: { account: Domain["server_account"] }) {
  if (!account) return <>—</>;

  return (
    <div className="flex flex-col items-center justify-center gap-1">
      <Tag variant="filled" className="dms_held_tag dms_held_tag--server dms_domains_held_at_server_tag">
        {account.server_group?.label ?? "?"}
      </Tag>
      <Tag variant="filled" className="dms_held_tag dms_held_tag--account dms_domains_held_at_account_tag">
        {account.username}
      </Tag>
    </div>
  );
}
