<?php

namespace App\Support\Simulation;

final class SimulationLoanLifecycleExpectations
{
    public const AS_OF_DATE = '2026-08-15';

    /** @return array<string, array<string, mixed>> */
    public static function scenarios(): array
    {
        return [
            'draft' => [
                'purpose' => 'SIM-LC-DRAFT',
                'branch' => 'SIM-DAR',
                'customer' => 'SIM-CUS-DAR-001',
                'product' => 'SIM Flat Monthly',
                'principal' => '1000000.00',
                'schedule_start_date' => '2026-08-20',
                'creator' => 'sim.dar.loan',
                'expected_status' => 'draft',
            ],
            'under_review' => [
                'purpose' => 'SIM-LC-UNDER-REVIEW',
                'branch' => 'SIM-MZA',
                'customer' => 'SIM-CUS-MZA-001',
                'product' => 'SIM Flat Monthly',
                'principal' => '900000.00',
                'schedule_start_date' => '2026-08-20',
                'creator' => 'sim.mwanza.loan',
                'expected_status' => 'under_review',
            ],
            'rejected' => [
                'purpose' => 'SIM-LC-REJECTED',
                'branch' => 'SIM-ARU',
                'customer' => 'SIM-CUS-ARU-001',
                'product' => 'SIM Flat Monthly',
                'principal' => '600000.00',
                'schedule_start_date' => '2026-08-20',
                'creator' => 'sim.arusha.loan',
                'approver' => 'sim.inspector',
                'expected_status' => 'rejected',
            ],
            'secured_ready' => [
                'purpose' => 'SIM-LC-SECURED-READY',
                'branch' => 'SIM-MZA',
                'customer' => 'SIM-CUS-MZA-002',
                'product' => 'SIM Reducing Weekly',
                'principal' => '1200000.00',
                'schedule_start_date' => '2026-08-17',
                'creator' => 'sim.mwanza.loan',
                'approver' => 'sim.inspector',
                'expected_status' => 'ready_for_disbursement',
            ],
            'active_partial' => [
                'purpose' => 'SIM-LC-ACTIVE-PARTIAL',
                'branch' => 'SIM-DAR',
                'customer' => 'SIM-CUS-DAR-002',
                'product' => 'SIM Flat Monthly',
                'principal' => '2000000.00',
                'schedule_start_date' => '2026-07-15',
                'creator' => 'sim.dar.loan',
                'approver' => 'sim.dar.manager',
                'disburser' => 'sim.dar.cashier',
                'disbursement_account' => 'SIM Dar Bank',
                'disbursement_date' => '2026-07-15',
                'payment_account' => 'SIM Dar Cash',
                'payment_amount' => '400000.00',
                'payment_date' => '2026-08-10',
                'expected_status' => 'active',
                'expected_total_repayment' => '2295000.00',
                'expected_total_paid' => '400000.00',
                'expected_total_outstanding' => '1895000.00',
            ],
            'completed' => [
                'purpose' => 'SIM-LC-COMPLETED',
                'branch' => 'SIM-MZA',
                'customer' => 'SIM-CUS-MZA-003',
                'product' => 'SIM Flat Monthly',
                'principal' => '600000.00',
                'schedule_start_date' => '2026-07-01',
                'creator' => 'sim.mwanza.loan',
                'approver' => 'sim.inspector',
                'disburser' => 'sim.mwanza.cashier',
                'disbursement_account' => 'SIM Mwanza Bank',
                'disbursement_date' => '2026-07-01',
                'payment_account' => 'SIM Mwanza Cash',
                'payment_amount' => '699000.00',
                'payment_date' => '2026-07-20',
                'expected_status' => 'completed',
                'expected_total_repayment' => '699000.00',
                'expected_total_paid' => '699000.00',
                'expected_total_outstanding' => '0.00',
            ],
            'overdue' => [
                'purpose' => 'SIM-LC-OVERDUE',
                'branch' => 'SIM-DAR',
                'customer' => 'SIM-CUS-DAR-003',
                'product' => 'SIM Fixed Lump Sum',
                'principal' => '500000.00',
                'schedule_start_date' => '2026-06-01',
                'creator' => 'sim.dar.loan',
                'approver' => 'sim.inspector',
                'disburser' => 'sim.dar.cashier',
                'disbursement_account' => 'SIM Dar Bank',
                'processing_fee_account' => 'SIM Dar Cash',
                'disbursement_date' => '2026-06-01',
                'expected_status' => 'active',
                'expected_total_repayment' => '575000.00',
                'expected_penalties_outstanding' => '10000.00',
                'expected_total_outstanding' => '585000.00',
                'expected_total_overdue' => '585000.00',
                'expected_days_overdue' => 43,
            ],
            'remote' => [
                'purpose' => 'SIM-LC-REMOTE',
                'branch' => 'SIM-MZA',
                'customer' => 'SIM-CUS-MZA-004',
                'product' => 'SIM Flat Monthly',
                'principal' => '800000.00',
                'schedule_start_date' => '2026-07-25',
                'creator' => 'sim.mwanza.loan',
                'approver' => 'sim.inspector',
                'disburser' => 'sim.mwanza.cashier',
                'disbursement_account' => 'SIM Mwanza Bank',
                'disbursement_date' => '2026-07-25',
                'payment_account' => 'SIM Mwanza Mobile Money',
                'approved_remote_amount' => '70000.00',
                'approved_remote_date' => '2026-08-10',
                'expected_status' => 'active',
                'expected_total_repayment' => '927000.00',
                'expected_total_paid' => '70000.00',
                'expected_total_outstanding' => '857000.00',
            ],
        ];
    }

    /** @return array<string, string> */
    public static function expectedAccountBalances(): array
    {
        return [
            'SIM Dar Cash' => '25415000.00',
            'SIM Dar Bank' => '72500000.00',
            'SIM Mwanza Cash' => '15699000.00',
            'SIM Mwanza Bank' => '38600000.00',
            'SIM Mwanza Mobile Money' => '5070000.00',
        ];
    }

    /** @return array<string, string|int> */
    public static function aggregateControls(): array
    {
        return [
            'scenario_loans' => 8,
            'loan_disbursements' => 4,
            'customer_disbursements' => '3900000.00',
            'loan_payments' => 3,
            'loan_collections' => '1169000.00',
            'cash_processing_fees' => '15000.00',
            'remote_submissions' => 3,
            'penalty_charges' => 1,
            'expected_account_total' => '226284000.00',
        ];
    }
}
