// Copyright 2024 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 = "proto3";

package designcompose.definition.view;

import "definition/element/background.proto";
import "definition/element/font.proto";
import "definition/element/geometry.proto";
import "definition/element/path.proto";
import "definition/element/scalable.proto";
import "definition/element/shader.proto";
import "definition/element/variable.proto";
import "definition/interaction/pointer.proto";
import "definition/layout/grid.proto";
import "definition/layout/positioning.proto";
import "definition/modifier/blend.proto";
import "definition/modifier/filter.proto";
import "definition/modifier/matrix_transform.proto";
import "definition/modifier/shadow.proto";
import "definition/modifier/text.proto";
import "definition/plugin/meter_data.proto";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition.view";
option optimize_for = LITE_RUNTIME;

// Configures whether a view is displayed using a Flexbox layout or not at all.
enum Display {
  DISPLAY_UNSPECIFIED = 0;
  DISPLAY_FLEX = 1;
  DISPLAY_NONE = 2;
}

// Contains all of the styleable parameters accepted by the Rect and Text
// components.
// Next id = 46
message NodeStyle {
  // Text properties
  element.Background text_color = 1[deprecated = true];
  element.Background font_color = 45;
  element.NumOrVar font_size = 2;
  optional string font_family = 3;
  element.FontWeight font_weight = 4;
  element.FontStyle font_style = 5;
  element.TextDecoration text_decoration = 40;
  optional float letter_spacing = 41;
  element.FontStretch font_stretch = 6;
  repeated element.Background backgrounds = 7;
  repeated modifier.BoxShadow box_shadows = 8;
  element.Stroke stroke = 9;
  optional float opacity = 10;

  // Transforms
  modifier.LayoutTransform transform = 11;
  modifier.LayoutTransform relative_transform = 12;

  // Text layout
  modifier.TextAlign text_align = 13;
  modifier.TextAlignVertical text_align_vertical = 14;
  modifier.TextOverflow text_overflow = 15;
  modifier.TextShadow text_shadow = 16;


  // Size and layout
  element.Size node_size = 17;
  element.LineHeight line_height = 18;
  optional int32 line_count = 19;
  repeated element.FontFeature font_features = 20;
  repeated modifier.FilterOp filters = 21;
  repeated modifier.FilterOp backdrop_filters = 22;
  modifier.BlendMode blend_mode = 23;

  // Layout properties
  Display display_type = 24;
  layout.FlexWrap flex_wrap = 25;
  optional layout.GridLayoutType grid_layout_type = 26;
  uint32 grid_columns_rows = 27;
  uint32 grid_adaptive_min_size = 28;
  repeated layout.GridSpan grid_span_contents = 29;
  layout.Overflow overflow = 30;
  optional uint32 max_children = 31;
  optional string overflow_node_id = 32;
  optional string overflow_node_name = 33;
  float cross_axis_item_spacing = 34;
  layout.LayoutSizing horizontal_sizing = 35;
  layout.LayoutSizing vertical_sizing = 36;
  optional float aspect_ratio = 37;
  interaction.PointerEvents pointer_events = 38;
  plugin.MeterData meter_data = 39;
  element.Hyperlink hyperlink = 42;

  // Runtime shader from the shader plugin as background.
  // When shader is present, background will not be drawn.
  optional element.ShaderData shader_data = 43;

  optional element.ScalableUIData scalable_data = 44;
}
