syntax = "proto3";
package vulcanize.nameservice.v1beta1;

import "gogoproto/gogo.proto";
import "vulcanize/nameservice/v1beta1/nameservice.proto";

option go_package = "github.com/tharsis/ethermint/x/nameservice/types";

// Msg
service Msg {
  // SetRecord will records a new record with given payload and bond id
  rpc SetRecord(MsgSetRecord) returns(MsgSetRecordResponse){}
  // Renew Record will renew the expire record
  rpc RenewRecord(MsgRenewRecord) returns (MsgRenewRecordResponse){}
  // AssociateBond
  rpc AssociateBond(MsgAssociateBond) returns (MsgAssociateBondResponse){}
  // DissociateBond
  rpc DissociateBond(MsgDissociateBond) returns (MsgDissociateBondResponse){}
  // DissociateRecords
  rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse){}
  // ReAssociateRecords
  rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse){}
  // SetName will store the name with given wrn and name
  rpc SetName(MsgSetName) returns (MsgSetNameResponse){}
  // Reserve name
  rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse){}
  // Delete Name method will remove authority name
  rpc DeleteName(MsgDeleteNameAuthority) returns (MsgDeleteNameAuthorityResponse){}
  // SetAuthorityBond
  rpc SetAuthorityBond(MsgSetAuthorityBond) returns (MsgSetAuthorityBondResponse){}
}

// MsgSetRecord
message MsgSetRecord{
  string bond_id = 1  [
    (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""
  ];
  string signer = 2;
  Payload payload = 3 [
    (gogoproto.nullable) = false
  ];
}

// MsgSetRecordResponse
message MsgSetRecordResponse{
}

// Payload
message Payload {
  Record record = 1;
  repeated Signature signatures = 2  [
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "json:\"signatures\" yaml:\"signatures\""
  ];
}

// MsgSetName
message MsgSetName{
  string wrn = 1;
  string cid = 2;
  string signer = 3;
}

// MsgSetNameResponse
message MsgSetNameResponse{
}

// MsgReserveName
message MsgReserveAuthority{
  string name = 1;
  string signer = 2;
  // if creating a sub-authority.
  string owner = 3;
}

// MsgReserveNameResponse
message MsgReserveAuthorityResponse{
}

// MsgSetAuthorityBond is SDK message for SetAuthorityBond
message MsgSetAuthorityBond{
  string name = 1;
  string bond_id = 2 [
    (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""
  ];
  string signer = 3;
}

// MsgSetAuthorityBondResponse
message MsgSetAuthorityBondResponse{
}

// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
message MsgDeleteNameAuthority{
  string wrn = 1;
  string signer = 2;
}

// MsgDeleteNameAuthorityResponse
message MsgDeleteNameAuthorityResponse{
}

//MsgRenewRecord is SDK message for Renew a record
message MsgRenewRecord{
  string record_id = 1 [
    (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""
  ];
  string signer = 2;
}

// MsgRenewRecordResponse
message MsgRenewRecordResponse{
}

// MsgAssociateBond
message MsgAssociateBond{
  string record_id = 1 [
    (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""
  ];
  string bond_id = 2 [
    (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""
  ];
  string signer = 3;
}

// MsgAssociateBondResponse
message MsgAssociateBondResponse{
}

// MsgDissociateBond is SDK message for Msg/DissociateBond
message MsgDissociateBond{
  string record_id = 1 [
    (gogoproto.moretags) = "json:\"recordId\" yaml:\"recordId\""
  ];
  string signer = 2;
}

// MsgDissociateBondResponse is response type for MsgDissociateBond
message MsgDissociateBondResponse{
}

// MsgDissociateRecords is SDK message for Msg/DissociateRecords
message MsgDissociateRecords{
  string bond_id = 1 [
    (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""
  ];
  string signer = 2;
}

// MsgDissociateRecordsResponse is response type for MsgDissociateRecords
message MsgDissociateRecordsResponse{
}

// MsgReAssociateRecords is SDK message for Msg/ReAssociateRecords
message MsgReAssociateRecords{
  string new_bond_id = 1 [
    (gogoproto.moretags) = "json:\"newBondId\" yaml:\"newBondId\""
  ];
  string old_bond_id = 2 [
    (gogoproto.moretags) = "json:\"oldBondId\" yaml:\"oldBondId\""
  ];
  string signer = 3;
}

// MsgReAssociateRecordsResponse is response type for MsgReAssociateRecords
message MsgReAssociateRecordsResponse{
}
