<?php

namespace App\Models;

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

/** 奖池余额人工调整流水 {@see jackpot_pool_adjustments} */
final class JackpotPoolAdjustment extends Model
{
    protected $fillable = [
        'adjustment_no',
        'jackpot_pool_id',
        'admin_user_id',
        'amount_delta',
        'balance_before',
        'balance_after',
        'reason',
    ];

    protected function casts(): array
    {
        return [
            'amount_delta' => 'integer',
            'balance_before' => 'integer',
            'balance_after' => 'integer',
        ];
    }

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

    /** @return BelongsTo<AdminUser, JackpotPoolAdjustment> */
    public function adminUser(): BelongsTo
    {
        return $this->belongsTo(AdminUser::class, 'admin_user_id');
    }
}
