<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ExpenseArchiveItem extends Model
{
    protected $fillable = [
        'archive_id',
        'expense_id',
        'name',
        'details',
        'price',
        'quantity',
        'total',
        'payment_method',
        'expense_type',
        'custom_type',
        'expense_date',
        'created_by',
    ];

    protected $casts = [
        'archive_id' => 'int',
        'expense_id' => 'int',
        'price' => 'int',
        'quantity' => 'int',
        'total' => 'int',
        'expense_date' => 'date',
        'created_by' => 'int',
    ];

    public function archive()
    {
        return $this->belongsTo(ExpenseArchive::class, 'archive_id');
    }

    public function creator()
    {
        return $this->belongsTo(User::class, 'created_by');
    }
}
