<?php

namespace App\Domains\UserManagement\Actions\UserActivation;

class UserActivationCommand {
    private UserActivationRequest $request;
    public function __construct(UserActivationRequest $request) {
        $this->request = $request;
    }

    public function execute() : UserActivationResponse {
        $response = new UserActivationResponse();
        $this->request->user->active = true;
        $this->request->user->activation_token = null;
        $this->request->user->activation_token_expires_at = null;
        $this->request->user->save();
        $response->success = true;
        return $response;
    }
}
