syntax = "proto3";
package plm.v1;

import "buf/validate/validate.proto";
import "validation/v1/predefined_string_rules.proto";

option csharp_namespace = "Messages.Plm.V1";
option go_package = "github.com/cobotar/protocol/messages/plm/v1";

enum PartType {
  PART_TYPE_UNSPECIFIED = 0;
  PART_TYPE_SUB_ASSEMBLY = 1;
  PART_TYPE_FASTENER = 2;
  PART_TYPE_PLATE = 3;
  PART_TYPE_LUBRICANT = 4;
}

message PartMessage {
  string id = 1;
  string name = 2 [(buf.validate.field).string.(validation.v1.name_component) = true];
  string icon = 3;
  string description = 4;
  PartType type = 5 [
    // (buf.validate.field).required = true,
    (buf.validate.field).enum.defined_only = true
  ];
  int64 weight = 6 [(buf.validate.field).int64.gte = 0]; // weight in grams
  // TODO: add dimensions
  // TODO: add material
  string model_id = 7 [(buf.validate.field).string.(validation.v1.model_id_component) = true];
  repeated string tool_ids = 8 [(buf.validate.field).repeated.items.string.prefix = "tool-"];
}

message PartMessages {
  repeated PartMessage parts = 1;
}
