/*
 *     Copyright 2023 The Dragonfly Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto3";

package trainer.v1;

import "google/protobuf/empty.proto";
import "validate/validate.proto";

option go_package = "d7y.io/api/v2/pkg/apis/trainer/v1;trainer";

// TrainGNNRequest represents to train GNN model request of TrainRequest.
message TrainGNNRequest {
  // Dataset of training GNN.
  bytes dataset = 1 [(validate.rules).bytes.min_len = 1];
}

// TrainMLPRequest represents to train MLP model request of TrainRequest.
message TrainMLPRequest {
  // Dataset of training MLP.
  bytes dataset = 1 [(validate.rules).bytes.min_len = 1];
}

// TrainRequest represents request of Train.
message TrainRequest {
  // Scheduler hostname.
  string hostname = 1 [(validate.rules).string.min_len = 1];
  // Scheduler ip.
  string ip = 2 [(validate.rules).string.ip = true];

  oneof request {
    option (validate.required) = true;

    TrainGNNRequest train_gnn_request = 3;
    TrainMLPRequest train_mlp_request = 4;
  }
}

// Trainer RPC Service.
service Trainer {
  // Train trains models of scheduler using dataset.
  rpc Train(stream TrainRequest) returns(google.protobuf.Empty);
}
