<?php

namespace App\Models;

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

class ScreenPrintEntry extends Model
{
    use HasFactory;

    protected $fillable = [
        'quote_id',
        'quantity',
        'logo',
        'width',
        'height',
        'color_amount',
        'setup_amount',
        'run_charge',
        'color_change',
        'color_match',
        'flash',
        'fleece',
        'poly_ink',
        'other_charges',
        'notes',
    ];

    protected $appends = [
        'total_price',
    ];

    protected function getTotalPriceAttribute(): float
    {
        return $this->flash + $this->fleece + $this->poly_ink + $this->run_charge + $this->other_charges;
    }

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