syntax = "proto3";
package commandpb;

import "rpc.proto";

option go_package = ".;xlineapi";
option java_package = "com.xline.protobuf";
option java_outer_classname = "CommandProto";
option java_multiple_files = true;

// Command
message Command {
    repeated KeyRange keys = 1;
    RequestWithToken request = 2;
    uint64 compact_id = 3;
}

// Command::ER
message CommandResponse {
    oneof response_wrapper {
        etcdserverpb.RangeResponse range_response = 1;
        etcdserverpb.PutResponse put_response = 2;
        etcdserverpb.DeleteRangeResponse delete_range_response = 3;
        etcdserverpb.TxnResponse txn_response = 4;
        etcdserverpb.CompactionResponse compaction_response = 5;
        etcdserverpb.AuthEnableResponse auth_enable_response = 6;
        etcdserverpb.AuthDisableResponse auth_disable_response = 7;
        etcdserverpb.AuthStatusResponse auth_status_response = 8;
        etcdserverpb.AuthRoleAddResponse auth_role_add_response = 9;
        etcdserverpb.AuthRoleDeleteResponse auth_role_delete_response = 10;
        etcdserverpb.AuthRoleGetResponse auth_role_get_response = 11;
        etcdserverpb.AuthRoleGrantPermissionResponse
            auth_role_grant_permission_response = 12;
        etcdserverpb.AuthRoleListResponse auth_role_list_response = 13;
        etcdserverpb.AuthRoleRevokePermissionResponse
            auth_role_revoke_permission_response = 14;
        etcdserverpb.AuthUserAddResponse auth_user_add_response = 15;
        etcdserverpb.AuthUserChangePasswordResponse
            auth_user_change_password_response = 16;
        etcdserverpb.AuthUserDeleteResponse auth_user_delete_response = 17;
        etcdserverpb.AuthUserGetResponse auth_user_get_response = 18;
        etcdserverpb.AuthUserGrantRoleResponse auth_user_grant_role_response =
            19;
        etcdserverpb.AuthUserListResponse auth_user_list_response = 20;
        etcdserverpb.AuthUserRevokeRoleResponse auth_user_revoke_role_response =
            21;
        etcdserverpb.AuthenticateResponse authenticate_response = 22;
        etcdserverpb.LeaseGrantResponse lease_grant_response = 23;
        etcdserverpb.LeaseRevokeResponse lease_revoke_response = 24;
        etcdserverpb.LeaseLeasesResponse lease_leases_response = 25;
    }
}

// Command::ASR
message SyncResponse {
    int64 revision = 1;
}

message KeyRange {
    bytes key = 1;
    bytes range_end = 2;
}

message RequestWithToken {
    optional string token = 1;
    oneof request_wrapper {
        etcdserverpb.RangeRequest range_request = 2;
        etcdserverpb.PutRequest put_request = 3;
        etcdserverpb.DeleteRangeRequest delete_range_request = 4;
        etcdserverpb.TxnRequest txn_request = 5;
        etcdserverpb.CompactionRequest compaction_request = 6;
        etcdserverpb.AuthEnableRequest auth_enable_request = 7;
        etcdserverpb.AuthDisableRequest auth_disable_request = 8;
        etcdserverpb.AuthStatusRequest auth_status_request = 9;
        etcdserverpb.AuthRoleAddRequest auth_role_add_request = 10;
        etcdserverpb.AuthRoleDeleteRequest auth_role_delete_request = 11;
        etcdserverpb.AuthRoleGetRequest auth_role_get_request = 12;
        etcdserverpb.AuthRoleGrantPermissionRequest
            auth_role_grant_permission_request = 13;
        etcdserverpb.AuthRoleListRequest auth_role_list_request = 14;
        etcdserverpb.AuthRoleRevokePermissionRequest
            auth_role_revoke_permission_request = 15;
        etcdserverpb.AuthUserAddRequest auth_user_add_request = 16;
        etcdserverpb.AuthUserChangePasswordRequest
            auth_user_change_password_request = 17;
        etcdserverpb.AuthUserDeleteRequest auth_user_delete_request = 18;
        etcdserverpb.AuthUserGetRequest auth_user_get_request = 19;
        etcdserverpb.AuthUserGrantRoleRequest auth_user_grant_role_request = 20;
        etcdserverpb.AuthUserListRequest auth_user_list_request = 21;
        etcdserverpb.AuthUserRevokeRoleRequest auth_user_revoke_role_request =
            22;
        etcdserverpb.AuthenticateRequest authenticate_request = 23;
        etcdserverpb.LeaseGrantRequest lease_grant_request = 24;
        etcdserverpb.LeaseRevokeRequest lease_revoke_request = 25;
        etcdserverpb.LeaseLeasesRequest lease_leases_request = 26;
    }
}
