Strongly type Form lines.
[ustaxlib.git] / src / fed2019 / FormW2.ts
1 import Form from '../Form';
2 import { Line, InputLine } from '../Line';
3 import Person from '../Person';
4
5 export enum Box13 {
6 StatutoryEmployee,
7 RetirementPlan,
8 ThirdPartySickPay
9 };
10
11 export interface CodeAndAmount {
12 code: string;
13 amount: number;
14 };
15
16 export interface W2Input {
17 employer: string;
18 employee: Person;
19 wages?: number;
20 fedIncomeTax?: number;
21 socialSecurityWages?: number;
22 socialSecuirtyTax?: number;
23 medicareWages?: number;
24 medicareTax?: number;
25 socialSecurityTips?: number;
26 allocatedTips?: number;
27 dependentCareBenefits?: number;
28 nonqualifiedPlans?: number;
29 box12?: CodeAndAmount[];
30 box13?: Box13;
31 box14?: CodeAndAmount[];
32 };
33
34 class Input<T extends keyof W2Input> extends InputLine<W2Input, T> {};
35
36 export default class W2 extends Form<W2['_lines'], W2Input> {
37 readonly name = 'W-2';
38
39 readonly supportsMultipleCopies = true;
40
41 protected readonly _lines = {
42 'c': new Input('c', 'employer', 'Employer name'),
43 'e': new Input('e', 'employee', 'Emplyee name'),
44 '1': new Input('1', 'wages', 'Wages, tips, other compensation'),
45 '2': new Input('2', 'fedIncomeTax', 'Federal income tax withheld'),
46 '3': new Input('3', 'socialSecurityWages', 'Social security wages'),
47 '4': new Input('4', 'socialSecuirtyTax', 'Social security tax withheld'),
48 '5': new Input('5', 'medicareWages', 'Medicare wages and tips'),
49 '6': new Input('6', 'medicareTax', 'Medicare tax withheld'),
50 '7': new Input('7', 'socialSecurityTips', 'Social security tips'),
51 '8': new Input('8', 'allocatedTips', 'Allocated tips'),
52 '10': new Input('10', 'dependentCareBenefits', 'Dependent care benefits'),
53 '11': new Input('11', 'nonqualifiedPlans','Nonqualified plans'),
54 '12': new Input('12', 'box12', 'Box 12'),
55 '13': new Input('13', 'box13', 'Box 13'),
56 '14': new Input('14', 'box14', 'Other'),
57 };
58 };