syntax = "proto3";

package akash.manifest.v2beta2;

import "gogoproto/gogo.proto";
import "akash/manifest/v2beta2/serviceexpose.proto";
import "akash/base/v1beta3/resources.proto";

option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all)         = true;
option go_package                       = "github.com/akash-network/akash-api/go/manifest/v2beta2";

// StorageParams
message StorageParams {
    string name   = 1 [
      (gogoproto.jsontag)  = "name",
      (gogoproto.moretags) = "yaml:\"name\""
    ];
    string mount  = 2 [
      (gogoproto.jsontag)  = "mount",
      (gogoproto.moretags) = "yaml:\"mount\""
    ];
    bool read_only = 3 [
      (gogoproto.jsontag)  = "readOnly",
      (gogoproto.moretags) = "yaml:\"readOnly\""
    ];
}

// ServiceParams
message ServiceParams {
  repeated StorageParams storage = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.jsontag)  = "storage",
    (gogoproto.moretags) = "yaml:\"storage\""
  ];
}

// Credentials to fetch image from registry
message ServiceImageCredentials {
  string host = 1 [
    (gogoproto.jsontag)  = "host",
    (gogoproto.moretags) = "yaml:\"host\""
  ];
  string email = 2 [
    (gogoproto.jsontag)  = "email",
    (gogoproto.moretags) = "yaml:\"email\""
  ];
  string username = 3 [
    (gogoproto.jsontag)  = "username",
    (gogoproto.moretags) = "yaml:\"username\""
  ];
  string password = 4 [
    (gogoproto.jsontag)  = "password",
    (gogoproto.moretags) = "yaml:\"password\""
  ];
}

// Service stores name, image, args, env, unit, count and expose list of service
message Service {
  string name = 1 [
    (gogoproto.jsontag)  = "name",
    (gogoproto.moretags) = "yaml:\"name\""
  ];
  string image = 2 [
    (gogoproto.jsontag)  = "image",
    (gogoproto.moretags) = "yaml:\"image\""
  ];
  repeated string command = 3 [
    (gogoproto.jsontag)  = "command",
    (gogoproto.moretags) = "yaml:\"command\""
  ];
  repeated string args = 4 [
    (gogoproto.jsontag)  = "args",
    (gogoproto.moretags) = "yaml:\"args\""
  ];
  repeated string env = 5 [
    (gogoproto.nullable) = true,
    (gogoproto.jsontag)  = "env",
    (gogoproto.moretags) = "yaml:\"env\""
  ];
  akash.base.v1beta3.Resources resources = 6 [
    (gogoproto.nullable) = false,
    (gogoproto.jsontag)  = "resources",
    (gogoproto.moretags) = "yaml:\"resources\""
  ];
  uint32 count = 7 [
    (gogoproto.jsontag)  = "count",
    (gogoproto.moretags) = "yaml:\"count\""
  ];
  repeated ServiceExpose expose = 8 [
    (gogoproto.nullable)     = false,
    (gogoproto.castrepeated) = "ServiceExposes",
    (gogoproto.jsontag)      = "expose",
    (gogoproto.moretags)     = "yaml:\"expose\""
  ];
  ServiceParams params = 9 [
    (gogoproto.nullable) = true,
    (gogoproto.jsontag)  = "params",
    (gogoproto.moretags) = "yaml:\"params\""
  ];
  ServiceImageCredentials credentials = 10 [
    (gogoproto.nullable) = true,
    (gogoproto.jsontag)  = "credentials",
    (gogoproto.moretags) = "yaml:\"credentials\""
  ];
}
