using JsonRpcEndpointSample.Bank.Models;
using JsonRpcEndpointSample.Rpc.Abstractions;

namespace JsonRpcEndpointSample.Bank.Handlers;

[RpcMethod(
    "Bank.MakeDeposit",
    Description = "Deposits money into an existing bank account and returns the new balance.",
    IsReadOnly = false)]
[ExposeAsMcpTool]
public sealed class BankMakeDepositHandler : RpcRequestHandler<MakeDepositRequest, MakeDepositResponse>
{
    protected override Task<MakeDepositResponse> HandleRequestAsync(MakeDepositRequest request)
    {
        MakeDepositResponse response = new MakeDepositResponse();
        response.AccountNumber = request.AccountNumber;
        response.DepositedAmount = request.Amount;
        response.NewBalance = 1000m + request.Amount;

        return Task.FromResult(response);
    }
}
