/**
 * The MIT License (MIT)
 * Copyright (c) 2016-2017 Intel Corporation
 * Copyright (c) 2023 Omics Data Automation, Inc.
 * Copyright (c) 2023 dātma, inc™
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of 
 * this software and associated documentation files (the "Software"), to deal in 
 * the Software without restriction, including without limitation the rights to 
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 
 * the Software, and to permit persons to whom the Software is furnished to do so, 
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all 
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/**
 * Note: Variable names are kept aligned with
 * GenomicsDB JSON configuration. If decide to
 * change them back to camel case, docs must be
 * updated to be consistent
 *
 * To build, use protocol buffer version >3.2.0 and the following command from base directory:
 * $ protoc -Isrc/resources/ --java_out=src/main/java/ src/resources/genomicsdb_import_config.proto
 */

syntax = "proto2";

option java_package = "org.genomicsdb.model";
option java_outer_classname = "GenomicsDBImportConfiguration";

option go_package = "protobuf/";

package genomicsdb_pb;

import "genomicsdb_coordinates.proto";
import "genomicsdb_vid_mapping.proto";
import "genomicsdb_callsets_mapping.proto";

message Partition {
  required GenomicsDBColumn begin = 1;
  optional string workspace = 2;
  oneof array {
    string array_name = 3;
    bool generate_array_name_from_partition_bounds = 4;
  }
  optional string vcf_output_filename = 5;
  optional string vcf_header_filename = 7;
  optional GenomicsDBColumn end = 6;
}

message ImportConfiguration {
  required int64 size_per_column_partition = 7 [default = 16384];
  optional bool row_based_partitioning = 1 [default = false];
  optional bool produce_combined_vcf = 2 [default = false];
  optional bool produce_tiledb_array = 3 [default = true];
  repeated Partition column_partitions = 4;
  oneof vid_mapping_options {
    string vid_mapping_file = 5;
    VidMappingPB vid_mapping = 25; 
  }
  oneof callset_mapping_options {
    string callset_mapping_file = 6;
    CallsetMappingPB callset_mapping = 26;
  }
  optional bool treat_deletions_as_intervals = 8 [default = true];
  optional int32 num_parallel_vcf_files = 9 [default = 1];
  optional bool delete_and_create_tiledb_array = 10 [default = false];
  optional bool do_ping_pong_buffering = 11 [default = true];
  optional bool offload_vcf_output_processing = 12 [default = true];
  optional bool discard_vcf_index = 13 [default = true];
  optional int64 segment_size = 14 [default = 10485760];
  optional bool compress_tiledb_array = 15 [default = true];
  optional int64 num_cells_per_tile = 16 [default = 1000];
  optional bool fail_if_updating = 17 [default = false];
  optional int32 tiledb_compression_type = 18 [default = 1];
  optional int32 tiledb_compression_level = 19 [default = -1];
  optional bool consolidate_tiledb_array_after_load = 20 [default = false];
  optional bool disable_synced_writes = 21 [default = true];
  optional bool ignore_cells_not_in_partition = 22;

  optional int64 lb_callset_row_idx = 23 [ default = 0 ];
  optional int64 ub_callset_row_idx = 24;

  optional bool enable_shared_posixfs_optimizations = 27 [ default = false ];
  optional bool disable_delta_encode_for_offsets = 28 [ default = false ];
  optional bool disable_delta_encode_for_coords = 29 [ default = false ];
  optional bool enable_bit_shuffle_gt = 30 [ default = false ];
  optional bool enable_lz4_compression_gt = 31 [ default = false ];
  
  optional string reference_genome = 32;
  optional string vcf_header_filename = 33;
}
