import { flagOptions, stateOptions } from '@/constants'

/**
 * @description: 组件事件选项
 */
export const widgetEventOptions = [
  { label: 'Clicked', value: 'LV_EVENT_SINGLE_CLICKED' },
  { label: 'Short Clicked', value: 'LV_EVENT_SHORT_CLICKED' },
  { label: 'Key', value: 'LV_EVENT_KEY' },
  { label: 'Pressed', value: 'LV_EVENT_PRESSED' },
  { label: 'Pressing', value: 'LV_EVENT_PRESSING' },
  { label: 'Press Lost', value: 'LV_EVENT_PRESS_LOST' },
  { label: 'Long Pressed', value: 'LV_EVENT_LONG_PRESSED' },
  { label: 'Long Pressed Repeat', value: 'LV_EVENT_LONG_PRESSED_REPEAT' },
  { label: 'Released', value: 'LV_EVENT_RELEASED' },
  { label: 'Value Changed', value: 'LV_EVENT_VALUE_CHANGED' },
  { label: 'Scroll', value: 'LV_EVENT_SCROLL' },
  { label: 'Scroll Begin', value: 'LV_EVENT_SCROLL_BEGIN' },
  { label: 'Scroll End', value: 'LV_EVENT_SCROLL_END' },
  { label: 'Focused', value: 'LV_EVENT_FOCUSED' },
  { label: 'Defocused', value: 'LV_EVENT_DEFOCUSED' },
  { label: 'Leave', value: 'LV_EVENT_LEAVE' },
  { label: 'Hit Test', value: 'LV_EVENT_HIT_TEST' }
]

/**
 * 页面事件选项
 */
export const pageEventOptions = [
  { label: 'Clicked', value: 'LV_EVENT_SINGLE_CLICKED' },
  { label: 'Short Clicked', value: 'LV_EVENT_SHORT_CLICKED' },
  { label: 'Key', value: 'LV_EVENT_KEY' },
  { label: 'Pressed', value: 'LV_EVENT_PRESSED' },
  { label: 'Pressing', value: 'LV_EVENT_PRESSING' },
  { label: 'Press Lost', value: 'LV_EVENT_PRESS_LOST' },
  { label: 'Long Pressed', value: 'LV_EVENT_LONG_PRESSED' },
  { label: 'Long Pressed Repeat', value: 'LV_EVENT_LONG_PRESSED_REPEAT' },
  { label: 'Released', value: 'LV_EVENT_RELEASED' },
  { label: 'Value Changed', value: 'LV_EVENT_VALUE_CHANGED' },
  { label: 'Scroll', value: 'LV_EVENT_SCROLL' },
  { label: 'Scroll Begin', value: 'LV_EVENT_SCROLL_BEGIN' },
  { label: 'Scroll End', value: 'LV_EVENT_SCROLL_END' },
  { label: 'Focused', value: 'LV_EVENT_FOCUSED' },
  { label: 'Defocused', value: 'LV_EVENT_DEFOCUSED' },
  { label: 'Leave', value: 'LV_EVENT_LEAVE' },
  { label: 'Hit Test', value: 'LV_EVENT_HIT_TEST' },
  { label: 'Unload Start', value: 'LV_EVENT_SCREEN_UNLOAD_START' },
  { label: 'Load Start', value: 'LV_EVENT_SCREEN_LOAD_START' },
  { label: 'Loaded', value: 'LV_EVENT_SCREEN_LOADED' },
  { label: 'Unloaded', value: 'LV_EVENT_SCREEN_UNLOADED' },
  { label: 'Created', value: 'LV_EVENT_CHILD_CREATED' }
]

/**
 * @description: 动作选项
 */
export const actionOptions = [
  { label: 'X', value: 'x', valueType: 'number', defaultValue: 0 },
  { label: 'Y', value: 'y', valueType: 'number', defaultValue: 0 },
  { label: 'Width', value: 'width', valueType: 'number', defaultValue: 100 },
  { label: 'Height', value: 'height', valueType: 'number', defaultValue: 100 },
  { label: 'Text', value: 'text', valueType: 'string', defaultValue: 'default' },
  { label: 'Font Size', value: 'font_size', valueType: 'number', defaultValue: 12 },
  {
    label: 'Add Flag',
    value: 'add_flag',
    valueType: 'select',
    multiple: true
  },
  {
    label: 'Remove Flag',
    value: 'remove_flag',
    valueType: 'select',
    multiple: true
  },
  { label: 'Background Color', value: 'bg_color', valueType: 'color' },
  { label: 'Background Alpha', value: 'bg_alpha', valueType: 'number', min: 0, max: 255 },
  { label: 'Gradient Color', value: 'bg_grad_color', valueType: 'color' },
  {
    label: 'Gradient Direction',
    value: 'grad_dir',
    valueType: 'select'
  },
  { label: 'Background Image Alpha', value: 'bg_img_alpha', valueType: 'number', min: 0, max: 255 },
  { label: 'Background Image Render Color', value: 'bg_img_render_color', valueType: 'color' },
  { label: 'Image Alpha', value: 'img_alpha', valueType: 'number', min: 0, max: 255 },
  { label: 'Image Render Color', value: 'img_render_color', valueType: 'color' },
  { label: 'Image Render Alpha', value: 'img_render_alpha', valueType: 'number', min: 0, max: 255 },
  { label: 'Alpha', value: 'alpha', valueType: 'number', min: 0, max: 255 },
  {
    label: 'Border',
    value: 'border_type',
    valueType: 'select'
  },
  { label: 'Border Size', value: 'border_width', valueType: 'number', defaultValue: 1 },
  { label: 'Border Alpha', value: 'border_alpha', valueType: 'number', min: 0, max: 255 },
  { label: 'Border Color', value: 'border_color', valueType: 'color' },
  { label: 'Light', value: 'led_set_light', valueType: 'number', min: 0, max: 255 },
  { label: 'Color', value: 'led_color', valueType: 'color' },
  { label: 'Radius', value: 'radius', valueType: 'number' },
  { label: 'Visible', value: 'visible', valueType: 'boolean' },
  { label: 'Add State', value: 'add_state', valueType: 'select' },
  { label: 'Remove State', value: 'remove_state', valueType: 'select' },
  {
    label: 'Rotate',
    value: 'rotate',
    valueType: 'rotate',
    defaultValue: {
      x: 0,
      y: 0,
      angle: 0
    }
  },
  { label: 'Zoom', value: 'zoom', valueType: 'number' },
  { label: 'Widget Value', value: 'widget_value', valueType: 'string' },
  {
    label: 'Play Animation',
    value: 'play_animation',
    valueType: 'animation',
    defaultValue: {
      animation: undefined,
      before: undefined,
      after: undefined
    }
  }
]

/**
 * @description: 选项map
 */
export const optionMap = {
  add_flag: flagOptions,
  remove_flag: flagOptions,
  add_state: stateOptions,
  remove_state: stateOptions,
  grid_dir: [
    { label: 'None', value: 'none' },
    { label: 'Vertical', value: 'vertical' },
    { label: 'Horizontal', value: 'horizontal' }
  ],
  border_type: [
    { label: 'None', value: 'none' },
    { label: 'All', value: 'all' },
    { label: 'Top', value: 'top' },
    { label: 'Bottom', value: 'bottom' },
    { label: 'Left', value: 'left' },
    { label: 'Right', value: 'right' }
  ]
}
