<?php

namespace Database\Factories;

use App\Models\PaymentManagement\Payment;
use App\Models\PaymentManagement\PaymentMethod;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Payment>
 */
class PaymentFactory extends Factory{
    protected $model = Payment::class;
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(){

        $paiementsMethods = PaymentMethod::all()->pluck("id")->toArray();
        $year = date('Y');
        $endDate = "$year-12-31"; //  'now'
        $paid_at = fake()->dateTimeThisYear($endDate);
        return [
            'provider_reference' => uniqid(),
            'payment_method_id' => $this->faker->randomElement($paiementsMethods),
            'paid_amount' =>  rand(5000,100000),
            'payer_number' => $this->faker->creditCardNumber,
            'paid_at' => $paid_at,
            'created_by_api' => false
        ];
    }
}
