import { million, thousand } from "@/helpers/utils";
import { Bracket, Law } from "@/data-source/types";

const FIRST_BRACKET: Bracket = {
    min: 1,
    max: thousand(600),
    stages: [
        {
            min: thousand(15),
            max: thousand(30),
            percentage: 0.025,
        },
        {
            min: thousand(30),
            max: thousand(45),
            percentage: 0.1,
        },
        {
            min: thousand(45),
            max: thousand(60),
            percentage: 0.15,
        },
        {
            min: thousand(60),
            max: thousand(200),
            percentage: 0.2,
        },
        {
            min: thousand(200),
            max: thousand(400),
            percentage: 0.225,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};

const SECOND_BRACKET: Bracket = {
    min: thousand(600),
    max: thousand(700),
    stages: [
        {
            min: 0,
            max: thousand(30),
            percentage: 0.025,
        },
        {
            min: thousand(30),
            max: thousand(45),
            percentage: 0.1,
        },
        {
            min: thousand(45),
            max: thousand(60),
            percentage: 0.15,
        },
        {
            min: thousand(60),
            max: thousand(200),
            percentage: 0.2,
        },
        {
            min: thousand(200),
            max: thousand(400),
            percentage: 0.225,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};

const THIRD_BRACKET: Bracket = {
    min: thousand(700),
    max: thousand(800),
    stages: [
        {
            min: 0,
            max: thousand(45),
            percentage: 0.1,
        },
        {
            min: thousand(45),
            max: thousand(60),
            percentage: 0.15,
        },
        {
            min: thousand(60),
            max: thousand(200),
            percentage: 0.2,
        },
        {
            min: thousand(200),
            max: thousand(400),
            percentage: 0.225,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};

const FOURTH_BRACKET: Bracket = {
    min: thousand(800),
    max: thousand(900),
    stages: [
        {
            min: 0,
            max: thousand(60),
            percentage: 0.15,
        },
        {
            min: thousand(60),
            max: thousand(200),
            percentage: 0.2,
        },
        {
            min: thousand(200),
            max: thousand(400),
            percentage: 0.225,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};
//diff applied
const FIFTH_BRACKET: Bracket = {
    min: thousand(900),
    max: million(1),
    stages: [
        {
            min: 0,
            max: thousand(200),
            percentage: 0.2,
        },
        {
            min: thousand(200),
            max: thousand(400),
            percentage: 0.225,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};
//diff applied

const SIXTH_BRACKET: Bracket = {
    min: million(1),
    max: Infinity,
    stages: [
        {
            min: 0,
            max: thousand(400),
            percentage: 0.255,
        },
        {
            min: thousand(400),
            max: Infinity,
            percentage: 0.25,
        },
    ],
};
export const TWENTY_TWO: Law = {
    brackets: [
        FIRST_BRACKET,
        SECOND_BRACKET,
        THIRD_BRACKET,
        FOURTH_BRACKET,
        FIFTH_BRACKET,
        SIXTH_BRACKET,
    ],
    exemptionThreshold: thousand(9),
    MaxGrossSalary: 9400,
    MinGrossSalary: 1400,
};
