/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { BciPicklistResponsibility } from './picklist.types';

/** Defines a picklist item. */
export interface PicklistItem {
  /** Label of the item. */
  label: string;

  /** Value assigned to this element. */
  value: any;

  /** Whether the item is selected. */
  selected: boolean;

  /** Whether the item is actively dragged. */
  dragging: boolean;
}

/** Selection status of all elements in the picklist. */
export interface SelectionState {
  /** Whether some source items are selected. */
  sourceItemsSelected: boolean;

  /** Whether some target items are selected. */
  targetItemsSelected: boolean;
}

/** Possible drag states of a {@link DragInstance drag instance}. */
export enum DragState {
  Idle,
  Dragging,
}

/** Describes a drag/drop operation. */
export interface DragInstance {
  state: DragState;
  source: BciPicklistResponsibility | 'none';
  draggedItems: PicklistItem[];
}
