<?php

namespace App\Classes\Modules\ControllersLogic\Companies\AddressBook;


use App\Classes\Modules\AddressBook\DataTransferObjects\AddressBookObject;
use App\Classes\Modules\AddressBook\Services\CreatesAddress;
use Illuminate\Http\Request;

class CreateAddressBookLogic
{
    /** @var  CreatesAddress */
    private $CreatesAddress;

    /**
     * CreateAddressBookLogic constructor.
     * @param CreatesAddress $CreatesAddress
     */
    public function __construct(CreatesAddress $CreatesAddress)
    {
        $this->CreatesAddress = $CreatesAddress;
    }


    public function execute(String $companyId, Request $request){

        $object = new AddressBookObject(null, $companyId, $request->input('reference'), $request->input('contact'),
            $request->input('street_one'), $request->input('street_two'), $request->input('city'),
            $request->input('state'), $request->input('post_code'), $request->input('country'), false, true);

        return $this->CreatesAddress->execute($object);
    }
}