<?php

namespace Modules\API\Authenticate\Service;

abstract class AuthAbstractService
{
    /**
     * @var int $statusCode
     */
    private $statusCode;

    /**
     * @var string $messageStatusCode
     */
    private $messageStatusCode;
    
    public function __construct()
    {
        $this->setStatusCode(200);
    }
    /**
     * generateToken
     *
     * @param  int $time
     * @param  string $clientID
     * @param  string $clientSecret
     * @param  string $grantType
     * @return array<mixed>
     */
    abstract public function generateToken(int $time, string $clientID, string $clientSecret, string $grantType = 'password') : array;
    /**
     * setStatusCode
     *
     * @param  int $code
     * @return void
     */
    public function setStatusCode(int $code)
    {
        switch ($code) {
            case 200:
                $this->messageStatusCode = 'Success';
                break;
            case 401:
                $this->messageStatusCode = 'Unauthorized';
                break;
        }
        
        $this->statusCode = $code;
    }
    
    /**
     * getMessageStatusCode
     *
     * @return string
     */
    public function getMessageStatusCode() : string
    {
        return $this->messageStatusCode;
    }

    /**
     * getStatusCode
     *
     * @return int
     */
    public function getStatusCode() : int
    {
        return $this->statusCode;
    }
}
