<?php

use App\Enums\ActivityEventLabel;
use App\Enums\CashTransactionType;
use App\Enums\CuttingStatus;
use App\Enums\EmployeeAdvanceStatus;
use App\Enums\EmploymentStatus;
use App\Enums\Gender;
use App\Enums\LeaveRequestStatus;
use App\Enums\MarketplaceFeeScope;
use App\Enums\MarketplaceFeeValueType;
use App\Enums\OrderChannel;
use App\Enums\OrderStatus;
use App\Enums\OwnerVerificationAction;
use App\Enums\OwnerVerificationStatus;
use App\Enums\PaymentType;
use App\Enums\PayrollAdjustmentType;
use App\Enums\PayrollPeriodStatus;
use App\Enums\PayrollStatus;
use App\Enums\Permission;
use App\Enums\PriceType;
use App\Enums\ProductStockQuality;
use App\Enums\RawMaterialUnit;
use App\Enums\Role;
use App\Enums\StokOpnameStatus;
use App\Models\Attendance;
use App\Models\CashAccount;
use App\Models\CashTransaction;
use App\Models\Category;
use App\Models\Customer;
use App\Models\Cutting;
use App\Models\CuttingMaterial;
use App\Models\CuttingMaterialCombination;
use App\Models\CuttingResult;
use App\Models\CuttingResultPrice;
use App\Models\Employee;
use App\Models\EmployeeAdvance;
use App\Models\EmployeeAdvancePayment;
use App\Models\Expense;
use App\Models\HomepageConfiguration;
use App\Models\LeaveRequest;
use App\Models\Notification;
use App\Models\Order;
use App\Models\OrderItem;
use App\Models\OwnerVerificationRequest;
use App\Models\Payroll;
use App\Models\PayrollAdjustment;
use App\Models\PayrollPeriod;
use App\Models\Product;
use App\Models\ProductPrice;
use App\Models\ProductVariant;
use App\Models\Purchase;
use App\Models\PurchaseItem;
use App\Models\PushSubscription;
use App\Models\RawMaterial;
use App\Models\RawMaterialPrice;
use App\Models\Rejection;
use App\Models\RetailStockHistory;
use App\Models\StokOpname;
use App\Models\StokOpnameItem;
use App\Models\Supplier;
use App\Models\SystemConfiguration;
use App\Models\User;
use App\Models\UserProfile;
use App\Settings\HomepageSettings;
use App\Settings\HrSettings;
use App\Settings\MarketplaceSettings;
use App\Settings\SocialMediaSettings;
use App\Settings\SystemSettings;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Spatie\Activitylog\Models\Activity;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Cache Store
    |--------------------------------------------------------------------------
    |
    | This option controls the default cache store that will be used by the
    | framework. This connection is utilized if another isn't explicitly
    | specified when running a cache operation inside the application.
    |
    */

    'default' => env('CACHE_STORE', 'database'),

    /*
    |--------------------------------------------------------------------------
    | Cache Stores
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the cache "stores" for your application as
    | well as their drivers. You may even define multiple stores for the
    | same cache driver to group types of items stored in your caches.
    |
    | Supported drivers: "array", "database", "file", "memcached",
    |                    "redis", "dynamodb", "storage", "octane",
    |                    "session", "failover", "null"
    |
    */

    'stores' => [

        'array' => [
            'driver' => 'array',
            'serialize' => false,
        ],

        'database' => [
            'driver' => 'database',
            'connection' => env('DB_CACHE_CONNECTION'),
            'table' => env('DB_CACHE_TABLE', 'cache'),
            'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
            'lock_table' => env('DB_CACHE_LOCK_TABLE'),
        ],

        'file' => [
            'driver' => 'file',
            'path' => storage_path('framework/cache/data'),
            'lock_path' => storage_path('framework/cache/data'),
        ],

        'storage' => [
            'driver' => 'storage',
            'disk' => env('CACHE_STORAGE_DISK'),
            'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
        ],

        'memcached' => [
            'driver' => 'memcached',
            'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
            'sasl' => [
                env('MEMCACHED_USERNAME'),
                env('MEMCACHED_PASSWORD'),
            ],
            'options' => [
                // Memcached::OPT_CONNECT_TIMEOUT => 2000,
            ],
            'servers' => [
                [
                    'host' => env('MEMCACHED_HOST', '127.0.0.1'),
                    'port' => env('MEMCACHED_PORT', 11211),
                    'weight' => 100,
                ],
            ],
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
            'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
        ],

        'dynamodb' => [
            'driver' => 'dynamodb',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
            'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
            'endpoint' => env('DYNAMODB_ENDPOINT'),
        ],

        'octane' => [
            'driver' => 'octane',
        ],

        'failover' => [
            'driver' => 'failover',
            'stores' => [
                'database',
                'array',
            ],
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Cache Key Prefix
    |--------------------------------------------------------------------------
    |
    | When utilizing the APC, database, memcached, Redis, and DynamoDB cache
    | stores, there might be other applications using the same cache. For
    | that reason, you may prefix every cache key to avoid collisions.
    |
    */

    'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),

    /*
    |--------------------------------------------------------------------------
    | Serializable Classes
    |--------------------------------------------------------------------------
    |
    | This value determines the classes that can be unserialized from cache
    | storage. By default, no PHP classes will be unserialized from your
    | cache to prevent gadget chain attacks if your APP_KEY is leaked.
    |
    */

    'serializable_classes' => [
        // Core PHP and Laravel Classes
        Collection::class,
        Illuminate\Database\Eloquent\Collection::class,
        Carbon\Carbon::class,
        Illuminate\Support\Carbon::class,
        stdClass::class,
        Pivot::class,
        MorphPivot::class,

        // Spatie Packages Classes
        Spatie\Permission\Models\Role::class,
        Spatie\Permission\Models\Permission::class,
        Activity::class,
        Media::class,

        // Application Settings
        HomepageSettings::class,
        HrSettings::class,
        MarketplaceSettings::class,
        SocialMediaSettings::class,
        SystemSettings::class,

        // Application Models
        Attendance::class,
        CashAccount::class,
        CashTransaction::class,
        Category::class,
        Customer::class,
        Cutting::class,
        CuttingMaterial::class,
        CuttingMaterialCombination::class,
        CuttingResult::class,
        CuttingResultPrice::class,
        Employee::class,
        EmployeeAdvance::class,
        EmployeeAdvancePayment::class,
        Expense::class,
        HomepageConfiguration::class,
        LeaveRequest::class,
        Notification::class,
        Order::class,
        OrderItem::class,
        OwnerVerificationRequest::class,
        Payroll::class,
        PayrollAdjustment::class,
        PayrollPeriod::class,
        Product::class,
        ProductPrice::class,
        ProductVariant::class,
        Purchase::class,
        PurchaseItem::class,
        PushSubscription::class,
        RawMaterial::class,
        RawMaterialPrice::class,
        Rejection::class,
        RetailStockHistory::class,
        StokOpname::class,
        StokOpnameItem::class,
        Supplier::class,
        SystemConfiguration::class,
        User::class,
        UserProfile::class,

        // Application Enums
        ActivityEventLabel::class,
        CashTransactionType::class,
        CuttingStatus::class,
        EmployeeAdvanceStatus::class,
        EmploymentStatus::class,
        Gender::class,
        LeaveRequestStatus::class,
        MarketplaceFeeScope::class,
        MarketplaceFeeValueType::class,
        OrderChannel::class,
        OrderStatus::class,
        OwnerVerificationAction::class,
        OwnerVerificationStatus::class,
        PaymentType::class,
        PayrollAdjustmentType::class,
        PayrollPeriodStatus::class,
        PayrollStatus::class,
        Permission::class,
        PriceType::class,
        ProductStockQuality::class,
        RawMaterialUnit::class,
        Role::class,
        StokOpnameStatus::class,
    ],

];
