syntax = "proto3";
package osmosis.lockup;

import "gogoproto/gogo.proto";
import "amino/amino.proto";
import "google/protobuf/duration.proto";
import "cosmos/base/v1beta1/coin.proto";
import "osmosis/lockup/lock.proto";

option go_package = "github.com/osmosis-labs/osmosis/v13/x/lockup/types";

// Msg defines the Msg service.
service Msg {
  // LockTokens lock tokens
  rpc LockTokens(MsgLockTokens) returns (MsgLockTokensResponse);
  // BeginUnlockingAll begin unlocking all tokens
  rpc BeginUnlockingAll(MsgBeginUnlockingAll)
      returns (MsgBeginUnlockingAllResponse);
  // MsgBeginUnlocking begins unlocking tokens by lock ID
  rpc BeginUnlocking(MsgBeginUnlocking) returns (MsgBeginUnlockingResponse);
  // MsgEditLockup edits the existing lockups by lock ID
  rpc ExtendLockup(MsgExtendLockup) returns (MsgExtendLockupResponse);
  rpc ForceUnlock(MsgForceUnlock) returns (MsgForceUnlockResponse);
}

message MsgLockTokens {
  option (amino.name) = "osmosis/lockup/lock-tokens";

  string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
  google.protobuf.Duration duration = 2 [
    (gogoproto.nullable) = false,
    (gogoproto.stdduration) = true,
    (gogoproto.jsontag) = "duration,omitempty",
    (gogoproto.moretags) = "yaml:\"duration\""
  ];
  repeated cosmos.base.v1beta1.Coin coins = 3 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}
message MsgLockTokensResponse { uint64 ID = 1; }

message MsgBeginUnlockingAll {
  option (amino.name) = "osmosis/lockup/begin-unlock-tokens";

  string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
}
message MsgBeginUnlockingAllResponse { repeated PeriodLock unlocks = 1; }

message MsgBeginUnlocking {
  option (amino.name) = "osmosis/lockup/begin-unlock-period-lock";
  
  string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
  uint64 ID = 2;
  // Amount of unlocking coins. Unlock all if not set.
  repeated cosmos.base.v1beta1.Coin coins = 3 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}
message MsgBeginUnlockingResponse { bool success = 1; }

// MsgExtendLockup extends the existing lockup's duration.
// The new duration is longer than the original.
message MsgExtendLockup {
  string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
  uint64 ID = 2;

  // duration to be set. fails if lower than the current duration, or is
  // unlocking
  google.protobuf.Duration duration = 3 [
    (gogoproto.nullable) = false,
    (gogoproto.stdduration) = true,
    (gogoproto.jsontag) = "duration,omitempty",
    (gogoproto.moretags) = "yaml:\"duration\""
  ];

  // extend for other edit, e.g. cancel unlocking
}

message MsgExtendLockupResponse { bool success = 1; }

// MsgForceUnlock unlocks locks immediately for
// addresses registered via governance.
message MsgForceUnlock {
  string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
  uint64 ID = 2;
  // Amount of unlocking coins. Unlock all if not set.
  repeated cosmos.base.v1beta1.Coin coins = 3 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}

message MsgForceUnlockResponse { bool success = 1; }