// flynt-disable missing-array-limits
// flynt-disable missing-string-validations

syntax = "proto3";

package wix.rich_content.v1;
import "wix/api/validations.proto";
import "wix/rich_content/v1/common.proto";
import "google/protobuf/wrappers.proto";

message PollData {
  message Poll {
    message Option {
      google.protobuf.StringValue id = 1; // Option ID.
      google.protobuf.StringValue title = 2; // Option title.
      Media image = 3; // The image displayed with the option.
    }

    message Settings {
      message Permissions {
        enum ViewRole {
          CREATOR = 0; // Only Poll creator can view the results
          VOTERS = 1; // Anyone who voted can see the results
          EVERYONE = 2; // Anyone can see the results, even if one didn't vote
        }

        enum VoteRole {
          SITE_MEMBERS = 0; // Logged in member
          ALL = 1; // Anyone
        }

        ViewRole view = 1; // Sets who can view the poll results.
        VoteRole vote = 2; // Sets who can vote.
        google.protobuf.BoolValue allow_multiple_votes = 3; // Sets whether one voter can vote multiple times. Defaults to `false`.
      }

      Permissions permissions = 1; // Permissions settings for voting.
      google.protobuf.BoolValue show_voters = 2; // Sets whether voters are displayed in the vote results. Defaults to `true`.
      google.protobuf.BoolValue show_votes_count = 3; // Sets whether the vote count is displayed. Defaults to `true`.
    }

    google.protobuf.StringValue id = 1; // Poll ID.
    google.protobuf.StringValue title = 2; // Poll title.
    google.protobuf.StringValue creator_id = 3; // Poll creator ID.
    Media image = 4; // Main poll image.
    repeated Option options = 5; // Voting options.
    Settings settings = 6; // The poll's permissions and display settings.
  }

  message Layout {
    message PollLayout {
      enum Type {
        LIST = 0; // List
        GRID = 1; // Grid
      }

      enum Direction {
        LTR = 0; // Left-to-right
        RTL = 1; // Right-to-left
      }

      Type type = 1; // The layout for displaying the voting options.
      Direction direction = 2; // The direction of the text displayed in the voting options. Text can be displayed either right-to-left or left-to-right.
      google.protobuf.BoolValue enable_image = 3; // Sets whether to display the main poll image. Defaults to `false`.
    }

    message OptionLayout {
      google.protobuf.BoolValue enable_image = 1; // Sets whether to display option images. Defaults to `false`.
    }

    PollLayout poll = 1; // Poll layout settings.
    OptionLayout options = 2; // Voting otpions layout settings.
  }

  message Design {
    message PollDesign {
      message Background {
        enum Type {
          COLOR = 0; // Color background type
          IMAGE = 1; // Image background type
          GRADIENT = 2; // Gradiant background type
        }

        message Gradient {
          google.protobuf.Int32Value angle = 1; // The gradient angle in degrees.
          google.protobuf.StringValue start_color = 2 [(wix.api.format) = COLOR_HEX]; // The start color as a hexademical value.
          google.protobuf.StringValue last_color = 3 [(wix.api.format) = COLOR_HEX]; // The end color as a hexademical value.
        }

        Type type = 1; // Background type. For each option, include the relevant details.
        oneof background {
          google.protobuf.StringValue color = 2 [(wix.api.format) = COLOR_HEX]; // The background color as a hexademical value.
          Media image = 3; // An image to use for the background.
          Gradient gradient = 4; // Details for a gradient background.
        }
      }
      Background background = 1; // Background styling.
      google.protobuf.Int32Value border_radius = 2; // Border radius in pixels.
    }

    message OptionDesign {
      google.protobuf.Int32Value border_radius = 1; // Border radius in pixels.
    }

    PollDesign poll = 1; // Styling for the poll.
    OptionDesign options = 2; // Styling for voting options.
  }

  PluginContainerData container_data = 1; // Styling for the poll's container.
  Poll poll = 2; // Poll data.
  Layout layout = 3; // Layout settings for the poll and voting options.
  Design design = 4; // Styling for the poll and voting options.
}
