<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ConstantsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Order Status Constants
        DB::table('constants')->insert([
            ['constant_key' => 'ORDER_STATUS_PENDING', 'constant_value' => 0, 'label' => 'Pending', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_COMPLETED', 'constant_value' => 1, 'label' => 'Completed', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_PROCESSING', 'constant_value' => 2, 'label' => 'Processing', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_REFUNDED', 'constant_value' => 3, 'label' => 'Refunded', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_CANCELLED', 'constant_value' => 4, 'label' => 'Cancelled', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_FAILED', 'constant_value' => 5, 'label' => 'Failed', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_EXPIRED', 'constant_value' => 6, 'label' => 'Expired', 'type' => 'order_status'],
            ['constant_key' => 'ORDER_STATUS_ON_HOLD', 'constant_value' => 7, 'label' => 'On Hold', 'type' => 'order_status'],
        ]);

        // Subscription Status Constants
        DB::table('constants')->insert([
            //  The subscription is active, and the customer has access to the service.
            ['constant_key' => 'SUBSCRIPTION_STATUS_ACTIVE', 'constant_value' => 1, 'label' => 'Active', 'type' => 'subscription_status'],
            //  The customer is currently in a free trial period.
            ['constant_key' => 'SUBSCRIPTION_STATUS_TRIAL', 'constant_value' => 2, 'label' => 'Trial', 'type' => 'subscription_status'],
            ['constant_key' => 'SUBSCRIPTION_STATUS_INACTIVE', 'constant_value' => 3, 'label' => 'Inactive', 'type' => 'subscription_status'],
            // The subscription has been canceled by the customer or the company.
            ['constant_key' => 'SUBSCRIPTION_STATUS_CANCELLED', 'constant_value' => 4, 'label' => 'Cancelled', 'type' => 'subscription_status'],
            // ['constant_key' => 'SUBSCRIPTION_STATUS_PAUSED', 'constant_value' => 5, 'label' => 'Paused', 'type' => 'subscription_status'],
            //  The subscription has reached its end date and is no longer active.
            ['constant_key' => 'SUBSCRIPTION_STATUS_EXPIRED', 'constant_value' => 6, 'label' => 'Expired', 'type' => 'subscription_status'],
            //  A payment has been missed, but the subscription is still technically active (often with limited access).
            ['constant_key' => 'SUBSCRIPTION_STATUS_PAST_DUE', 'constant_value' => 7, 'label' => 'Past Due', 'type' => 'subscription_status'],
            // The subscription has been temporarily suspended due to non-payment or other reasons.
            ['constant_key' => 'SUBSCRIPTION_STATUS_SUSPENDED', 'constant_value' => 8, 'label' => 'Suspended', 'type' => 'subscription_status'],
        ]);

        // Billing Cycle Constants
        DB::table('constants')->insert([
            ['constant_key' => 'BILLING_CYCLE_DAILY', 'constant_value' => 1, 'label' => 'Daily', 'type' => 'billing_cycle'],
            ['constant_key' => 'BILLING_CYCLE_WEEKLY', 'constant_value' => 2, 'label' => 'Weekly', 'type' => 'billing_cycle'],
            ['constant_key' => 'BILLING_CYCLE_MONTHLY', 'constant_value' => 3, 'label' => 'Monthly', 'type' => 'billing_cycle'],
            ['constant_key' => 'BILLING_CYCLE_QUARTERLY', 'constant_value' => 4, 'label' => 'Quarterly', 'type' => 'billing_cycle'],
            ['constant_key' => 'BILLING_CYCLE_SEMI_ANNUALLY', 'constant_value' => 5, 'label' => 'Semi-Annually', 'type' => 'billing_cycle'],
            ['constant_key' => 'BILLING_CYCLE_YEARLY', 'constant_value' => 6, 'label' => 'Yearly', 'type' => 'billing_cycle'],
        ]);

        // Trial Duration Units
        DB::table('constants')->insert([
            ['constant_key' => 'TRIAL_DURATION_DAYS', 'constant_value' => 1, 'label' => 'Day(s)', 'type' => 'trial_duration_unit'],
            ['constant_key' => 'TRIAL_DURATION_WEEKS', 'constant_value' => 2, 'label' => 'Week(s)', 'type' => 'trial_duration_unit'],
            ['constant_key' => 'TRIAL_DURATION_MONTHS', 'constant_value' => 3, 'label' => 'Month(s)', 'type' => 'trial_duration_unit'],
            ['constant_key' => 'TRIAL_DURATION_YEARS', 'constant_value' => 4, 'label' => 'Year(s)', 'type' => 'trial_duration_unit'],
        ]);

        DB::table('constants')->insert([
            ['constant_key' => 'BILLING_ONETIME', 'constant_value' => 1, 'label' => 'One-Time', 'type' => 'billing_type'],
            ['constant_key' => 'BILLING_SUBSCRIPTION', 'constant_value' => 2, 'label' => 'Subscription', 'type' => 'billing_type'],
        ]);

        DB::table('constants')->insert([
            ['constant_key' => 'CR_CUSTOMER_REQUESTED', 'constant_value' => 1, 'label' => 'Customer Requested', 'type' => 'cancellation_reason'],
            ['constant_key' => 'CR_CANCELLED_BY_SYSTEM', 'constant_value' => 2, 'label' => 'Cancelled by System', 'type' => 'cancellation_reason'],
            ['constant_key' => 'CR_CANCELLED_BY_ADMIN', 'constant_value' => 3, 'label' => 'Cancelled by Admin', 'type' => 'cancellation_reason'],
            ['constant_key' => 'CR_NON_PAYMENT', 'constant_value' => 4, 'label' => 'Non Payment', 'type' => 'cancellation_reason'],
            ['constant_key' => 'CR_FRAUD', 'constant_value' => 5, 'label' => 'Fraud', 'type' => 'cancellation_reason'],
        ]);

        // Support Duration Unit
        DB::table('constants')->insert([
            ['constant_key' => 'SUPPORT_DURATION_DAYS', 'constant_value' => 1, 'label' => 'Day(s)', 'type' => 'support_duration_unit'],
            ['constant_key' => 'SUPPORT_DURATION_WEEKS', 'constant_value' => 2, 'label' => 'Week(s)', 'type' => 'support_duration_unit'],
            ['constant_key' => 'SUPPORT_DURATION_MONTHS', 'constant_value' => 3, 'label' => 'Month(s)', 'type' => 'support_duration_unit'],
            ['constant_key' => 'SUPPORT_DURATION_YEARS', 'constant_value' => 4, 'label' => 'Year(s)', 'type' => 'support_duration_unit'],
        ]);

        // Support Discount Type
        DB::table('constants')->insert([
            ['constant_key' => 'SUPPORT_DISCOUNT_PERCENTAGE', 'constant_value' => 1, 'label' => 'Percentage of Current Price', 'type' => 'support_discount_type'],
            ['constant_key' => 'SUPPORT_DISCOUNT_FIXED', 'constant_value' => 2, 'label' => 'Fixed Amount', 'type' => 'support_discount_type'],
        ]);

        DB::table('constants')->insert([
            ['constant_key' => 'LICENSE_VALIDITY_DAYS', 'constant_value' => 1, 'label' => 'Day(s)', 'type' => 'license_validity_unit'],
            ['constant_key' => 'LICENSE_VALIDITY_WEEKS', 'constant_value' => 2, 'label' => 'Week(s)', 'type' => 'license_validity_unit'],
            ['constant_key' => 'LICENSE_VALIDITY_MONTHS', 'constant_value' => 3, 'label' => 'Month(s)', 'type' => 'license_validity_unit'],
            ['constant_key' => 'LICENSE_VALIDITY_YEARS', 'constant_value' => 4, 'label' => 'Year(s)', 'type' => 'license_validity_unit'],
        ]);

        DB::table('constants')->insert([
            ['constant_key' => 'LICENSE_VALIDITY_NO_EXPIRY', 'constant_value' => 1, 'label' => 'No Expiry', 'type' => 'license_validity'],
            ['constant_key' => 'LICENSE_VALIDITY_CUSTOM', 'constant_value' => 2, 'label' => 'Custom', 'type' => 'license_validity'],
        ]);

    }
}
