<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/** Jackpot 爆池派发记录 {@see jackpot_payout_logs} */
final class JackpotPayoutLog extends Model
{
    public const UPDATED_AT = null;

    protected $fillable = [
        'draw_id',
        'jackpot_pool_id',
        'trigger_type',
        'total_payout_amount',
        'winner_count',
        'trigger_snapshot_json',
    ];

    protected function casts(): array
    {
        return [
            'draw_id' => 'integer',
            'jackpot_pool_id' => 'integer',
            'total_payout_amount' => 'integer',
            'winner_count' => 'integer',
            'trigger_snapshot_json' => 'json',
        ];
    }

    public function draw(): BelongsTo
    {
        return $this->belongsTo(Draw::class);
    }

    public function pool(): BelongsTo
    {
        return $this->belongsTo(JackpotPool::class, 'jackpot_pool_id');
    }
}
