1 import Form from '../Form';
2 import TaxReturn from '../TaxReturn';
3 import { ComputedLine } from '../Line';
4 import { UnsupportedFeatureError } from '../Errors';
6 import Form1040, { FilingStatus } from './Form1040';
7 import Form8959 from './Form8959';
9 export default class Schedule2 extends Form<Schedule2['_lines']> {
10 readonly name = 'Schedule 2';
12 protected readonly _lines = {
13 '1': new ComputedLine((tr): number => {
14 // TODO - this is just using Taxable Income, rather than AMT-limited
16 const f1040 = tr.getForm(Form1040);
17 const taxableIncome = f1040.getValue(tr, '11b');
18 switch (f1040.getInput('filingStatus')) {
19 case FilingStatus.Single:
20 if (taxableIncome < 510300)
22 case FilingStatus.MarriedFilingJoint:
23 if (taxableIncome < 1020600)
25 case FilingStatus.MarriedFilingSeparate:
26 if (taxableIncome < 510300)
29 throw new UnsupportedFeatureError('The AMT is not supported');
31 '2': new ComputedLine(() => 0, 'Excess advance premium tax credit repayment'), // Not supported.
32 '3': new ComputedLine((tr): number => {
33 // Should include line 2.
34 return this.getValue(tr, '1');
37 // 4 is not supported (Self-employment tax.)
38 // 5 is not supported (Unreported social security and Medicare tax from)
39 // 6 is not supported (Additional tax on IRAs, other qualified retirement plans, and other tax-favored accounts)
40 // 7 is not supported (Household employment taxes.)
41 '8': new ComputedLine((tr): number => {
42 const f1040 = tr.getForm(Form1040);
43 const wages = f1040.getLine('1').value(tr);
46 const filingStatus = f1040.getInput('filingStatus');
48 const additionalMedicare = wages > Form8959.filingStatusLimit(filingStatus);
50 switch (f1040.getInput('filingStatus')) {
51 case FilingStatus.Single:
56 case FilingStatus.MarriedFilingJoint:
61 case FilingStatus.MarriedFilingSeparate:
70 if (additionalMedicare) {
71 const f8959 = tr.getForm(Form8959);
72 value += f8959.getValue(tr, '18');
76 //const f8960 = tr.getForm('8960');
81 // 9 is not supported (Section 965 net tax liability installment from Form 965-A)
83 '10': new ComputedLine((tr): number => {
84 // Should be lines 4 - 8.
85 return this.getValue(tr, '8');