<?php

namespace App\Classes\Modules\Warehouses\Services;


use App\Classes\Modules\Warehouses\DataTransferObjects\WarehouseObject;
use App\Models\Warehouse;

class CreatesWarehouse
{
    /** @var  Warehouse */
    private $repository;

    /**
     * CreatesWarehouse constructor.
     * @param Warehouse $repository
     */
    public function __construct(Warehouse $repository)
    {
        $this->repository = $repository;
    }


    public function execute(WarehouseObject $warehouse){

        $this->repository->name = $warehouse->getName();
        $this->repository->email = $warehouse->getEmail();
        $this->repository->street_one = $warehouse->getStreetOne();
        $this->repository->street_two = $warehouse->getStreetTwo();
        $this->repository->city = $warehouse->getCity();
        $this->repository->state = $warehouse->getState();
        $this->repository->post_code = $warehouse->getPostCode();
        $this->repository->country = $warehouse->getCountry();
        $this->repository->save();

        return $this->repository;

    }

}