<?php

namespace App\Entities\Customer;

use App\Entities\Customer\ClientEntity;
use App\Models\Customer\ServiceModel;

class ServiceEntity extends CustomerEntity
{
    const PK = ServiceModel::PK;
    const TITLE = ServiceModel::TITLE;
    final public function getOwnerUID(): int
    {
        return intval($this->attributes['ownerinfo_uid']);
    }
    final public function getUserUID(): int
    {
        return intval($this->attributes['user_uid']);
    }
    public function getTitle(): string
    {
        return "S" . $this->getPK();
    }
    public function getSwitch(): string
    {
        return $this->attributes['switch'];
    }
    //서버코드
    public function getCode(): string
    {
        return $this->attributes['code'];
    }
    public function getType(): string
    {
        return $this->attributes['type'];
    }
    final public function getBillingAt(): string
    {
        return $this->attributes['billing_at'];
    }
    public function getItemEntities(string $type): array
    {
        return $this->attributes[$type] ?? [];
    }
    public function setItemEntities(string $type, array $itemEntities): void
    {
        $this->attributes[$type] = $itemEntities;
        // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
    }
}
