package com.cyksj.model.dto;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

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

/**
 * 项目名: yhlxj2
 * 文件名: YhServiceChangeDto
 * 创建者: JavaZou
 * 创建时间:2024/1/8 17:52
 */
@Getter
@Setter
public class YhServiceChangeDto {
	private List<String> beforeSelect;

	private List<String> afterSelect;

	private String sign;

	private Integer index;

	private String date;

	private String workType;

	public String toChangeString() {
		StringBuilder sb = new StringBuilder();
		if (StrUtil.equals(sign, "workday")) {
			sb.append("工作日").append(index == 1 ? "早班" : "晚班");
		} else if (StrUtil.equals(sign, "Saturday")) {
			sb.append("周六").append(index == 3 ? "早班" : "晚班");
		} else if (StrUtil.equals(sign, "Sunday")) {
			sb.append("周日").append(index == 5 ? "早班" : "晚班");
		} else {
			sb.append("节假日").append(date).append(workType);
		}
		if (beforeSelect.size() > 0) {
			sb.append(" - 移除 - ");
			String beforeCollect = beforeSelect.stream().collect(Collectors.joining("、"));
			sb.append(beforeCollect);
		}

		if (afterSelect.size() > 0) {
			sb.append(" - 增加 - ");
			String afterCollect = afterSelect.stream().collect(Collectors.joining("、"));
			sb.append(afterCollect);
		}
		return sb.toString();
	}
}
