//
// Copyright 2019 Google LLC
//
// 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 = "proto2";

package zetasql;

option java_package = "com.google.zetasql";

message FormatterOptionsProto {
  // The new line separator characters to use in the formatted output.
  // Usually one of "\n", "\r", "\n\r", or "\r\n".
  optional string new_line_type = 1;

  // The line length limit, in characters.
  optional int32 line_length_limit = 2;

  // Number of spaces per level of indentation.
  optional int32 indentation_spaces = 3;

  // If true, formatter tries to proceed even if it encounters invalid ZetaSQL
  // tokens.
  optional bool allow_invalid_tokens = 4;

  // If true, formatter capitalizes reserved ZetaSQL keywords.
  optional bool capitalize_keywords = 5;

  // If true, formatter tries to preserve valid line breaks.
  optional bool preserve_line_breaks = 6;

  // If true and formatting only certain input ranges, the ranges are expanded
  // on both ends if needed to include entire statements.
  optional bool expand_format_ranges = 7;

  // If true, formatter replaces doubles quotes to single quotes for enclosing
  // string literals.
  optional bool enforce_single_quotes = 8;

  // If true, formatter capitalizes reserved ZetaSQL builtin functions.
  optional bool capitalize_functions = 9;
}

// Represents a byte range [start, end) in the input to be formatted.
// Also see expand_format_ranges above. If it is not enabled and a range
// starts/ends in the middle of a token, the result may be malformed.
message FormatterRangeProto {
  // 0-based byte offset start, inclusive.
  optional int32 start = 1;
  // 0-based byte offset end, exclusive.
  optional int32 end = 2;
}
