<?php

namespace App\Entities\Customer;

use App\Models\Customer\ServiceModel;

class ServiceEntity extends CustomerEntity
{
    const PK = ServiceModel::PK;
    const TITLE = ServiceModel::TITLE;
    protected array $nullableFields = [
        'serverinfo_uid',
        'end_at'
    ];

    public function __construct(array|null $data = null)
    {
        parent::__construct($data);
        $this->nullableFields = [
            ...$this->nullableFields,
            'serverinfo_uid',
            'end_at'
        ];
        $this->dates = [
            ...$this->dates,
            'start_at',
            'end_at',
        ];
    }
    public function getClientInfoUid(): ?int
    {
        return $this->clientinfo_uid;
    }
    public function getServerInfoUid(): ?int
    {
        return $this->serverinfo_uid;
    }
    //기본기능용
    public function getCode(): string
    {
        return $this->code;
    }
    public function getSite(): string
    {
        return $this->site;
    }
    public function getLocation(): string
    {
        return $this->location;
    }
    public function getBillingAt(): string
    {
        return $this->billing_at;
    }
    //청구금액->기본:상면비+회선비+서버금액(price)+서버파트연결(월비용)-할인액
    //상면비
    public function getRack(): int
    {
        return (int) ($this->rack ?? 0);
    }
    //회선비
    public function getLine(): int
    {
        return (int) ($this->line ?? 0);
    }
    public function getSale(): int
    {
        return (int) ($this->sale ?? 0);
    }
    public function getAmount(): int
    {
        return (int) ($this->amount ?? 0);
    }
    public function getStartAt(): string
    {
        return $this->start_at;
    }
    public function getEndAt(): ?string
    {
        return $this->end_at;
    }
    public function getHistory(): ?string
    {
        return $this->history;
    }
}
