package extractcommand.step06;

import extractcommand.step00.*;
import extractcommand.AtmCommand;

// * Move inner to upper (F6 again)
class CheckOwner extends AtmCommand<User> {
    private AccountService accountService;
    private final int accountNumber;

    public CheckOwner(Logger logger, AccountService accountService, int accountNumber) {
        super(logger);
        this.accountService = accountService;
        this.accountNumber = accountNumber;
    }

    protected User doExecute() throws AccountServiceException {
        User result;
        Account account = accountService.findAccount(accountNumber);
        result = account.getOwner();
        return result;
    }
}

