<?php


namespace App\Entities\Endereco;

use App\Utils\Builder;

class EnderecoBuilder implements Builder
{
    private $id;
    private $cep;
    private $numero;
    private $complemento;
    private $referencias;

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

    public function setCep($cep): EnderecoBuilder
    {
        $this->cep = $cep;
        return $this;
    }

    public function setNumero(string $numero): EnderecoBuilder
    {
        $this->numero = $numero;
        return $this;
    }

    public function setComplemento(string $complemento): EnderecoBuilder
    {
        $this->complemento = $complemento;
        return $this;
    }

    public function setReferencias(string $referencias): EnderecoBuilder
    {
        $this->referencias = $referencias;
        return $this;
    }

    public function build() : Endereco
    {
        $endereco = new Endereco();
        if (isset($this->id)) {
            $endereco->setid($this->id);
        }
        if (isset($this->cep)) {
            $endereco->setcep($this->cep);
        }
        if (isset($this->numero)) {
            $endereco->setnumero($this->numero);
        }
        if (isset($this->complemento)) {
            $endereco->setcomplemento($this->complemento);
        }
        if (isset($this->referencias)) {
            $endereco->setreferencias($this->referencias);
        }
        return $endereco;
    }


}