<?php

namespace App\Models;

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

final class ReconcileItem extends Model
{
    protected $table = 'reconcile_items';

    protected $fillable = [
        'reconcile_job_id',
        'side_a_ref',
        'side_b_ref',
        'difference_amount',
        'status',
        'resolved_at',
    ];

    protected function casts(): array
    {
        return [
            'difference_amount' => 'integer',
            'resolved_at' => 'datetime',
        ];
    }

    /** @return BelongsTo<ReconcileJob, ReconcileItem> */
    public function reconcileJob(): BelongsTo
    {
        return $this->belongsTo(ReconcileJob::class, 'reconcile_job_id');
    }
}
