<?php

namespace App\Entities\Part;

use App\Models\Part\CPUModel;

class PartType1Entity extends PartEntity
{
  protected $attributes = [
    'title' => '',
    'used' => 0,
    'price' => 0,
    'stock' => 0,
    'status' => '',
  ];
  public function __construct(array|null $data = null)
  {
    parent::__construct($data);
  }
  //기본기능    
  final public function getStock(): int
  {
    return $this->attributes['stock'] ?? 0;
  }
  final public function getUsed(): int
  {
    return $this->attributes['used'] ?? 0;
  }
  final public function getAvailable(): int
  {
    return $this->getStock() - $this->getUsed();
  }
}
