<?php

namespace App\Factory;

use App\DataTransferObject\CompanyDetailsDto;
use App\Entity\Company;
use App\Entity\User;

final class CompanyFactory
{
    public function create(
        CompanyDetailsDto $companyDetails,
        User $ownerDetails,
    ) : Company {
        $company = new Company();
        $company->setName($companyDetails->getName());
        $company->setAddress($companyDetails->getAddress());
        $company->setCity($companyDetails->getCity());
        $company->setState($companyDetails->getState());
        $company->setZip($companyDetails->getZip());
        $company->setPhone($companyDetails->getPhone());
        $company->setEmail($companyDetails->getEmail());
        $company->setUrl($companyDetails->getUrl());

        $company->setOwner($ownerDetails);

        return $company;
    }
}
