Add license information.
[ustaxlib.git] / src / core / Person.ts
1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
5
6 export enum Relation {
7 Self,
8 Spouse,
9 Dependent,
10 };
11
12 export default class Person {
13 private _name: string;
14 private _relation: Relation;
15
16 static joint = Symbol('Joint') as unknown as Person;
17
18 constructor(name: string, relation: Relation) {
19 this._name = name;
20 this._relation = relation;
21 }
22
23 get name(): string {
24 return this._name;
25 }
26
27 get relation(): Relation {
28 return this._relation;
29 }
30
31 static self(name: string): Person {
32 return new Person(name, Relation.Self);
33 }
34
35 static spouse(name: string): Person {
36 return new Person(name, Relation.Spouse);
37 }
38
39 static dependent(name: string): Person {
40 return new Person(name, Relation.Dependent);
41 }
42 };