syntax = "proto3";

package nominal.connect.download.v1;

import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "nominal/gen/v1/error.proto";

option java_multiple_files = true;
option java_package = "io.nominal.connect.download";

message GetLatestConnectUriRequest {
  string platform = 1 [
    (buf.validate.field).string.in = "macos",
    (buf.validate.field).string.in = "windows",
    (buf.validate.field).string.in = "ubuntu"
  ];
}

message GetLatestConnectUriResponse {
  string uri = 1;
}

enum ConnectDownloadServiceError {
  CONNECT_DOWNLOAD_SERVICE_ERROR_UNSPECIFIED = 0;
  CONNECT_DOWNLOAD_SERVICE_ERROR_CONNECT_NOT_AVAILABLE = 1 [(nominal.gen.v1.error) = {
    code: "NOT_FOUND"
    message: "Connect not available for download on this stack. Please contact support."
  }];
}

// Service for downloading Connect binaries
service ConnectDownloadService {
  // Get a pre-signed URL for downloading the latest version of Connect for a given platform
  rpc GetLatestConnectUri(GetLatestConnectUriRequest) returns (GetLatestConnectUriResponse) {
    option (google.api.http) = {get: "/connect/v1/download/{platform}/uri"};
  }
}
