edition = "2023";

package model;

import "statistic/statistic.proto";
import "broker/broker.proto";

enum TaskStatus {
  UnknownStatus = 0;
  Paused = 1;
  OpenPosition = 2;
  NoPosition = 3;
  TaskPending = 4;
  TaskDone = 5;
  TaskCanceled = 6;
}

message Task {
  // TaskId represents identifier of a deployed model.
  string TaskId = 1 [ json_name = "task_id" ];
  // Model represents of model details used for the deployment.
  Model Model = 2 [ json_name = "model" ];
  // Credential is details of credential used for the deployment.
  broker.BrokerCredential Credential = 3 [ json_name = "credential" ];
  // Interval represents the time period between terms.
  string Interval = 4 [ json_name = "interval" ];
  // Ticker represents the particular product code.
  // ex: BTCUSDT, ETHUSDT
  string Ticker = 5 [ json_name = "ticker" ];
  // Statistic represents result of deployment.
  statistic.Statistic Statistic = 6 [ json_name = "statistic" ];
  // Status is the latest status of the deployment model.
  TaskStatus Status = 7 [ json_name = "status" ];
  // Timing determines execution timing of a trade.
  string Timing = 8 [ json_name = "timing" ];
}

message Model {
  // ModelId is the identifier of a model.
  string ModelId = 1 [ json_name = "model_id" ];
  // Name is the user identifier of a model.
  string Name = 2 [ json_name = "label" ];
  // Description is detailed brief of the model.
  string Description = 3 [ json_name = "description" ];
}
