@tsclass/tsclass
Version:
Provides TypeScript definitions for various business, financial, networking, content, and other common classes.
63 lines (62 loc) • 1.8 kB
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;
};
}>;
type TCompanyInCreation = {
status: "planned" | "founding";
};
type TCompanyActive = {
status: "active";
foundedDate: general.IDate;
};
type TCompanyInLiquidation = {
status: "liquidation";
foundedDate: general.IDate;
liquidationDate: general.IDate;
};
type TCompanyClosed = {
status: "closed";
foundedDate: general.IDate;
liquidationDate: general.IDate;
closedDate: general.IDate;
};
type TCompanyStatus = TCompanyInCreation | TCompanyActive | TCompanyInLiquidation | TCompanyClosed;
export type TCompany = TContactEnvelope<"company", {
registrationDetails: TRegistrationDetails;
} & TCompanyStatus>;
export type TContact = TPerson | TCompany;
export {};