// 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.layout;

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

// Controls how items are aligned on the cross axis within a single line (row or
// column) of the container. The cross axis is the axis perpendicular to the
// main axis (the direction the row/column lays out its items).
enum AlignItems {
  ALIGN_ITEMS_UNSPECIFIED = 0;
  ALIGN_ITEMS_FLEX_START = 1;
  ALIGN_ITEMS_FLEX_END = 2;
  ALIGN_ITEMS_CENTER = 3;
  ALIGN_ITEMS_BASELINE = 4;
  ALIGN_ITEMS_STRETCH = 5;
}

// Overrides the AlignItems setting for a specific item within the container.
// This lets you customize the alignment of one item without affecting others.
enum AlignSelf {
  ALIGN_SELF_UNSPECIFIED = 0;
  ALIGN_SELF_AUTO = 1;
  ALIGN_SELF_FLEX_START = 2;
  ALIGN_SELF_FLEX_END = 3;
  ALIGN_SELF_CENTER = 4;
  ALIGN_SELF_BASELINE = 5;
  ALIGN_SELF_STRETCH = 6;
}

// Controls the distribution of space between multiple lines of items when they
// wrap within a container. This comes into play when the container has more
// items than can fit on a single line.
enum AlignContent {
  ALIGN_CONTENT_UNSPECIFIED = 0;
  ALIGN_CONTENT_FLEX_START = 1;
  ALIGN_CONTENT_FLEX_END = 2;
  ALIGN_CONTENT_CENTER = 3;
  ALIGN_CONTENT_STRETCH = 4;
  ALIGN_CONTENT_SPACE_BETWEEN = 5;
  ALIGN_CONTENT_SPACE_AROUND = 6;
}

// Dictates the primary direction in which items within a flex container (like
// Row or Column) are laid out.
enum FlexDirection {
  FLEX_DIRECTION_UNSPECIFIED = 0;
  FLEX_DIRECTION_ROW = 1;
  FLEX_DIRECTION_COLUMN = 2;
  FLEX_DIRECTION_ROW_REVERSE = 3;
  FLEX_DIRECTION_COLUMN_REVERSE = 4;
  FLEX_DIRECTION_NONE = 5;
}
// Controls how items are distributed along the main axis of a flex container.
// This is particularly useful when items don't fill the entire available space.
enum JustifyContent {
  JUSTIFY_CONTENT_UNSPECIFIED = 0;
  JUSTIFY_CONTENT_FLEX_START = 1;
  JUSTIFY_CONTENT_FLEX_END = 2;
  JUSTIFY_CONTENT_CENTER = 3;
  JUSTIFY_CONTENT_SPACE_BETWEEN = 4;
  JUSTIFY_CONTENT_SPACE_AROUND = 5;
  JUSTIFY_CONTENT_SPACE_EVENLY = 6;
}

// Determines how an item is positioned within its parent container, providing
// different layout behaviors.
enum PositionType {
  POSITION_TYPE_UNSPECIFIED = 0;
  POSITION_TYPE_RELATIVE = 1;
  POSITION_TYPE_ABSOLUTE = 2;
}

// Defines how content overflows the bounds of a view.
enum Overflow {
  OVERFLOW_UNSPECIFIED = 0;
  OVERFLOW_VISIBLE = 1;
  OVERFLOW_HIDDEN = 2;
  OVERFLOW_SCROLL = 3;
}
// Defines the direction of overflow scrolling
enum OverflowDirection {
  OVERFLOW_DIRECTION_UNSPECIFIED = 0;
  OVERFLOW_DIRECTION_NONE = 1;
  OVERFLOW_DIRECTION_HORIZONTAL_SCROLLING = 2;
  OVERFLOW_DIRECTION_VERTICAL_SCROLLING = 3;
  OVERFLOW_DIRECTION_HORIZONTAL_AND_VERTICAL_SCROLLING = 4;
}

// Defines how a view's size is determined.
enum LayoutSizing {
  LAYOUT_SIZING_UNSPECIFIED = 0;
  LAYOUT_SIZING_FIXED = 1;
  LAYOUT_SIZING_HUG = 2;
  LAYOUT_SIZING_FILL = 3;
}

// Defines the spacing between items in a layout. It can be either
// a fixed value or an "auto" value, which will be calculated based on the
// available space.
message ItemSpacing {
  // Specifies an "auto" spacing value. It contains the desired width and
  // height of the spacing.
  message Auto {
    int32 width = 1;
    int32 height = 2;
  }
  oneof ItemSpacingType {
    int32 fixed = 1;
    Auto auto = 2;
  }
}

// Represents information about the scroll state of a view, including the
// overflow direction and whether paged scrolling is enabled.
message ScrollInfo {
  OverflowDirection overflow = 1;
  bool paged_scrolling = 2;
}

// Defines how flex items wrap when they exceed the available space.
enum FlexWrap {
  FLEX_WRAP_UNSPECIFIED = 0;
  FLEX_WRAP_NO_WRAP = 1;
  FLEX_WRAP_WRAP = 2;
  FLEX_WRAP_WRAP_REVERSE = 3;
}