<?php

use App\Support\Marketplace\MarketplaceFeeRule;
use Spatie\LaravelSettings\Migrations\SettingsBlueprint;
use Spatie\LaravelSettings\Migrations\SettingsMigration;

return new class extends SettingsMigration
{
    public function up(): void
    {
        $this->migrator->inGroup('system', function (SettingsBlueprint $blueprint): void {
            $blueprint->add('app_name', config('app.name', 'DST Collection'));
            $blueprint->add('address', 'Jl. Raya Cipeundeuy - Pabuaran No.909, Pabuaran, Kec. Pabuaran, Kabupaten Subang, Jawa Barat 41262');
            $blueprint->add('about_app', '');
            $blueprint->add('email', '');
            $blueprint->add('phone', '');
            $blueprint->add('logo', '');
            $blueprint->add('login_cover', '');
        });

        $this->migrator->inGroup('social_media', function (SettingsBlueprint $blueprint): void {
            $blueprint->add('instagram_url', null);
            $blueprint->add('facebook_url', null);
            $blueprint->add('tiktok_url', null);
        });

        $this->migrator->inGroup('marketplace', function (SettingsBlueprint $blueprint): void {
            // TikTok Shop
            $blueprint->add('tiktok_shop_platform_commission', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('tiktok_shop_logistics_service_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('tiktok_shop_dynamic_commission', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('tiktok_shop_order_processing_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('tiktok_shop_affiliate', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('tiktok_shop_pre_order_service_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());

            // Shopee
            $blueprint->add('shopee_admin_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_program_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_shipping_savings', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_premium', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_service_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_order_processing_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_ams_commission_fee', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_pre_order', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
            $blueprint->add('shopee_live_extra', MarketplaceFeeRule::defaultPercent(0.0)->toArray());
        });
    }
};
