<?php

namespace AuthStack\UserDirectory\Model;

use function AuthStack\UserDirectory\routes;
use AuthStack\UserDirectory\Service\RESTService;

abstract class AbstractModel
{
    protected $auth_token;
    protected $auth_type;
    protected $baseUrl = '';
    protected $service;
    protected $model = [];
    protected $tz_offset;
    protected $tz_dst;

    public function __construct(array $model = [])
    {
        $this->model = $model;
    }

    /**
     * @param RESTService $service
     * @return mixed
     */
    abstract public function setService(\AuthStack\UserDirectory\Service\RESTService $service);

    /**
     * @return RESTService
     */
    abstract public function getService(): RESTService;

    /**
     * @param string $token
     * @return AbstractModel
     */
    public function setBasicAuthorization(string $token): self
    {
        $this->auth_type = 'Basic';
        $this->auth_token = $token;

        return $this;
    }

    /**
     * @param string $url
     * @return AbstractModel
     */
    public function setBaseUrl(string $url): self
    {
        $this->baseUrl = $url;

        return $this;
    }

    /**
     * @param string $offset
     * @return AbstractModel
     */
    public function setTimeZoneOffset(string $offset): self
    {
        $this->tz_offset = $offset;

        return $this;
    }

    /**
     * @param string $dst
     * @return AbstractModel
     */
    public function setTimeZoneDST(string $dst): self
    {
        $this->tz_dst = $dst;

        return $this;
    }

    /**
     * @return array
     */
    public function getModel(): array
    {
        return $this->model;
    }

}