<?php

namespace App\Models;

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

class Receipt extends Model
{
    protected $fillable = [
        'receipt_number',
        'receipt_date',
        'customer_id',
        'walk_in_customer_name',
        'payment_type_id',
        'deposit_account_id',
        'total_amount',
        'reference',
        'description',
        'invoice_id',
        'status',
    ];

    protected $casts = [
        'receipt_date' => 'date',
    ];

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

    public function lines(): HasMany
    {
        return $this->hasMany(ReceiptLine::class);
    }
}
