syntax = "proto3";

package profedit;

import "buf/validate/validate.proto";

option go_package = "github.com/jaremko/a7p_transfer_example/profedit";

message Payload {
  Profile profile = 1;
}


message CoefRow {
  int32 bc_cd = 1;
  int32 mv = 2;
}


enum DType {
  VALUE = 0;
  INDEX = 1;
}


message SwPos {
  int32 c_idx = 1;
  int32 reticle_idx = 2;
  int32 zoom = 3;
  int32 distance = 4;
  DType distance_from = 5;
}


enum GType {
  G1 = 0;
  G7 = 1;
  CUSTOM = 2;
}


enum TwistDir {
  RIGHT = 0;
  LEFT = 1;
}


message Profile {
	string profile_name = 1  [(buf.validate.field).string.max_len = 50];
	string cartridge_name = 2 [(buf.validate.field).string.max_len = 50];
	string bullet_name = 3 [(buf.validate.field).string.max_len = 50];
	string short_name_top = 4 [(buf.validate.field).string.max_len = 8];
	string short_name_bot = 5 [(buf.validate.field).string.max_len = 8];
	string user_note = 6 [(buf.validate.field).string.max_len = 250];
	int32 zero_x = 7 [(buf.validate.field).int32.gte = -600000, (buf.validate.field).int32.lte = 600000];
	int32 zero_y = 8 [(buf.validate.field).int32.gte = -600000, (buf.validate.field).int32.lte = 600000];
	int32 sc_height = 9 [(buf.validate.field).int32.gte = -5000, (buf.validate.field).int32.lte = 5000];
	int32 r_twist = 10 [(buf.validate.field).int32.gte = 0, (buf.validate.field).int32.lte = 10000];
	int32 c_muzzle_velocity = 11 [(buf.validate.field).int32.gte = 100, (buf.validate.field).int32.lte = 30000];
	int32 c_zero_temperature = 12 [(buf.validate.field).int32.gte = -100, (buf.validate.field).int32.lte = 100];
	int32 c_t_coeff = 13 [(buf.validate.field).int32.gte = 2, (buf.validate.field).int32.lte = 3000];
	int32 c_zero_distance_idx = 14 [(buf.validate.field).int32.gte = 0, (buf.validate.field).int32.lt = 200];
	int32 c_zero_air_temperature = 15 [(buf.validate.field).int32.gte = -100, (buf.validate.field).int32.lte = 100];
	int32 c_zero_air_pressure = 16;
	int32 c_zero_air_humidity = 17 [(buf.validate.field).int32.gte = 0, (buf.validate.field).int32.lte = 100];
	int32 c_zero_w_pitch = 18[(buf.validate.field).int32.gte = -90, (buf.validate.field).int32.lte = 90];
	int32 c_zero_p_temperature = 19 [(buf.validate.field).int32.gte = -100, (buf.validate.field).int32.lte = 100];
	int32 b_diameter = 20 [(buf.validate.field).int32.gte = 1, (buf.validate.field).int32.lte = 65535];
	int32 b_weight = 21 [(buf.validate.field).int32.gte = 10, (buf.validate.field).int32.lte = 65535];
	int32 b_length = 22 [(buf.validate.field).int32.gte = 1, (buf.validate.field).int32.lte = 10000];
	TwistDir twist_dir = 23;
	GType bc_type = 24;
	repeated SwPos switches = 25 [(buf.validate.field).repeated.max_items  = 4, (buf.validate.field).repeated.min_items = 1];
	repeated int32 distances = 26[(buf.validate.field).repeated.max_items  = 200, (buf.validate.field).repeated.min_items = 4];
	repeated CoefRow coef_rows = 27 [(buf.validate.field).repeated.max_items  = 200, (buf.validate.field).repeated.min_items = 1];//each row must be unique( in a sense that no mv duplicates should be present)
	string caliber = 28 [(buf.validate.field).string.max_len = 50];
	string device_uuid = 29 [(buf.validate.field).string.max_len = 50];
}
