<?php namespace App\Entities\Permissao;
use App\Utils\Builder;

class PermissaoBuilder implements Builder
{
    private $id;
    private $descricao;
    private $id_endpoint;
    private $id_perfil;
    private $ativo;

    public function setId($id)
    {
        $this->id = $id;
        return $this;
    }

    public function setDescricao($descricao)
    {
        $this->descricao = $descricao;
        return $this;
    }

    /**
     * @param mixed $id_endpoint
     * @return PermissaoBuilder
     */
    public function setIdEndpoint($id_endpoint)
    {
        $this->id_endpoint = $id_endpoint;
        return $this;
    }

    /**
     * @param mixed $id_perfil
     * @return PermissaoBuilder
     */
    public function setIdPerfil($id_perfil)
    {
        $this->id_perfil = $id_perfil;
        return $this;
    }

    /**
     * @param mixed $ativo
     * @return PermissaoBuilder
     */
    public function setAtivo($ativo)
    {
        $this->ativo = $ativo;
        return $this;
    }

    public function build () {
        $permissao = new Permissao();
        if (isset($this->id)) {
            $permissao->setId($this->id);
        }
        if (isset($this->descricao)) {
            $permissao->setDescricao($this->descricao);
        }
        if (isset($this->id_endpoint)) {
            $permissao->setIdEndpoint($this->id_endpoint);
        }
        if (isset($this->id_perfil)) {
            $permissao->setIdPerfil($this->id_perfil);
        }
        if (isset($this->ativo)) {
            $permissao->setAtivo($this->ativo);
        }
        return $permissao;
    }
}