> Module Taxes

```catala-metadata
declaration structure Individual:
  data income content money
  data number_of_children content integer

declaration scope IncomeTaxComputation:
  input current_date content date
  input individual content Individual
  input overseas_territories content boolean
  internal tax_rate content decimal
  output income_tax content money
```

## Article 1

The income tax for an individual is defined as a fixed percentage of the
individual's income over a year.

```catala
scope IncomeTaxComputation:
  definition income_tax equals
    individual.income * tax_rate
```

## Article 2 (version before 2000)

The fixed percentage mentioned at article 1 is equal to 20%.

```catala
scope IncomeTaxComputation:
  label article_2
  definition tax_rate
  under condition current_date < |2000-01-01|
  consequence equals
    20%
```

## Article 2 (version from 2000)

The fixed percentage mentioned at article 1 is equal to 21%.

```catala
scope IncomeTaxComputation:
  # The same label "article_2" as the previous definition groups them together
  label article_2
  definition tax_rate
  under condition current_date >= |2000-01-01|
  consequence equals
    21%
```

## Article 3

If the individual is in charge of 2 or more children, then the fixed
percentage mentioned at article 1 is equal to 15%.

```catala
scope IncomeTaxComputation:
  label article_3 exception article_2
  definition tax_rate
  under condition individual.number_of_children >= 2
  consequence equals
    15%
```

## Article 4

Individuals earning $10,000 or less are exempt from the income tax mentioned
at article 1.

```catala
scope IncomeTaxComputation:
  label article_4 exception article_3
  definition tax_rate
  under condition individual.income <= $10,000
  consequence equals
    0%
```

## Article 5

Individuals earning more than $100,000 are subject to a tax rate of
30%, regardless of their number of children.

```catala
scope IncomeTaxComputation:
  label article_5 exception article_3
  definition tax_rate
  under condition individual.income > $100,000
  consequence equals
    30%
```

## Article 6

In the overseas territories, the tax rate for individuals earning
more than $100,000 specified at article 5 is reduced to 25%.

```catala
scope IncomeTaxComputation:
  label article_6 exception article_5
  definition tax_rate
  under condition individual.income > $100,000 and overseas_territories
  consequence equals
    25%
```

## Article 7

When several individuals live together, they are collectively subject to
the household tax. The household tax owed is $10,000 per individual of the
household, and half that amount per child.

```catala-metadata
declaration scope HouseholdTaxComputation:
  input individuals content list of Individual
  input overseas_territories content boolean
  input current_date content date

  output household_tax content money

declaration scope HouseholdTaxIndividualComputation:
  input individual content Individual
  input overseas_territories content boolean
  input current_date content date

  income_tax_computation scope IncomeTaxComputation

  output household_tax content money
    state base
    state with_deduction
```

```catala
scope HouseholdTaxIndividualComputation:
  definition household_tax
    state base
  equals
    $10,000 * (1.0 + decimal of individual.number_of_children / 2.0)

scope HouseholdTaxComputation:
  definition household_tax
  equals
    Money.sum of
      map each individual among individuals to
        (
          output of HouseholdTaxIndividualComputation with {
            -- individual: individual
            -- overseas_territories: overseas_territories
            -- current_date: current_date
          }
        ).household_tax
```

## Article 8

The amount of income tax paid by each individual can be deducted from the
share of household tax owed by this individual.

```catala
scope HouseholdTaxIndividualComputation:
  definition income_tax_computation.individual equals
    individual
  definition income_tax_computation.overseas_territories equals
    overseas_territories
  definition income_tax_computation.current_date equals
    current_date

  definition household_tax
    state with_deduction
  equals
    if income_tax_computation.income_tax > household_tax then $0
    else
      household_tax - income_tax_computation.income_tax
```
