package com.inspect.patrol.domain;

import com.inspect.base.core.utils.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class LinkagePatrolTask {
    private String areaId;
    private String stationName;
    private String stationCode;
    private String taskName;
    private List<LinkageTaskInfo> prevPoints;
    private String areaName;
    private String priority = "4";
    private String type = "5";
    private String deviceLevel = "4";
    private String executionStatus = "";
    private String linkageState = "1";
    private String taskIsPoint = "0";
    private String deviceList;

    public String getDeviceList() {
        return StringUtils.isEmpty(this.deviceList) ? (String) this.prevPoints.stream().map((item) -> {
            return item.getDeviceCode();
        }).distinct().collect(Collectors.joining(",")) : this.deviceList;
    }

    public void setDeviceList(String deviceList) {
        this.deviceList = deviceList;
    }

    public String getLinkageState() {
        return this.linkageState;
    }

    public void setLinkageState(String linkageState) {
        this.linkageState = linkageState;
    }

    public String getTaskIsPoint() {
        return this.taskIsPoint;
    }

    public void setTaskIsPoint(String taskIsPoint) {
        this.taskIsPoint = taskIsPoint;
    }

    public String getStationName() {
        return this.stationName;
    }

    public void setStationName(String stationName) {
        this.areaName = this.stationName = stationName;
    }

    public String getStationCode() {
        return this.stationCode;
    }

    public void setStationCode(String stationCode) {
        this.areaId = this.stationCode = stationCode;
    }

    public String getPriority() {
        return this.priority;
    }

    public void setPriority(String priority) {
        this.priority = priority;
    }

    public String getDeviceLevel() {
        return this.deviceLevel;
    }

    public void setDeviceLevel(String deviceLevel) {
        this.deviceLevel = deviceLevel;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void addPrevPoint(LinkageTaskInfo linkageTaskInfo) {
        if (this.prevPoints == null) {
            this.prevPoints = new ArrayList();
        }

        this.prevPoints.add(linkageTaskInfo);
    }

    public String getAreaId() {
        return this.areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getAreaName() {
        return this.areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getExecutionStatus() {
        return this.executionStatus;
    }

    public void setExecutionStatus(String executionStatus) {
        this.executionStatus = executionStatus;
    }

    public String getTaskName() {
        return this.taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public List<LinkageTaskInfo> getPrevPoints() {
        return this.prevPoints;
    }

    public void setPrevPoints(List<LinkageTaskInfo> prevPoints) {
        this.prevPoints = prevPoints;
    }
}
