<?php

namespace App\Models;

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

class EmpletteItem extends Model
{
    public const STATUS_PENDING = 'pending';
    public const STATUS_UPDATED = 'updated';
    public const STATUS_ACCEPTED = 'accepted';
    public const STATUS_REMOVED = 'removed';

    protected $fillable = [
        'emplette_id',
        'name',
        'quantity',
        'client_price',
        'admin_price',
        'status',
        'notes',
    ];

    protected function casts(): array
    {
        return [
            'quantity' => 'integer',
            'client_price' => 'decimal:2',
            'admin_price' => 'decimal:2',
        ];
    }

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

