syntax = "proto3";
package akash.deployment.v1beta3;

import "gogoproto/gogo.proto";

option go_package = "github.com/akash-network/akash-api/go/node/deployment/v1beta3";

// DeploymentID stores owner and sequence number
message DeploymentID {
  option (gogoproto.equal)            = false;
  option (gogoproto.goproto_stringer) = false;

  string owner = 1 [
    (gogoproto.jsontag)  = "owner",
    (gogoproto.moretags) = "yaml:\"owner\""
  ];
  uint64 dseq = 2 [
    (gogoproto.customname) = "DSeq",
    (gogoproto.jsontag)    = "dseq",
    (gogoproto.moretags)   = "yaml:\"dseq\""
  ];
}

// Deployment stores deploymentID, state and version details
message Deployment {
  option (gogoproto.equal) = false;

  DeploymentID deployment_id = 1 [
    (gogoproto.nullable)   = false,
    (gogoproto.customname) = "DeploymentID",
    (gogoproto.jsontag)    = "id",
    (gogoproto.moretags)   = "yaml:\"id\""
  ];

  // State is an enum which refers to state of deployment
  enum State {
    option (gogoproto.goproto_enum_prefix) = false;

    // Prefix should start with 0 in enum. So declaring dummy state
    invalid = 0 [(gogoproto.enumvalue_customname) = "DeploymentStateInvalid"];
    // DeploymentActive denotes state for deployment active
    active = 1 [(gogoproto.enumvalue_customname)  = "DeploymentActive"];
    // DeploymentClosed denotes state for deployment closed
    closed = 2 [(gogoproto.enumvalue_customname)  = "DeploymentClosed"];
  }

  State state   = 2 [
    (gogoproto.jsontag)  = "state",
    (gogoproto.moretags) = "yaml:\"state\""
  ];
  bytes version = 3 [
    (gogoproto.jsontag)  = "version",
    (gogoproto.moretags) = "yaml:\"version\""
  ];
  int64 created_at = 4;
}

// DeploymentFilters defines filters used to filter deployments
message DeploymentFilters {
  option (gogoproto.equal) = false;

  string owner = 1 [
    (gogoproto.jsontag)  = "owner",
    (gogoproto.moretags) = "yaml:\"owner\""
  ];
  uint64 dseq  = 2 [
    (gogoproto.customname) = "DSeq",
    (gogoproto.jsontag)    = "dseq",
    (gogoproto.moretags)   = "yaml:\"dseq\""
  ];
  string state = 3 [
    (gogoproto.jsontag)  = "state",
    (gogoproto.moretags) = "yaml:\"state\""
  ];
}
