<?php

namespace App\Models\Finance;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class SalesRecord extends Model
{
    use SoftDeletes;

    protected $table = 'sales_records';

    protected $fillable = [
        'tenant_id', 'date', 'customer', 'project', 'type', 'tax_type',
        'amount', 'vat', 'status', 'invoice_no', 'memo',
    ];

    protected $casts = [
        'date' => 'date',
        'amount' => 'integer',
        'vat' => 'integer',
    ];

    public function scopeForTenant($query, $tenantId)
    {
        return $query->where('tenant_id', $tenantId);
    }
}
