<?php

namespace App\Classes\Modules\Companies\Services;


use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Models\Company;

class CreatesCompany
{
    /** @var Company */
    private $repository;


    /**
     * @param Company $repository
     */
    public function __construct(Company $repository) {
        $this->repository = $repository;
    }

    public function execute(CompanyObject $object) {

        $model = $this->repository->create([
            'marking' => $object->getMarking(),
            'name' => $object->getName(),
            'email' => $object->getEmail(),
            'registration_no' => $object->getRegistrationNumber(),
            'tax_no' => $object->getTaxNumber(),
        ]);



        return $model;

    }
}