syntax = "proto3";

package wix.payment.api.pay.v2;

import "google/api/annotations.proto";
import "wix/payment/api/pay/v2/resources/account.proto";
import "wix/api/annotations.proto";
import "wix/api/entity.proto";
import "wix/api/validations.proto";

option java_package = "com.wix.payment.api.pay.v2";

// Accounts service
service AccountService {

    option (wix.api.service_entity).message = "wix.payment.api.pay.v2.Account";

    // Returns information about cashier account by its accountId (`appDefId:appInstanceId`)
    rpc Get(GetAccountRequest) returns (GetAccountResponse) {
        option (google.api.http) = { get: "/api/payments/v2/accounts/{accountId}" };
        option (.wix.api.crud) = {
            method: GET_ITEM
            get_options: {
                id_field: "accountId"
                item_field: "account"
            }
        };
    }

    // Get list of payable currencies for current metasite
    // flynt-disable missing-permission
    rpc GetPayableCurrencies(GetPayableCurrenciesRequest) returns (GetPayableCurrenciesResponse) {
        option (google.api.http) = {
            get: "/api/payments/v2/accounts/payable-currencies"
        };
    }
}

message GetAccountRequest {
    // accountId (`appDefId:appInstanceId`) of requested account
    string accountId = 1;
}

message GetAccountResponse {
    // account information
    Account account = 1;
}

message GetPayableCurrenciesRequest {

}

message GetPayableCurrenciesResponse {
    // Payable currencies for current metasite
    repeated string currency_code = 1 [(wix.api.minSize) = 1, (wix.api.maxSize) = 200, (wix.api.format) = CURRENCY];
}
