<?php

namespace App\Domains\Event\Actions\SetCostUnit;

class SetCostUnitCommand {
    private SetCostUnitRequest $request;

    public function __construct(SetCostUnitRequest $request) {
        $this->request = $request;
    }

    public function execute() : SetCostUnitResponse {
        $response = new SetCostUnitResponse();
        $this->request->event->cost_unit_id = $this->request->costUnit->id;
        $response->success = $this->request->event->save();
        return $response;
    }
}
