import { IItem,IListItem } from '@farmmaps/common';
import {Layer} from 'ol/layer';
import { Source } from 'ol/source';

export interface IItemLayer  {
  item: IItem,
  layer: Layer<Source>,
  visible: boolean,
  legendVisible:boolean,
  projection: string,
  opacity: number,
  layerIndex:number
}

export class ItemLayer implements IItemLayer {
  public item: IItem;
  public layer: Layer<Source> = null;
  public visible = true;
  public legendVisible = false;
  public projection: string;
  public opacity = 1;
  public layerIndex = -1;

  constructor(item:IItem,opacity = 1, visible = true,layerIndex=-1) {
    this.item = item;
    this.opacity = opacity;
    this.visible = visible;
    this.layerIndex = layerIndex;
  }
}

export interface ITemporalItemLayer extends IItemLayer {
  previousItemLayer: IItemLayer,
  selectedItemLayer: IItemLayer,
  nextItemLayer: IItemLayer,
  temporalItems: IItem[],
}

export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer {
  public previousItemLayer:IItemLayer = null;
  public selectedItemLayer:IItemLayer =null;
  public nextItemLayer:IItemLayer = null;
  public temporalItems:IItem[] = [];

  constructor(item:IItem,opacity = 1, visible = true) {
   super(item,opacity,visible)
  }
}



