<?php

namespace App\Entities\Customer;

use App\Models\Customer\ClientModel;

class ClientEntity extends CustomerEntity
{
    const PK = ClientModel::PK;
    const TITLE = ClientModel::TITLE;

    /**
     * 생성자
     */
    public function __construct(array|null $data = null)
    {
        parent::__construct($data);
    }

    /*
    |--------------------------------------------------------------------------
    | Override Getter들 (모두 property 스타일 사용)
    |--------------------------------------------------------------------------
    */

    public function getCustomTitle(mixed $title = null): string
    {
        return sprintf("%s/%s", $this->getSite(), $title ? $title : $this->getTitle());
    }

    public function getSite(): string
    {
        return $this->site;
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getRole(): string
    {
        return $this->role;
    }
    public function getRoles(): array
    {
        return explode(DEFAULTS['DELIMITER_COMMA'], $this->getRole());
    }
    public function getAccountBalance(): int
    {
        return (int) ($this->account_balance ?? 0);
    }

    public function getCouponBalance(): int
    {
        return (int) ($this->coupon_balance ?? 0);
    }

    public function getPointBalance(): int
    {
        return (int) ($this->point_balance ?? 0);
    }

    public function getHistory(): ?string
    {
        return $this->history;
    }
}
