<?php

namespace App\Models;

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

class EmbroideryEntry extends Model
{
    use HasFactory;

    protected $fillable = [
        'quote_id',
        'quantity',
        'logo',
        'width',
        'height',
        'placement',
        'stitch_count',
        'digitizing_cost',
        'run_charge',
    ];

    protected $appends = [
        'total_price',
    ];

    public function getTotalPriceAttribute(): float
    {
        return $this->digitizing_cost + $this->run_charge;
    }

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