<?php

namespace App\Entities\Equipment;

use App\Models\Equipment\ServerPartModel;

class ServerPartEntity extends EquipmentEntity
{
    const PK    = ServerPartModel::PK;
    const TITLE = ServerPartModel::TITLE;
    const DEFAULT_BILLING = PAYMENT['BILLING']['MONTH'];

    public function setPartEntity(PartEntity $entity): void
    {
        $this->attributes['partEntity'] = $entity;
    }
    public function getPartEntity(): PartEntity
    {
        return $this->attributes['partEntity'];
    }
    public function getType(): string
    {
        return $this->getPartEntity()->getType() ?? "";
    }
    public function getTitle(): string
    {
        return $this->getPartEntity()->getTitle() ?? "";
    }
    public function getPrice(): int
    {
        return $this->getPartEntity()->getPrice() ?? 0;
    }
    //기본기능용
    public function  getPartInfoUID(): int
    {
        return $this->attributes['partinfo_uid'];
    }
    public function  getServerInfoUID(): int
    {
        return $this->attributes['serverinfo_uid'];
    }
    public function  getServiceInfoUID(): int|null
    {
        return $this->attributes['serviceinfo_uid'] ?? null;
    }
    public function getBilling(): string
    {
        return $this->attributes['billing'];
    }
    public function getAmount(): int
    {
        return $this->attributes['amount'];
    }
    public function getCnt(): int
    {
        return $this->attributes['cnt'];
    }
    public function getExtra(): string|null
    {
        return $this->attributes['extra'] ?? null;
    }
}
