<?php

namespace App\Models;

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

class SecondHand extends Model
{
    use HasFactory;

    protected $table = 'second_hand';

    protected $fillable = [
        'business_id',
        'customer_name',
        'phone',
        'mobile_model',
        'imei',
        'buy_price',
        'condition',
        'date',
    ];

    protected function casts(): array
    {
        return [
            'buy_price' => 'decimal:2',
            'date' => 'date',
        ];
    }

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