Files
tsclass/ts/business/contact.ts
2025-03-18 16:49:51 +00:00

61 lines
1.3 KiB
TypeScript

import { finance, general } from "../index.js";
import { business } from "../index.js";
export type TSocialLinks = {
type: "facebook" | "twitter" | "linkedin" | string;
url: string;
};
export type TRegistrationDetails = {
vatId: string;
registrationId: string;
registrationName: string;
};
type TContactEnvelope<TYPE extends string, FIELDS> = {
type: TYPE;
name: string;
address: business.IAddress;
description: string;
legalEntity?: string;
customerNumber?: string;
relationship?: "customer" | "supplier" | "partner" | "employee" | "other";
email?: string;
phone?: string;
fax?: string;
logoUrl?: string;
website?: string;
socials?: TSocialLinks[];
sepaConnection?: finance.ISepaConnection;
} & FIELDS;
export type TPerson = TContactEnvelope<
"person",
{
surname: string;
salutation: "Mr" | "Ms" | "Mrs";
sex: "male" | "female" | "other";
title: "Doctor" | "Professor";
registrationDetails?: TRegistrationDetails;
legalProxyFor?: {
type: "self" | "other";
contact?: TContact;
};
}
>;
export type TCompany = TContactEnvelope<
"company",
{
registrationDetails: TRegistrationDetails;
foundedDate: general.IDate;
closedDate: general.IDate;
status: "planned" | "founding" | "active" | "liquidation" | "closed";
}
>;
export type TContact = TPerson | TCompany;