syntax = "proto3";
package provenance.attribute.v1;

option go_package = "github.com/provenance-io/provenance/x/attribute/types";

option java_package        = "io.provenance.attribute.v1";
option java_multiple_files = true;

import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "provenance/attribute/v1/attribute.proto";

// Msg defines the attribute module Msg service.
service Msg {
  option (cosmos.msg.v1.service) = true;

  // AddAttribute defines a method to verify a particular invariance.
  rpc AddAttribute(MsgAddAttributeRequest) returns (MsgAddAttributeResponse);

  // UpdateAttribute defines a method to verify a particular invariance.
  rpc UpdateAttribute(MsgUpdateAttributeRequest) returns (MsgUpdateAttributeResponse);

  // UpdateAttributeExpiration defines a method to verify a particular invariance.
  rpc UpdateAttributeExpiration(MsgUpdateAttributeExpirationRequest) returns (MsgUpdateAttributeExpirationResponse);

  // DeleteAttribute defines a method to verify a particular invariance.
  rpc DeleteAttribute(MsgDeleteAttributeRequest) returns (MsgDeleteAttributeResponse);

  // DeleteDistinctAttribute defines a method to verify a particular invariance.
  rpc DeleteDistinctAttribute(MsgDeleteDistinctAttributeRequest) returns (MsgDeleteDistinctAttributeResponse);

  // SetAccountData defines a method for setting/updating an account's accountdata attribute.
  rpc SetAccountData(MsgSetAccountDataRequest) returns (MsgSetAccountDataResponse);

  // UpdateParams is a governance proposal endpoint for updating the attribute module's params.
  rpc UpdateParams(MsgUpdateParamsRequest) returns (MsgUpdateParamsResponse);
}

// MsgAddAttributeRequest defines an sdk.Msg type that is used to add a new attribute to an account.
// Attributes may only be set in an account by the account that the attribute name resolves to.
message MsgAddAttributeRequest {
  option (cosmos.msg.v1.signer) = "owner";

  // The attribute name.
  string name = 1;
  // The attribute value.
  bytes value = 2;
  // The attribute value type.
  AttributeType attribute_type = 3;
  // The account to add the attribute to.
  string account = 4;
  // The address that the name must resolve to.
  string owner = 5;
  // Time that an attribute will expire.
  google.protobuf.Timestamp expiration_date = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
  // concrete_type defines the specific type of data for PROTO or JSON attribute.
  // Optional. Max 200 characters.
  string concrete_type = 7;
}

// MsgAddAttributeResponse defines the Msg/AddAttribute response type.
message MsgAddAttributeResponse {}

// MsgUpdateAttributeRequest defines an sdk.Msg type that is used to update an existing attribute to an account.
// Attributes may only be set in an account by the account that the attribute name resolves to.
message MsgUpdateAttributeRequest {
  option (cosmos.msg.v1.signer) = "owner";

  // The attribute name.
  string name = 1;
  // The original attribute value.
  bytes original_value = 2;
  // The update attribute value.
  bytes update_value = 3;
  // The original attribute value type.
  AttributeType original_attribute_type = 4;
  // The update attribute value type.
  AttributeType update_attribute_type = 5;
  // The account to add the attribute to.
  string account = 6;
  // The address that the name must resolve to.
  string owner = 7;
  // concrete_type defines the specific type of data for PROTO or JSON attribute.
  // Optional. Max 200 characters.
  string concrete_type = 8;
}

// MsgUpdateAttributeResponse defines the Msg/UpdateAttribute response type.
message MsgUpdateAttributeResponse {}

// MsgUpdateAttributeExpirationRequest defines an sdk.Msg type that is used to update an existing attribute's expiration
// date
message MsgUpdateAttributeExpirationRequest {
  option (cosmos.msg.v1.signer) = "owner";

  // The attribute name.
  string name = 1;
  // The original attribute value.
  bytes value = 2;
  // Time that an attribute will expire.
  google.protobuf.Timestamp expiration_date = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
  // The account to add the attribute to.
  string account = 4;
  // The address that the name must resolve to.
  string owner = 5;
}

// MsgUpdateAttributeExpirationResponse defines the Msg/Vote response type.
message MsgUpdateAttributeExpirationResponse {}

// MsgDeleteAttributeRequest defines a message to delete an attribute from an account
// Attributes may only be removed from an account by the account that the attribute name resolves to.
message MsgDeleteAttributeRequest {
  option (cosmos.msg.v1.signer) = "owner";

  // The attribute name.
  string name = 1;
  // The account to add the attribute to.
  string account = 2;
  // The address that the name must resolve to.
  string owner = 3;
}

// MsgDeleteAttributeResponse defines the Msg/DeleteAttribute response type.
message MsgDeleteAttributeResponse {}

// MsgDeleteDistinctAttributeRequest defines a message to delete an attribute with matching name, value, and type from
// an account. Attributes may only be removed from an account by the account that the attribute name resolves to.
message MsgDeleteDistinctAttributeRequest {
  option (cosmos.msg.v1.signer) = "owner";

  // The attribute name.
  string name = 1;
  // The attribute value.
  bytes value = 2;
  // The account to add the attribute to.
  string account = 3;
  // The address that the name must resolve to.
  string owner = 4;
}

// MsgDeleteDistinctAttributeResponse defines the Msg/DeleteDistinctAttribute response type.
message MsgDeleteDistinctAttributeResponse {}

// MsgSetAccountDataRequest defines a message to set an account's accountdata attribute.
message MsgSetAccountDataRequest {
  option (cosmos.msg.v1.signer) = "account";

  string value   = 1;
  string account = 2;
}

// MsgSetAccountDataResponse defines the Msg/SetAccountData response type.
message MsgSetAccountDataResponse {}

// MsgUpdateParamsRequest is a request message for the UpdateParams endpoint.
message MsgUpdateParamsRequest {
  option (cosmos.msg.v1.signer) = "authority";

  // authority should be the governance module account address.
  string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // params are the new param values to set.
  Params params = 2 [(gogoproto.nullable) = false];
}

// MsgUpdateParamsResponse is a response message for the UpdateParams endpoint.
message MsgUpdateParamsResponse {}