package com.prolog.eis.dto.eis4;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class StationOBAreaDto {
    @ApiModelProperty("区域编号")
    private String areaNo;

    @ApiModelProperty("区域的锚点X坐标")
    private int x;

    @ApiModelProperty("区域的锚点Y坐标")
    private int y;

    @ApiModelProperty("区域优先级(越小越优先)")
    private int priority;

    @ApiModelProperty("源托盘优先范围（该值为NULL时，该区域不启用范围优先策略）")
    private StationOBRangeDto range;

    @ApiModelProperty("有任务源区域集合(优先级)")
    private List<String> taskSourceAreaNoList = new ArrayList<>();

    @ApiModelProperty("到位托盘集合")
    private List<StationOBAreaContainerDto> containerList = new ArrayList<>();

    @ApiModelProperty("已使用货位数")
    private int useLocatorCount;

    @ApiModelProperty("空闲货位数")
    private int freeLocatorCount;

    @ApiModelProperty("是否将无任务托盘调离")
    private boolean isSendNoTaskContainer;

    @ApiModelProperty("【设置】是否启用无其他任务经过该区域时原地等待目的区域有空闲位")
    private boolean canWait = false;

    @ApiModelProperty("【设置】进入该站台的缓存区，按集合的先后顺序优先")
    private List<String> cacheAreaNoList = new ArrayList<>();

    //*****以下为init计算得到*****
    @ApiModelProperty("有任务源区域集合(优先级)")
    private List<StationOBAreaDto> taskSourceAreaList = new ArrayList<>();

    @ApiModelProperty("到位任务托盘集合")
    private List<StationOBContainerDto> taskContainerList = new ArrayList<>();

    @ApiModelProperty("到位无任务托盘号集合")
    private List<StationOBAreaContainerDto> noTaskContainerNoList = new ArrayList<>();

    public void increaseUseLocatorCount() {
        this.useLocatorCount++;
        this.freeLocatorCount--;
    }

    @Override
    public String toString() {
        return this.areaNo;
    }
}
