<?php

namespace App;

use App\Http\Controllers\Admin\ConsumerApplicationController;
use App\Http\Controllers\Grade\GradeController;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use MathPHP\Finance;

class CreditLine{

    //Customer Data
    public $Customer_Name;
    public $age;
    public $state_name;
    public $occupation;
    public $applicant_residential;
    public $co_applicant_residential;

    public $loan_amount_required = 0;
    public $loan_tenure;
    public $Interest_rate;
    public $Applicant_income = 0;
    public $co_applicant_income = 0;
    public $applicant_fixed_obligation = 0;
    public $co_applicant_fixed_obiligation = 0;


    //Merchant Data
    public $purpose_of_loan;
    public $loan_from_existing_merchant = 'NO';
    public $merchant_name;
    public $merchant_id;
    public $Txns_in_Bank = 0;
    public $amount_of_txns_with_loan_in_percentage = 0;

    public $applicant_eligible_FOIR;
    public $co_applicant_eligible_FOIR;
    public $eligible_income;
    public $credit_card_limit;
    public $total_obligation;
    public $total_income_available_to_serve_loan;
    public $negative_profile;


    //Credit Details
    public $credit_bureau_score;
    public $count_of_sub_sma_dbt_lss = 0;
    public $count_of_settled_written_off = 0;
    public $past_sanction_average_amount = 0;
    public $past_sanction_maximum_amount = 0;
    public $closed_account = 0;
    public $overdue_bucket = 0;
    public $enquiry = 0;
    public $dpd_bucket = 0;

    public $Total_Income;

    public $max_loan_amount = 0;
    private $request;
    private $application;
    public $hasCreditReport = 0;
    public $hasFinBit = 0;
    public $bucket;
    public $hasAccount = 0;
    private $estimatesNormal;

    public function __construct(Request $request){

        $this->request = $request;
        $this->setInput();
        $this->bucket = new Bucket($this);
        $this->predict();
    }

    public function getCreditData(){
        return [
            'max_loan_amount_to_sanction_basis_ml' => round($this->max_loan_amount,2),
            'eligible_emi_amount_ml' => round(Finance::pmt((($this->Interest_rate/100)/12), $this->loan_tenure, -($this->max_loan_amount)),2),
            'alert_flag' => $this->getAlertFlag(),
            'max_loan_amount_to_sanction_basis_foir' => round(Finance::pv(($this->Interest_rate/100)/12,$this->loan_tenure,-$this->total_income_available_to_serve_loan, 0.00),2),
            'eligible_emi_amount_basis_foir' => round($this->total_income_available_to_serve_loan,2),
            'credit_line' => $this,
            'bucket' => $this->bucket
        ];
    }

    private function getAlertFlag(){
        $flag = "Loan should not be sanctioned";
        if($this->negative_profile == 'Yes'){
            return $flag;
        }else if ($this->count_of_sub_sma_dbt_lss > 0){
            return $flag;
        }else if ($this->count_of_settled_written_off > 0){
            return $flag;
        }else if ($this->overdue_bucket == $this->bucket->overdue_bucket[3]){
            return $flag;
        }else if ($this->credit_bureau_score == $this->bucket->credit_bureau_score[2]){
            return $flag;
        }

        return "";
    }

    private function setCreditData($estimatesNormal){
        $this->max_loan_amount = $estimatesNormal->estimationProduct;
        $this->estimatesNormal = $estimatesNormal;
    }

    private function predict(){
        $estimatesNormal = new Estimation($this, $this->bucket);
        $this->setCreditData($estimatesNormal);
    }

    private function setInput(){
        $this->application = ConsumerApplication::with('offer','category','creditReport','foir','finBitData')->where('id',$this->request->get('id'))->first();

        $this->calculateFOIR();

        $this->Customer_Name = $this->application->name;
        $this->age = $this->application->Age;
        $this->state_name = strtoupper($this->application->current_address_state);
        $this->occupation = $this->application->employee_status;
        $this->applicant_residential = $this->application->current_address_status;
        $this->co_applicant_residential = $this->application->co_applicant_address_status;

        $this->loan_amount_required = $this->application->loan_amount;
        $this->loan_tenure = $this->application->offer->tenure;
        $this->Interest_rate = $this->application->offer->interest_rate;
        $this->Applicant_income = $this->application->monthly_income;
        $this->co_applicant_income = $this->application->co_applicant_monthly_income;

        $this->purpose_of_loan = $this->getPurposeOfLoan($this->application->category->name);
        $this->loan_from_existing_merchant = $this->isLoanFromExisting();
        $this->merchant_name = $this->application->merchant->merchant_name;
        $this->merchant_id = $this->application->merchant->id;
        $this->negative_profile = $this->application->application_element && $this->application->application_element->negative_profile > 0 ? 'Yes' : 'No';
        $this->Total_Income = $this->Applicant_income + $this->co_applicant_income;
        $this->credit_bureau_score = $this->getCreditScore();
        $this->setBucketData();
        $this->eligible_income = (($this->Applicant_income/100) * 60) + (($this->co_applicant_income/100) * 60);
        $this->total_obligation = (($this->applicant_fixed_obligation + $this->co_applicant_fixed_obiligation + (($this->credit_card_limit * 5) / 100)));
        $this->total_income_available_to_serve_loan = $this->eligible_income - $this->total_obligation;
        $this->setFinBitBankTransaction();
    }

    public function getPurposeOfLoan($purpose){
            switch ($purpose){
                case 'Personal Loan':
                    return 'Personal Loan';
                    break;
                case 'Education':
                    return 'Education';
                    break;
                case 'Electronic Products':
                    return 'Electronic Products';
                        break;
                case 'Electronic Vehicles':
                case 'Electronic Battery':
                    return 'Electronic Vehicles';
                        break;
                case 'Other':
                case 'Salary Advance':
                case 'Dealer Financing':
                    return 'Other';
                        break;
                case 'Loose Furniture':
                    return 'Home Decor';
                        break;
                case 'Dental Care':
                case 'Stemcell banking and treatment':
                case 'IVF and Fertility Treatments':
                case 'Multispeciality Treatments':
                case 'Modular Kitchen, wardrobes and Interior':
                case 'Home Automation':
                case 'Solar and Rooftop Solutions':
                case 'Cosmetics':
                    return 'Healthcare';
                        break;
                default:
                    return 'Other';
            }
    }

    public function setFinBitBankTransaction(){
        if ($this->application->finBitData) {
            $this->hasFinBit = true;
            $sixMonth = Carbon::now()->subMonth(6)->startOfDay()->timestamp;
            foreach ($this->application->finBitData as $finBitItem) {
                if (strtotime($finBitItem) > $sixMonth) {
                    $this->Txns_in_Bank = $finBitItem->net_debit_txn + $finBitItem->net_credit_txn;
                }
            }
        }
    }

    public function setBucketData(){

        $this->loadFile();

        if($this->application->creditReport && isset($this->application->creditReport[0])) {
            $this->hasCreditReport = true;
            $noDPDDateRange = Carbon::now()->subYear(2)->startOfDay()->toDateTimeString();
            $sanctionAmount = [0];
            if ($this->application->foir && isset($this->application->foir[0])) {
                $this->hasAccount++;
                foreach ($this->application->foir as $foir) {
                    if ($foir->applicant_type == 1 && !$foir->isOpened) {
                        $this->closed_account++;
                    }

                    $foirData = json_decode($foir->dpd, 1);


                    if (strtotime($foir->DateOpened) <= strtotime($noDPDDateRange)) {
                        foreach ($foirData as $key => $item) {
                            if (!in_array($key, ['NEW', '*', '000', 'CLSD'])) {
                                $this->dpd_bucket += $item;
                            }
                        }
                    }

                    if ($foirData) {
                        $caseType = array_keys($foirData);
                        if ($caseType) {
                            foreach ($caseType as $type) {
                                if (in_array($type, ['PWOS', 'SET', 'SUB','SMA','DBT','LSS'])) {
                                    $this->count_of_sub_sma_dbt_lss++;
                                }
                            }
                        }
                    }

                    if ($foir->applicant_type == 1 && $foir->isOpened && $foir->cc_loan && $foir->AccountType != 'Credit Fair EMI') {
                        $this->applicant_fixed_obligation += $foir->InstallmentAmount;
                    }
                    if ($foir->applicant_type == 2 && $foir->isOpened && $foir->cc_loan && $foir->AccountType != 'Credit Fair EMI') {
                        $this->co_applicant_fixed_obiligation += $foir->InstallmentAmount;
                    }

                    $sanctionAmount[] = $foir->ApprovedAmount;
                    $this->overdue_bucket += $foir->PastDueAmount;
                }
            }

            $this->past_sanction_maximum_amount = max($sanctionAmount);
            $this->enquiry = ($this->application->creditReport[0]->TotalEnquiry == 0 && $this->hasAccount == 0 ? 1 : (($this->application->creditReport[0]->TotalEnquiry >= 0 && $this->application->creditReport[0]->TotalEnquiry <= 2) ? 2 : 3));
            $this->credit_card_limit = $this->application->creditReport[0]->activeCreditCardLimit;
        }
    }

    public function loadFile(){
        $applicationController = new ConsumerApplicationController();
        $applicationController->isInternal = true;
        $data = $applicationController->getCibilReport($this->application->id, 1);
        if (!$applicationController->isRedirect)
            $this->populateData($data);
    }

    public function populateData($data){
        if(isset($data['report_data'])) {
            $data = $data['report_data'];
            $this->past_sanction_average_amount = isset($data['sch:ReportData']['sch:AccountSummary']['sch:AverageOpenBalance']) ? $data['sch:ReportData']['sch:AccountSummary']['sch:AverageOpenBalance'] : 0;
            $this->count_of_settled_written_off = isset($data['sch:ReportData']['sch:AccountSummary']['sch:NoOfWriteOffs']) ? $data['sch:ReportData']['sch:AccountSummary']['sch:NoOfWriteOffs'] : 0;
        }
    }

    public function getCreditScore(){
        if($this->application->creditReport && isset($this->application->creditReport[0])){
            $creditReport = $this->application->creditReport[0]->applicant_type == 1 ? $this->application->creditReport[0] : (isset($this->application->creditReport[1]) && $this->application->creditReport[1]->applicant_type == 1 ? $this->application->creditReport[1] : 0);
            if ($creditReport)
                return (($creditReport->Score >= -6 && $creditReport->Score <= 6) ? 1 : ($creditReport->Score <= 500 ? 2 : ($creditReport->Score <= 600 ? 3 : (($creditReport->Score < 650 ? 4 : ((($creditReport->Score <= 750 ? 5 : 6))))))));
        }
        return 1;
    }

    private function isLoanFromExisting(){
        $isExisting = ConsumerApplication::where('id', $this->application->id)->where('merchant_id', $this->application->merchant->id)->first(['id','merchant_id']);
        return isset($isExisting->id) && $isExisting->merchant_id != 21 ? 'Yes' : 'No';
    }

    private function calculateFOIR(){
        $applicantFOIR = $this->getFOIRByType(1);
        $this->applicant_eligible_FOIR = $applicantFOIR['applicantFoirNAIncludingCFEMI'];

        $coApplicantFOIR = $this->getFOIRByType(2);
        $this->co_applicant_eligible_FOIR = $coApplicantFOIR['applicantFoirNAIncludingCFEMI'];
    }

    private function getFOIRByType($type){
        $applicantFoirData = FOIR::where('application_id', $this->application->id)->where('AccountType', '!=', 'Credit Fair EMI')->where('applicant_type', $type)->get();
        $gradeController = new GradeController($this->request);
        $gradeController->applicant_type = $type;
        foreach ($applicantFoirData as $foir) {
            $gradeController->setFOIRAttributes($foir);
        }
        $gradeController->getFOIRCalculation($this->application);

        $applicantFoirIncludingCFEMI = $gradeController->foirIncludingCFEMI;
        $applicantFoirNAIncludingCFEMI = $gradeController->foirNAIncludingCFEMI;

        return ['applicantFoirIncludingCFEMI' => $applicantFoirIncludingCFEMI, 'applicantFoirNAIncludingCFEMI' => $applicantFoirNAIncludingCFEMI];
    }

}

class Estimation{
    public $Age_Bucket = 'Age.Bucket';
    public $Purpose = 'Purpose';
    public $statename = 'statename';
    public $Occ_Bucket = 'Occ.Bucket';
    public $Income_Bucket = 'Income.Bucket';
    public $Bureau_Score_Bucket = 'Bureau.Score.Bucket';
    public $Past_Sanction_Greater_than_Loan_Amount = 'Past.Sanction.Greater.than.Loan.Amount';
    public $Closed_Account = 'Closed.Account';
    public $Overdue_Bucket = 'Overdue.Bucket';
    public $Enquiry = 'Enquiry';
    public $DPD_Bucket = 'DPD.Bucket';
    public $Txn_Bucket = 'Txn.Bucket';
    public $Txn_Amount_by_Loan_Amount = 'Txn.Amount.by.Loan.Amount';
    public $Final_Address_Status = 'Final.Address.Status';
    public $FOIR_bucket = 'FOIR.bucket';
    public $Total_Income = 'Total Income';
    //public $Income_Bucket_1;
    public $Merchant_ID = 'Merchant.ID';
    public $Past_Average_Sanction_Amount = 'Past.Average.Sanction.Amount';
    public $Past_Maximum_Average_Sanction_Amount = 'Past.Maximum.Average.Sanction.Amount';
    private $estimationData;
    private $creditLine;
    private $bucket;
    private $estimationProductArray = array();
    public $estimationProduct;

    public function __construct(CreditLine $creditLine, Bucket $bucket){
        $this->creditLine = $creditLine;
        $this->bucket = $bucket;
        $this->setInput();
        $this->loadEstimation();
        $this->setEstimation();
    }

    public function setInput(){
        $this->Age_Bucket = $this->Age_Bucket.$this->bucket->getBucketItem($this->Age_Bucket);
        $this->Purpose = $this->Purpose.$this->bucket->getBucketItem($this->Purpose);
        $this->statename = $this->statename.$this->bucket->getBucketItem($this->statename);
        $this->Occ_Bucket = $this->Occ_Bucket.$this->bucket->getBucketItem($this->Occ_Bucket);
        $this->Income_Bucket = $this->Income_Bucket.$this->bucket->getBucketItem($this->Income_Bucket);
        $this->Bureau_Score_Bucket = $this->Bureau_Score_Bucket.$this->bucket->getBucketItem($this->Bureau_Score_Bucket);
        $this->Past_Sanction_Greater_than_Loan_Amount = $this->Past_Sanction_Greater_than_Loan_Amount.$this->bucket->getBucketItem($this->Past_Sanction_Greater_than_Loan_Amount);
        $this->Closed_Account = $this->Closed_Account.$this->bucket->getBucketItem($this->Closed_Account);
        $this->Overdue_Bucket = $this->Overdue_Bucket.$this->bucket->getBucketItem($this->Overdue_Bucket);
        $this->Enquiry = $this->Enquiry.$this->bucket->getBucketItem($this->Enquiry);
        $this->DPD_Bucket = $this->DPD_Bucket.$this->bucket->getBucketItem($this->DPD_Bucket);
        $this->Txn_Bucket = $this->Txn_Bucket.$this->bucket->getBucketItem($this->Txn_Bucket);
        $this->Txn_Amount_by_Loan_Amount = $this->Txn_Amount_by_Loan_Amount.$this->bucket->getBucketItem($this->Txn_Amount_by_Loan_Amount);
        $this->Final_Address_Status = $this->Final_Address_Status.$this->bucket->getBucketItem($this->Final_Address_Status);
        $this->FOIR_bucket = $this->FOIR_bucket.$this->bucket->getBucketItem($this->FOIR_bucket);
        $this->Total_Income = $this->Total_Income.$this->bucket->getBucketItem($this->Total_Income);
        $this->Past_Average_Sanction_Amount = $this->Past_Average_Sanction_Amount.$this->bucket->getBucketItem($this->Past_Average_Sanction_Amount);
        $this->Past_Maximum_Average_Sanction_Amount = $this->Past_Maximum_Average_Sanction_Amount.$this->bucket->getBucketItem($this->Past_Maximum_Average_Sanction_Amount);

        if($this->creditLine->loan_from_existing_merchant == 'Yes'){
            $this->Merchant_ID = $this->Merchant_ID.$this->bucket->getBucketItem($this->Merchant_ID);
        }

    }

    public function get(){
        return $this;
    }

    public function loadEstimation(){
        if($this->creditLine->loan_from_existing_merchant == 'No') {
            $this->estimationData = [
                '(Intercept)' => [
                    'check' => true,
                    'multiplier' => 1,
                    'estimate' => 17260.7406231514000000,
                ],
                'Age.Bucket26 to 35' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 264.9656112621130000,
                ],
                'Age.Bucket36 to 50' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2484.2634155171100000,
                ],
                'Age.Bucket51 to 60' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3294.3574014676700000,
                ],
                'Age.BucketMore than 60' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -522.8604188799570000,
                ],
                'PurposeElectronicProducts' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1635.4910358725600000,
                ],
                'PurposeElectronicVehicles' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 383.8635787140940000,
                ],
                'PurposeHealthcare' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7952.6477751293100000,
                ],
                'PurposeHomeDecor' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 700.4096033190340000,
                ],
                'PurposeOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 27615.8981503443000000,
                ],
                'PurposePersonalLoan' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -19211.6470731648000000,
                ],
                'PurposeTravel' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -547.9505372888970000,
                ],
                'statenameASSAM' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -11023.4394694559000000,
                ],
                'statenameBIHAR' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 10763.3713797626000000,
                ],
                'statenameCHATTISGARH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 778.6228112916250000,
                ],
                'statenameDELHI' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5763.2746559969500000,
                ],
                'statenameGUJARAT' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3000.9117988990800000,
                ],
                'statenameHARYANA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 11497.8194420610000000,
                ],
                'statenameHIMACHAL PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 27696.8205748777000000,
                ],
                'statenameJAMMU & KASHMIR' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -18506.2288756943000000,
                ],
                'statenameJHARKHAND' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2033.1592605073100000,
                ],
                'statenameKARNATAKA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 16422.1075876523000000,
                ],
                'statenameKERALA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -10843.4817018641000000,
                ],
                'statenameMADHYA PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -345.6952375741950000,
                ],
                'statenameMAHARASHTRA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3161.8173066477200000,
                ],
                'statenameMissing' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4433.2549516644400000,
                ],
                'statenameODISHA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -28734.8945594665000000,
                ],
                'statenamePUNJAB' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -38461.8164026574000000,
                ],
                'statenameRAJASTHAN' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4101.1072551333500000,
                ],
                'statenameTAMIL NADU' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 19941.9216589176000000,
                ],
                'statenameTELANGANA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1633.2553214043900000,
                ],
                'statenameUTTAR PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2266.5588891925800000,
                ],
                'statenameUTTARAKHAND' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3902.6890229743600000,
                ],
                'statenameWEST BENGAL' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -14350.0178250159000000,
                ],
                'Occ.BucketSelf Employed - Business' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6014.7307784975600000,
                ],
                'Occ.BucketSelf Employed - Professional' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6661.6636741485900000,
                ],
                'Occ.BucketUNEMPLOYED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -847.5655263153860000,
                ],
                'Loan.Amount.Requested' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->loan_amount_required,
                    'estimate' => 0.7855210595874190,
                ],
                'Income.Bucket1L-2L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 16374.1125391299000000,
                ],
                'Income.Bucket25K-50K' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2844.1064068727700000,
                ],
                'Income.Bucket50k-1L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 7377.3030241881900000,
                ],
                'Income.BucketMore than 2L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 18661.1184208307000000,
                ],
                'Bureau.Score.Bucket2.Very Risky' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6633.3640461455300000,
                ],
                'Bureau.Score.Bucket3.Risky' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3945.7413809494600000,
                ],
                'Bureau.Score.Bucket4.Average' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1520.7870699246100000,
                ],
                'Bureau.Score.Bucket5.Good' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1797.8106210366100000,
                ],
                'Bureau.Score.Bucket6.Very Good' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2233.3849544992500000,
                ],
                'Closed.AccountGood Record of Closing' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3333.8432665108400000,
                ],
                'Closed.AccountNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1050.6838853914100000,
                ],
                'Overdue.BucketMore than 5K' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -5907.0286203442700000,
                ],
                'Overdue.BucketNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -731.9203826665100000,
                ],
                'EnquiryMore than 2' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -8505.6978251613100000,
                ],
                'EnquiryNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4345.9601449601500000,
                ],
                'DPD.BucketMore than 1 DPD' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4630.3076011991600000,
                ],
                'DPD.BucketNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -767.8985128795520000,
                ],
                'Txn.Bucket19-36' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 7769.0488697113000000,
                ],
                'Txn.Bucket7-18' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3994.9733016212000000,
                ],
                'Txn.BucketMore than 36' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7201.3121514295400000,
                ],
                'Txn.Amount.by.Loan.AmountLess than 100' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1237.7865032739200000,
                ],
                'Txn.Amount.by.Loan.AmountMore than 500' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2736.6288008556300000,
                ],
                'Txn.Amount.by.Loan.AmountNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7800.3787995855700000,
                ],
                'Final.Address.StatusOtherParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 6821.0205494494500000,
                ],
                'Final.Address.StatusOtherRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3277.8360290049400000,
                ],
                'Final.Address.StatusOtherRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -473.3648183492340000,
                ],
                'Final.Address.StatusOtherSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5151.4575742077000000,
                ],
                'Final.Address.StatusParent OwnedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -5521.0262365300700000,
                ],
                'Final.Address.StatusParent OwnedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7490.8151656548300000,
                ],
                'Final.Address.StatusParent OwnedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -28362.0124184601000000,
                ],
                'Final.Address.StatusParent OwnedRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -9360.2186656611400000,
                ],
                'Final.Address.StatusParent OwnedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -8390.5139016161700000,
                ],
                'Final.Address.StatusRentedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2905.7030673281900000,
                ],
                'Final.Address.StatusRentedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4359.4759321691600000,
                ],
                'Final.Address.StatusRentedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -17159.8097792287000000,
                ],
                'Final.Address.StatusRentedRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6777.5279828858700000,
                ],
                'Final.Address.StatusRentedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 10940.9872403677000000,
                ],
                'Final.Address.StatusSelf OwnedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1439.4453114225600000,
                ],
                'Final.Address.StatusSelf OwnedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4105.2279838174000000,
                ],
                'Final.Address.StatusSelf OwnedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12443.8256957500000000,
                ],
                'Final.Address.StatusSelf OwnedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 15393.2146835842000000,
                ],
                'Count.of.SUB.SMA.DBT.LSS' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->count_of_sub_sma_dbt_lss,
                    'estimate' => -18966.5695404711000000,
                ],
                'Count.of.Settled...Written.off.accounts' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->count_of_settled_written_off,
                    'estimate' => -5009.9337485885100000,
                ],
                'Past.Average.Sanction.AmountMore than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3679.6221424001900000,
                ],
                'Past.Average.Sanction.AmountLess than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2694.1079653514800000,
                ],
                'Past.Maximum.Average.Sanction.AmountMore than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3362.8684560859800000,
                ],
                'Past.Maximum.Average.Sanction.AmountLess than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -554.9777816169980000,
                ]
            ];
        }else{
            $this->estimationData = [
                '(Intercept)' => [
                    'check' => true,
                    'multiplier' => 1,
                    'estimate' => 9874.191697964580,
                ],
                'Age.Bucket26 to 35' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -198.382587167900,
                ],
                'Age.Bucket36 to 50' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 480.525605522191,
                ],
                'Age.Bucket51 to 60' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1438.925335444950,
                ],
                'Age.BucketMore than 60' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2824.017015540920,
                ],
                'PurposeElectronicProducts' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6633.209067435980,
                ],
                'PurposeElectronicVehicles' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 8155.715831515360,
                ],
                'PurposeHealthcare' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 57687.915401225800,
                ],
                'PurposeHomeDecor' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 6231.532554884860,
                ],
                'PurposeOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 31646.321979839100,
                ],
                'PurposePersonalLoan' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 187205.812891917000,
                ],
                'PurposeTravel' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 8631.251575262120,
                ],
                'statenameASSAM' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -35574.328952900500,
                ],
                'statenameBIHAR' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 11612.155257373700,
                ],
                'statenameCHATTISGARH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -18.030408705799,
                ],
                'statenameDELHI' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5862.493126109460,
                ],
                'statenameGUJARAT' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3858.288290767300,
                ],
                'statenameHARYANA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12845.676069913700,
                ],
                'statenameHIMACHAL PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 21299.830951757000,
                ],
                'statenameJAMMU & KASHMIR' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -20784.256839890600,
                ],
                'statenameJHARKHAND' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4985.204433928380,
                ],
                'statenameKARNATAKA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 6401.514425258450,
                ],
                'statenameKERALA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -12287.502017047600,
                ],
                'statenameMADHYA PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4577.974709183900,
                ],
                'statenameMAHARASHTRA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 6520.923884632480,
                ],
                'statenameMissing' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1262.447318709630,
                ],
                'statenameODISHA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -55041.919538715900,
                ],
                'statenamePUNJAB' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -38239.844377315100,
                ],
                'statenameRAJASTHAN' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1021.205027939080,
                ],
                'statenameTAMIL NADU' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 7572.840819846260,
                ],
                'statenameTELANGANA' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -426.545279675214,
                ],
                'statenameUTTAR PRADESH' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2152.825312947380,
                ],
                'statenameUTTARAKHAND' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4159.696584424830,
                ],
                'statenameWEST BENGAL' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -15372.005668015900,
                ],
                'Occ.BucketSelf Employed - Business' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2546.701546266920,
                ],
                'Occ.BucketSelf Employed - Professional' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2710.255670169120,
                ],
                'Occ.BucketUNEMPLOYED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -502.927720747730,
                ],
                'Loan.Amount.Requested' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->loan_amount_required,
                    'estimate' => 0.771399480060176,
                ],
                'Income.Bucket1L-2L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5067.820103575280,
                ],
                'Income.Bucket25K-50K' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1301.507960650500,
                ],
                'Income.Bucket50k-1L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1756.508837038950,
                ],
                'Income.BucketMore than 2L' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 25801.945577197400,
                ],
                'Bureau.Score.Bucket2.Very Risky' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -8960.007880753950,
                ],
                'Bureau.Score.Bucket3.Risky' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4237.363486814890,
                ],
                'Bureau.Score.Bucket4.Average' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1707.696779214660,
                ],
                'Bureau.Score.Bucket5.Good' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2714.408946469100,
                ],
                'Bureau.Score.Bucket6.Very Good' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4180.015696255780,
                ],
                'Closed.AccountGood Record of Closing' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2275.629803589610,
                ],
                'Closed.AccountNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2639.778196833190,
                ],
                'Overdue.BucketMore than 5K' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6172.883631990400,
                ],
                'Overdue.BucketNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -22.650393146249,
                ],
                'EnquiryMore than 2' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4068.244656119970,
                ],
                'EnquiryNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2052.075561907650,
                ],
                'DPD.BucketMore than 1 DPD' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1659.085044894920,
                ],
                'DPD.BucketNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 679.741310338610,
                ],
                'Txn.Bucket19-36' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 9.220180625652,
                ],
                'Txn.Bucket7-18' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4436.651908429800,
                ],
                'Txn.BucketMore than 36' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6575.903068527710,
                ],
                'Txn.Amount.by.Loan.AmountLess than 100' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1537.023915457810,
                ],
                'Txn.Amount.by.Loan.AmountMore than 500' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -8273.256153977540,
                ],
                'Txn.Amount.by.Loan.AmountNo Data' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -11757.643467754700,
                ],
                'Final.Address.StatusOtherParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 11380.737319645300,
                ],
                'Final.Address.StatusOtherRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 6106.981496579580,
                ],
                'Final.Address.StatusOtherRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2108.557297675270,
                ],
                'Final.Address.StatusOtherSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2537.481674209190,
                ],
                'Final.Address.StatusParent OwnedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4102.626230304740,
                ],
                'Final.Address.StatusParent OwnedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7917.231564285260,
                ],
                'Final.Address.StatusParent OwnedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -29774.441915350200,
                ],
                'Final.Address.StatusParent OwnedRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -17183.099321844500,
                ],
                'Final.Address.StatusParent OwnedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6142.544084781850,
                ],
                'Final.Address.StatusRentedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1215.689609082440,
                ],
                'Final.Address.StatusRentedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2918.417565894940,
                ],
                'Final.Address.StatusRentedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -9780.983673644480,
                ],
                'Final.Address.StatusRentedRented With Family' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1420.448824686710,
                ],
                'Final.Address.StatusRentedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2061.731832642910,
                ],
                'Final.Address.StatusSelf OwnedOther' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1662.039930554720,
                ],
                'Final.Address.StatusSelf OwnedParent Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1974.465461786470,
                ],
                'Final.Address.StatusSelf OwnedRENTED' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 22584.431324126300,
                ],
                'Final.Address.StatusSelf OwnedSelf Owned' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1464.782284603300,
                ],
                'Merchant.ID2' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -84663.638032629200,
                ],
                'Merchant.ID3' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 82636.770113564600,
                ],
                'Merchant.ID5' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4161.909288262680,
                ],
                'Merchant.ID6' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -10792.876829106300,
                ],
                'Merchant.ID8' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -48230.896802702700,
                ],
                'Merchant.ID9' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 41229.096370753000,
                ],
                'Merchant.ID10' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -60295.154205022100,
                ],
                'Merchant.ID17' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 29795.647199884100,
                ],
                'Merchant.ID18' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 19249.779314372700,
                ],
                'Merchant.ID19' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 73009.711880096300,
                ],
                'Merchant.ID21' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -199501.323459502000,
                ],
                'Merchant.ID22' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3845.610660015270,
                ],
                'Merchant.ID23' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2162.024304109960,
                ],
                'Merchant.ID27' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1161.759773934380,
                ],
                'Merchant.ID30' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2368.811846453190,
                ],
                'Merchant.ID32' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -158304.286280052000,
                ],
                'Merchant.ID34' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3075.855140985600,
                ],
                'Merchant.ID35' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3223.434452061130,
                ],
                'Merchant.ID36' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1772.643630265470,
                ],
                'Merchant.ID37' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -768.765507487679,
                ],
                'Merchant.ID39' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2031.470600892950,
                ],
                'Merchant.ID40' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -40589.135542115700,
                ],
                'Merchant.ID41' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5820.078829987650,
                ],
                'Merchant.ID42' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -11366.393572650900,
                ],
                'Merchant.ID43' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -12875.172235955600,
                ],
                'Merchant.ID44' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -28270.626419610700,
                ],
                'Merchant.ID45' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -93.576775556595,
                ],
                'Merchant.ID46' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -130854.432092345000,
                ],
                'Merchant.ID48' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -50197.001237463300,
                ],
                'Merchant.ID49' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 14375.210546949000,
                ],
                'Merchant.ID55' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -674.321615641664,
                ],
                'Merchant.ID56' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -72522.756311645200,
                ],
                'Merchant.ID63' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7305.606185862240,
                ],
                'Merchant.ID64' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7153.205332335490,
                ],
                'Merchant.ID65' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -56960.228417780400,
                ],
                'Merchant.ID66' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -60629.611506127700,
                ],
                'Merchant.ID70' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -11806.047519072700,
                ],
                'Merchant.ID74' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1659.426617033630,
                ],
                'Merchant.ID77' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 13549.211545652300,
                ],
                'Merchant.ID79' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -8659.660926937690,
                ],
                'Merchant.ID80' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 8243.335931521090,
                ],
                'Merchant.ID81' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 55252.568873796700,
                ],
                'Merchant.ID82' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 11815.096380261900,
                ],
                'Merchant.ID84' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 19839.955647600100,
                ],
                'Merchant.ID85' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2776.361555792830,
                ],
                'Merchant.ID86' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 20158.853407315800,
                ],
                'Merchant.ID87' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 15127.832409900400,
                ],
                'Merchant.ID88' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 106369.333562612000,
                ],
                'Merchant.ID89' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 16002.162861646600,
                ],
                'Merchant.ID90' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 9176.986138012190,
                ],
                'Merchant.ID91' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 52265.290656093500,
                ],
                'Merchant.ID94' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2544.466071646010,
                ],
                'Merchant.ID95' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 13530.443427247200,
                ],
                'Merchant.ID96' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -6993.252455630870,
                ],
                'Merchant.ID97' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 19162.253467475000,
                ],
                'Merchant.ID98' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12779.124004333600,
                ],
                'Merchant.ID100' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1954.180814641520,
                ],
                'Merchant.ID101' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 14955.392963497600,
                ],
                'Merchant.ID102' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 73989.663018855900,
                ],
                'Merchant.ID107' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3398.296336463680,
                ],
                'Merchant.ID108' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 14880.605279711100,
                ],
                'Merchant.ID110' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5281.038448157900,
                ],
                'Merchant.ID111' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 8217.628732720140,
                ],
                'Merchant.ID112' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 7498.013883851740,
                ],
                'Merchant.ID113' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3813.861328899540,
                ],
                'Merchant.ID114' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4161.308668949130,
                ],
                'Merchant.ID115' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -48769.865151036200,
                ],
                'Merchant.ID116' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1102.976041404360,
                ],
                'Merchant.ID119' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 23495.125953998400,
                ],
                'Merchant.ID120' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -769.415337983440,
                ],
                'Merchant.ID121' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -5284.932111774260,
                ],
                'Merchant.ID127' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -23603.585073899400,
                ],
                'Merchant.ID128' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 928.729828363166,
                ],
                'Merchant.ID129' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2271.479275260020,
                ],
                'Merchant.ID130' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1502.892633163300,
                ],
                'Merchant.ID131' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3044.071954656670,
                ],
                'Merchant.ID132' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -4532.365056978610,
                ],
                'Merchant.ID134' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -12832.557516325600,
                ],
                'Merchant.ID138' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3629.635324652250,
                ],
                'Merchant.ID139' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -5867.605402670560,
                ],
                'Merchant.ID140' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 15329.466576261400,
                ],
                'Merchant.ID141' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 24777.312722138300,
                ],
                'Merchant.ID142' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -34263.167219323500,
                ],
                'Merchant.ID144' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12428.938426643000,
                ],
                'Merchant.ID147' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3926.804903473350,
                ],
                'Merchant.ID148' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 9.302432590550,
                ],
                'Merchant.ID150' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 13534.791205708500,
                ],
                'Merchant.ID152' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 4795.887668719770,
                ],
                'Merchant.ID158' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -14840.441082592200,
                ],
                'Merchant.ID160' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2055.560657378020,
                ],
                'Merchant.ID161' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -3602.496774330350,
                ],
                'Merchant.ID165' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 177.860677869083,
                ],
                'Merchant.ID168' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -56263.588101869000,
                ],
                'Merchant.ID170' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -5904.586583255220,
                ],
                'Merchant.ID175' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 728.071758775033,
                ],
                'Merchant.ID176' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12107.606165687800,
                ],
                'Merchant.ID182' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -297.076438911529,
                ],
                'Merchant.ID189' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 13423.531084104200,
                ],
                'Merchant.ID192' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -7556.797735052000,
                ],
                'Merchant.ID225' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5733.410189923490,
                ],
                'Merchant.ID226' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2839.845144960350,
                ],
                'Merchant.ID227' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 34252.468393470600,
                ],
                'Merchant.ID230' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 10354.138362461000,
                ],
                'Merchant.ID268' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2095.789280364110,
                ],
                'Merchant.ID285' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2632.681473774660,
                ],
                'Merchant.ID286' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3667.955091767020,
                ],
                'Merchant.ID299' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -18767.448360508000,
                ],
                'Merchant.ID328' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 11104.773694805300,
                ],
                'Merchant.ID351' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12680.880729130900,
                ],
                'Merchant.ID392' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2488.521835653700,
                ],
                'Merchant.ID423' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 39466.535046315000,
                ],
                'Merchant.ID432' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 12745.473733341000,
                ],
                'Merchant.ID435' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2375.139584579530,
                ],
                'Merchant.ID440' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3646.610080251960,
                ],
                'Merchant.ID466' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -559989.317503302000,
                ],
                'Merchant.ID483' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -2823.616976359190,
                ],
                'Merchant.ID520' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2319.869396556620,
                ],
                'Merchant.ID597' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 1328.566264367030,
                ],
                'Merchant.ID603' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -710.063192570917,
                ],
                'Merchant.ID630' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -34948.849334832300,
                ],
                'Merchant.ID648' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 13367.691495176400,
                ],
                'Merchant.ID651' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 5050.960655962040,
                ],
                'Merchant.ID660' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 9847.530042050920,
                ],
                'Count.of.SUB.SMA.DBT.LSS' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->count_of_sub_sma_dbt_lss,
                    'estimate' => -6805.394062495860,
                ],
                'Count.of.Settled...Written.off.accounts' => [
                    'check' => true,
                    'multiplier' => $this->creditLine->count_of_settled_written_off,
                    'estimate' => -6916.786848852770,
                ],
                'Past.Average.Sanction.AmountMore than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 2074.222384448310,
                ],
                'Past.Average.Sanction.AmountLess than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -1999.472753439930,
                ],
                'Past.Maximum.Average.Sanction.AmountMore than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => 3233.551219755190,
                ],
                'Past.Maximum.Average.Sanction.AmountLess than requested loan amount' => [
                    'check' => false,
                    'multiplier' => 0,
                    'estimate' => -647.706823263484,
                ]
            ];
        }
    }

    public function setEstimation(){
        foreach ($this->bucket->bucketGroup as $cellKey => $estimationItem){
            if (isset($this->estimationData[$estimationItem])){
                $this->estimationData[$estimationItem]['check'] = true;
                if (!$this->estimationData[$estimationItem]['multiplier'])
                    $this->estimationData[$estimationItem]['multiplier'] = 1;

                $this->estimationProductArray[] = ($this->estimationData[$estimationItem]['multiplier'] * $this->estimationData[$estimationItem]['estimate']);
            }
        }

        //(Intercept)
        $name = '(Intercept)';
        $this->estimationProductArray[] = ($this->estimationData[$name]['multiplier'] * $this->estimationData[$name]['estimate']);
        //Count.of.SUB.SMA.DBT.LSS
        $name = 'Count.of.SUB.SMA.DBT.LSS';
        $this->estimationProductArray[] = ($this->estimationData[$name]['multiplier'] * $this->estimationData[$name]['estimate']);
        //Count.of.Settled...Written.off.accounts
        $name = 'Count.of.Settled...Written.off.accounts';
        $this->estimationProductArray[] = ($this->estimationData[$name]['multiplier'] * $this->estimationData[$name]['estimate']);
        //Loan.Amount.Requested
        $name = 'Loan.Amount.Requested';
        $this->estimationProductArray[] = ($this->estimationData[$name]['multiplier'] * $this->estimationData[$name]['estimate']);

        $this->estimationProduct = array_sum($this->estimationProductArray);
    }
}

class Bucket{
    //Customer Data
    public $age = ['18|25' => '18 to 25', '26|35' => '26 to 35', '36|50' => '36 to 50', '51|60' => '51 to 60', '60' => 'More than 60'];
    public $state_name = ['MAHARASHTRA', 'TELANGANA', 'UTTAR PRADESH', 'KARNATAKA', 'JHARKHAND', 'RAJASTHAN', 'WEST BENGAL', 'UTTARAKHAND', 'HARYANA', 'Missing', 'DELHI', 'BIHAR', 'ANDHRA PRADESH', 'GUJARAT', 'KERALA', 'TAMIL NADU', 'MADHYA PRADESH', 'CHATTISGARH', 'HIMACHAL PRADESH', 'ODISHA', 'ASSAM', 'PUNJAB', 'JAMMU & KASHMIR'];
    public $occupation = ['SALARIED', 'Self Employed - Business', 'Self Employed - Professional', 'UNEMPLOYED'];
    public $applicant_residential = ['Self Owned', 'Parent Owned', 'Rented', 'Other'];
    public $co_applicant_residential = ['Parent Owned', 'Self Owned', 'RENTED', 'Rented With Family', 'Other'];

    public $loan_amount_required;
    public $loan_tenure = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72];
    public $Interest_rate;
    public $Applicant_income = ['0|25000' => '0-25k', '25000|50000' => '25K-50K', '50000|100000' => '50k-1L', '100000|200000' => '1L-2L', '200000' => 'More than 2L'];
    public $co_applicant_income;
    public $applicant_fixed_obligation;
    public $co_applicant_fixed_obiligation;


    //Merchant Data
    public $purpose_of_loan = ['Home Decor', 'Healthcare', 'Personal Loan', 'Education', 'Electronic Products', 'Electronic Vehicles', 'Travel', 'Other'];
    public $loan_from_existing_merchant = ['Yes', 'No'];
    public $merchant_name;
    public $merchant_id;
    public $txns_in_bank = ['0|6' => '0-6', '7|18' => '7-18', '19|36' => '19-36', '36' => 'More than 36'];
    public $amount_of_txns_with_loan_in_percentage = ['0|0' => 'No Data', '1|100' => 'Less than 100', '100|500' => '100-500', '500' => 'More than 500'];

    public $applicant_eligible_FOIR;
    public $co_applicant_eligible_FOIR;
    public $eligible_income;
    public $credit_card_limit;
    public $total_obligation;
    public $total_income_available_to_serve_loan;
    public $negative_profile;


    //Credit Details
    public $credit_bureau_score = [1 => '1.No Bureau/New to credit', 2 => '2.Very Risky', 3 => '3.Risky', 4 => '4.Average', 5 => '5.Good', 6 => '6.Very Good'];
    public $count_of_sub_sma_dbt_lss;
    public $count_of_settled_written_off;
    public $past_sanction_average_amount = [1 => 'No Data', 2 => 'Less than requested loan amount', 3 => 'More than requested loan amount'];
    public $past_sanction_maximum_amount = [1 => 'No Data', 2 => 'Less than requested loan amount', 3 => 'More than requested loan amount'];
    public $closed_account = [1 => 'No Data', 2 => '0-2', 3 => 'Good Record of Closing'];
    public $overdue_bucket = [1 => 'No Data', 2 => '0-5k', 3 => 'More than 5K'];
    public $enquiry = [1 => 'No Data', 2 => '0-2', 3 => 'More than 2'];
    public $dpd_bucket = [1 => 'No Data', 2 => '1 DPD', 3 => 'More than 1 DPD'];
    private $creditLine;
    public $bucketGroup = array();

    public function __construct(CreditLine $creditLine){
        $this->creditLine = $creditLine;
    }

    public function getBucketItem($bucketItem){
        $bucketValue = '';
        switch ($bucketItem){
            case 'Age.Bucket':
                if($this->creditLine->age){
                    foreach ($this->age as $ageItem => $age) {
                        $items = explode('|', $ageItem);
                        if (isset($items[1]) && $this->creditLine->age >= trim($items[0])  && $this->creditLine->age <= trim($items[1])) {
                            $bucketValue = $age;
                            break;
                        }else if (!isset($items[1]) && $this->creditLine->age >= trim($items[0])){
                            $bucketValue = $age;
                            break;
                        }
                    }
                }
                break;
            case 'Purpose':
                $bucketValue = $this->creditLine->purpose_of_loan;
                break;
            case 'statename':
                $bucketValue = $this->creditLine->state_name;
                break;
            case 'Occ.Bucket':
                $bucketValue = $this->creditLine->occupation;
                break;
            case 'Income.Bucket':
                foreach ($this->Applicant_income as $incomeItem => $income) {
                    $items = explode('|', $incomeItem);
                    if (isset($items[1]) && $this->creditLine->Total_Income >= trim($items[0])  && $this->creditLine->Total_Income < trim($items[1])) {
                        $bucketValue = $income;
                        break;
                    }else if (!isset($items[1]) && $this->creditLine->Total_Income > trim($items[0])){
                        $bucketValue = $income;
                        break;
                    }
                }
                break;
            case 'Bureau.Score.Bucket':
                $bucketValue = $this->credit_bureau_score[$this->creditLine->credit_bureau_score];
                break;
            case 'Past.Sanction.Greater.than.Loan.Amount':
                //$this->creditLine->past_sanction_average_amount = !$this->creditLine->past_sanction_average_amount ? 1 : (($this->creditLine->loan_amount_required > $this->creditLine->past_sanction_average_amount) ? 2 : 3);
                //$bucketValue = $this->past_sanction_average_amount[$this->creditLine->past_sanction_average_amount];
                break;
            case 'Closed.Account':
                $this->creditLine->closed_account = !$this->creditLine->closed_account ? 2 : ($this->creditLine->closed_account <= 2 ? 2 : 3);
                $this->creditLine->closed_account = !$this->creditLine->hasCreditReport ? 1 : $this->creditLine->closed_account;
                $bucketValue = $this->closed_account[$this->creditLine->closed_account];
                break;
            case 'Overdue.Bucket':
                $this->creditLine->overdue_bucket = !$this->creditLine->overdue_bucket && !$this->creditLine->hasAccount ? 1 : ($this->creditLine->overdue_bucket <= 5000 ? 2 : 3);
                $bucketValue = $this->overdue_bucket[$this->creditLine->overdue_bucket];
                break;
            case 'Enquiry':
                $bucketValue = $this->enquiry[$this->creditLine->enquiry];
                break;
            case 'DPD.Bucket':
                $this->creditLine->dpd_bucket = !$this->creditLine->dpd_bucket ? 1 : ($this->creditLine->dpd_bucket <= 1 ? 2 : 3);
                $bucketValue = $this->dpd_bucket[$this->creditLine->dpd_bucket];
                break;
            case 'Txn.Bucket':
                foreach ($this->txns_in_bank as $txnItem => $txn_bank) {
                    $items = explode('|', $txnItem);
                    if (isset($items[1]) && $this->creditLine->Txns_in_Bank >= trim($items[0])  && $this->creditLine->Txns_in_Bank < trim($items[1])) {
                        $bucketValue = $txn_bank;
                        break;
                    }else if (!isset($items[1]) && $this->creditLine->Txns_in_Bank >= trim($items[0])){
                        $bucketValue = $txn_bank;
                        break;
                    }
                }
                break;
            case 'Txn.Amount.by.Loan.Amount':
                foreach ($this->amount_of_txns_with_loan_in_percentage as $txnItem => $txn_percentage) {
                    $items = explode('|', $txnItem);
                    if($this->creditLine->hasFinBit) {

                        if(!$this->creditLine->amount_of_txns_with_loan_in_percentage){
                            $bucketValue = $this->amount_of_txns_with_loan_in_percentage['1|100'];
                            break;
                        }

                        if (isset($items[1]) && $this->creditLine->amount_of_txns_with_loan_in_percentage >= trim($items[0]) && $this->creditLine->amount_of_txns_with_loan_in_percentage < trim($items[1])) {
                            $bucketValue = $txn_percentage;
                            break;
                        } else if (!isset($items[1]) && $this->creditLine->amount_of_txns_with_loan_in_percentage >= trim($items[0])) {
                            $bucketValue = $txn_percentage;
                            break;
                        }
                    }else{
                        $bucketValue = $txn_percentage;
                        break;
                    }
                }
                break;
            case 'Final.Address.Status':
                $this->creditLine->applicant_residential = (in_array($this->creditLine->applicant_residential, ['RENTED','Rented With Family','Rented With Friend']) ? 2 : ((in_array($this->creditLine->applicant_residential, ['PARENTS HOUSE','Parent Owned'])) ? 1 : (((in_array($this->creditLine->applicant_residential, ['Self Owned','OWNED'])) ? 0 : 3))));
                $this->creditLine->co_applicant_residential = (in_array($this->creditLine->co_applicant_residential, ['RENTED','Rented With Friend']) ? 2 : ((in_array($this->creditLine->co_applicant_residential, ['PARENTS HOUSE','Parent Owned'])) ? 0 : (((in_array($this->creditLine->co_applicant_residential, ['Self Owned','OWNED'])) ? 1 : ($this->creditLine->co_applicant_residential == 'Rented With Family' ? 3 : 4)))));
                $bucketValue = $this->applicant_residential[$this->creditLine->applicant_residential].$this->co_applicant_residential[$this->creditLine->co_applicant_residential];
                break;
            case 'FOIR.bucket':

                break;
            case 'Merchant.ID':
                $bucketValue = $this->creditLine->merchant_id;
                break;
            case 'Total Income':
                $bucketValue = $this->creditLine->Total_Income;
                break;
            //case 'Income.Bucket.1':
            //    break;
            case 'Past.Average.Sanction.Amount':
                $this->creditLine->past_sanction_average_amount = !$this->creditLine->past_sanction_average_amount ? 1 : (($this->creditLine->past_sanction_average_amount < $this->creditLine->loan_amount_required) ? 2 : 3);
                $bucketValue = $this->past_sanction_average_amount[$this->creditLine->past_sanction_average_amount];
                break;
            case 'Past.Maximum.Average.Sanction.Amount':
                $this->creditLine->past_sanction_maximum_amount = !$this->creditLine->past_sanction_maximum_amount ? 1 : (($this->creditLine->past_sanction_maximum_amount < $this->creditLine->loan_amount_required) ? 2 : 3);
                $bucketValue = $this->past_sanction_maximum_amount[$this->creditLine->past_sanction_maximum_amount];
                break;
        }
        $this->bucketGroup[$bucketItem] = $bucketItem.$bucketValue;
        return $bucketItem.$bucketValue;
    }
}

class FOIRGrid{

    public function __construct(){

    }

    public function getApplicantEligiableFOIR(){

    }

    public function getCoApplicantEligiableFOIR(){

    }

    public $employee_status = ['SALARIED', 'Self Employed - Business', 'Self Employed - Professional', 'UNEMPLOYED'];
    public $incomeRange = ['0-25k', '25K-50K', '50k-1L', '1L-2L', 'More than 2L'];
    public $FOIRBucket = [
        'SALARIED0-25k' => '55%',
        'SALARIED25K-50K' => '60%',
        'SALARIED50k-1L' => '70%',
        'SALARIED1L-2L' => '75%',
        'SALARIEDMore than 2L' => '80%',
        'Self Employed - Business0-25k' => '50%',
        'Self Employed - Business25K-50K' => '55%',
        'Self Employed - Business50k-1L' => '60%',
        'Self Employed - Business1L-2L' => '65%',
        'Self Employed - BusinessMore than 2L' => '70%',
        'Self Employed - Professional0-25k' => '55%',
        'Self Employed - Professional25K-50K' => '60%',
        'Self Employed - Professional50k-1L' => '65%',
        'Self Employed - Professional1L-2L' => '70%',
        'Self Employed - ProfessionalMore than 2L' => '75%',
        'UNEMPLOYED0-25k' => '50%',
        'UNEMPLOYED25K-50K' => '50%',
        'UNEMPLOYED50k-1L' => '55%',
        'UNEMPLOYED1L-2L' => '55%',
        'UNEMPLOYEDMore than 2L' => '55%'
    ];
}
