<?php

/**
 * 文件功能：VIP 支付订单测试工厂
 * 用于在测试中快速生成本地 VIP 支付订单与远端支付映射数据
 */

namespace Database\Factories;

use App\Models\User;
use App\Models\VipLevel;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\VipPaymentOrder>
 */
class VipPaymentOrderFactory extends Factory
{
    /**
     * 定义默认测试数据
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'order_no' => 'VPO'.fake()->unique()->numerify('##########'),
            'merchant_order_no' => 'VPO'.fake()->unique()->numerify('##########'),
            'user_id' => User::factory(),
            'vip_level_id' => VipLevel::factory(),
            'status' => 'pending',
            'amount' => 30.00,
            'subject' => '购买 VIP 会员 - 测试套餐',
            'payment_order_no' => 'PO'.fake()->unique()->numerify('############'),
            'provider' => 'alipay',
            'provider_trade_no' => null,
            'vip_name' => '测试会员',
            'vip_duration_days' => 30,
            'sync_return_payload' => null,
            'async_notify_payload' => null,
            'paid_at' => null,
            'opened_vip_at' => null,
            'meta' => ['username' => fake()->userName()],
        ];
    }
}
