<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('transactions', function (Blueprint $table) {
            // Corporate Information
            $table->jsonb('corporate_summary')->nullable();
            $table->jsonb('corporate_history')->nullable();
            $table->jsonb('corporate_purpose')->nullable();
            $table->jsonb('corporate_sector')->nullable();
            $table->jsonb('corporate_nace')->nullable();
            $table->jsonb('corporate_products')->nullable();
            $table->jsonb('corporate_markets')->nullable();
            $table->jsonb('corporate_supply')->nullable();
            $table->jsonb('corporate_name')->nullable();
            $table->jsonb('corporate_form')->nullable();
            $table->jsonb('corporate_forum')->nullable();
            $table->jsonb('corporate_HQ')->nullable();
            $table->jsonb('corporate_locations')->nullable();
            $table->jsonb('corporate_holding')->nullable();
            $table->jsonb('corporate_shareholders')->nullable();
            $table->jsonb('corporate_board')->nullable();
            $table->jsonb('corporate_supervisory')->nullable();
            $table->jsonb('corporate_powerofattorney')->nullable();
            $table->jsonb('corporate_taxID')->nullable();
            $table->jsonb('corporate_LEI')->nullable();
            $table->jsonb('corporate_UBO')->nullable();
            $table->jsonb('corporate_employeecount')->nullable();
            $table->jsonb('corporate_turnover')->nullable();
            $table->jsonb('corporate_EBIT')->nullable();
            $table->jsonb('corporate_netprofits')->nullable();
            $table->jsonb('corporate_balancesheet')->nullable();
            $table->jsonb('corporate_auditfindings')->nullable();
            $table->jsonb('corporate_insolvency')->nullable();
            $table->jsonb('corporate_liquidation')->nullable();
            $table->jsonb('corporate_adhoc')->nullable();
            $table->jsonb('corporate_pressrelease')->nullable();
            $table->jsonb('corporate_votes')->nullable();
            $table->jsonb('corporate_directordealings')->nullable();
            $table->jsonb('corporate_brands')->nullable();
            $table->jsonb('corporate_website')->nullable();
            $table->jsonb('corporate_domain')->nullable();
            $table->jsonb('corporate_IBAN')->nullable();
            $table->jsonb('corporate_solvency')->nullable();
            $table->jsonb('corporate_rating')->nullable();
            $table->jsonb('corporate_ESG')->nullable();
            $table->jsonb('corporate_license')->nullable();
            $table->jsonb('corporate_warnings')->nullable();
            $table->jsonb('corporate_eusanctions')->nullable();
            $table->jsonb('corporate_ofacsanctions')->nullable();
            $table->jsonb('corporate_uksanctions')->nullable();
            $table->jsonb('corporate_pepexposure')->nullable();
            $table->jsonb('corporate_adversemediascanning')->nullable();
            $table->jsonb('corporate_corruptionexposure')->nullable();
            $table->jsonb('corporate_AMLexposure')->nullable();
            $table->jsonb('corporate_CTYexposure')->nullable();
            $table->jsonb('corporate_adverse')->nullable();
            $table->jsonb('corporate_pep')->nullable();
            $table->jsonb('corporate_adverse2')->nullable();
            $table->jsonb('corporate_exportcontrol')->nullable();
            $table->jsonb('corporate_mediamatch')->nullable();
            $table->jsonb('corporate_haven')->nullable();
            $table->jsonb('corporate_haven2')->nullable();
            $table->jsonb('corporate_insiders')->nullable();
            $table->jsonb('corporate_courtcases')->nullable();
            $table->jsonb('corporate_manda')->nullable();
            $table->jsonb('corporate_pepdetail')->nullable();

            // Transaction Information
            $table->jsonb('tranx_TX_AMOUNT')->nullable();
            $table->jsonb('tranx_historical')->nullable();
            $table->jsonb('tranx_TX_PURPOSE')->nullable();
            $table->jsonb('tranx_counterpartyassessment')->nullable();
            $table->jsonb('tranx_context')->nullable();
            $table->jsonb('tranx_report')->nullable();
            $table->jsonb('tranx_PURPOSEbase')->nullable();
            $table->jsonb('tranx_performanceperiod')->nullable();
            $table->jsonb('tranx_seasonality')->nullable();
            $table->jsonb('tranx_resolution')->nullable();
            $table->jsonb('trans_IBANvalidation')->nullable();
            $table->jsonb('tranx_businesslogic')->nullable();
            $table->jsonb('tranx_plausibilty')->nullable();
            $table->jsonb('tranx_outliers')->nullable();
            $table->jsonb('tranx_patterns')->nullable();
            $table->jsonb('tranx_revenueimpact')->nullable();
            $table->jsonb('tranx_profitimpact')->nullable();
            $table->jsonb('tranx_marketimpact')->nullable();
            $table->jsonb('tranx_duplicate')->nullable();
            $table->jsonb('tranx_pattern2')->nullable();
            $table->jsonb('tranx_contracttenor')->nullable();
            $table->jsonb('tranx_mismatch')->nullable();
            $table->jsonb('tranx_fakepurposecheck')->nullable();
            $table->jsonb('tranx_structuring')->nullable();
            $table->jsonb('tranx_newbankaccount')->nullable();
            $table->jsonb('tranx_weekday')->nullable();
            $table->jsonb('tranx_holdingobfuscation')->nullable();
            $table->jsonb('tranx_score')->nullable();
            $table->jsonb('tranx_reasoning')->nullable();
            $table->jsonb('tranx_recommendation')->nullable();
            $table->jsonb('tranx_sourcerepository')->nullable();

            // Source Information
            $table->jsonb('source_domaincheck')->nullable();
            $table->jsonb('source_check')->nullable();
            $table->jsonb('source_approveuniqueID')->nullable();
            $table->jsonb('source_randomplausibility')->nullable();

            // Risk Assessment
            $table->jsonb('sanctions_circumvention')->nullable();
            $table->jsonb('corruption_sector')->nullable();
            $table->jsonb('corruption_country')->nullable();
            $table->jsonb('corruption_relationship')->nullable();
            $table->jsonb('country_risk')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('transactions', function (Blueprint $table) {
            $table->dropColumn([
                // Corporate Information
                'corporate_summary',
                'corporate_history',
                'corporate_purpose',
                'corporate_sector',
                'corporate_nace',
                'corporate_products',
                'corporate_markets',
                'corporate_supply',
                'corporate_name',
                'corporate_form',
                'corporate_forum',
                'corporate_HQ',
                'corporate_locations',
                'corporate_holding',
                'corporate_shareholders',
                'corporate_board',
                'corporate_supervisory',
                'corporate_powerofattorney',
                'corporate_taxID',
                'corporate_LEI',
                'corporate_UBO',
                'corporate_employeecount',
                'corporate_turnover',
                'corporate_EBIT',
                'corporate_netprofits',
                'corporate_balancesheet',
                'corporate_auditfindings',
                'corporate_insolvency',
                'corporate_liquidation',
                'corporate_adhoc',
                'corporate_pressrelease',
                'corporate_votes',
                'corporate_directordealings',
                'corporate_brands',
                'corporate_website',
                'corporate_domain',
                'corporate_IBAN',
                'corporate_solvency',
                'corporate_rating',
                'corporate_ESG',
                'corporate_license',
                'corporate_warnings',
                'corporate_eusanctions',
                'corporate_ofacsanctions',
                'corporate_uksanctions',
                'corporate_pepexposure',
                'corporate_adversemediascanning',
                'corporate_corruptionexposure',
                'corporate_AMLexposure',
                'corporate_CTYexposure',
                'corporate_adverse',
                'corporate_pep',
                'corporate_adverse2',
                'corporate_exportcontrol',
                'corporate_mediamatch',
                'corporate_haven',
                'corporate_haven2',
                'corporate_insiders',
                'corporate_courtcases',
                'corporate_manda',
                'corporate_pepdetail',
                // Transaction Information
                'tranx_TX_AMOUNT',
                'tranx_historical',
                'tranx_TX_PURPOSE',
                'tranx_counterpartyassessment',
                'tranx_context',
                'tranx_report',
                'tranx_PURPOSEbase',
                'tranx_performanceperiod',
                'tranx_seasonality',
                'tranx_resolution',
                'trans_IBANvalidation',
                'tranx_businesslogic',
                'tranx_plausibilty',
                'tranx_outliers',
                'tranx_patterns',
                'tranx_revenueimpact',
                'tranx_profitimpact',
                'tranx_marketimpact',
                'tranx_duplicate',
                'tranx_pattern2',
                'tranx_contracttenor',
                'tranx_mismatch',
                'tranx_fakepurposecheck',
                'tranx_structuring',
                'tranx_newbankaccount',
                'tranx_weekday',
                'tranx_holdingobfuscation',
                'tranx_score',
                'tranx_reasoning',
                'tranx_recommendation',
                'tranx_sourcerepository',
                // Source Information
                'source_domaincheck',
                'source_check',
                'source_approveuniqueID',
                'source_randomplausibility',
                // Risk Assessment
                'sanctions_circumvention',
                'corruption_sector',
                'corruption_country',
                'corruption_relationship',
                'country_risk',
            ]);
        });
    }
};
