package com.cyksj.model.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ejlchina.searcher.bean.DbIgnore;
import lombok.Getter;
import lombok.Setter;

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

/**
 * 项目名: yhlxj
 * 文件名: CorpKfChangeFollowLogDto
 * 创建者: JavaZou
 * 创建时间:2025/1/15 16:37
 */
@Getter
@Setter
public class CorpKfChangeFollowLogDto {
	/**
	 * 值班星期
	 * 1星期天 2星期一 ....
	 */
	private Integer dutyWeek;

	@DbIgnore
	@TableField(exist = false)
	private List<String> beforeSelect;

	@DbIgnore
	@TableField(exist = false)
	private List<String> afterSelect;


	public String toChangeString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getDutyWeekName(this.dutyWeek));
		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();
	}

	public String getDutyWeekName(Integer week) {
		switch (week) {
			case 1:
				return "周日";
			case 2:
				return "周一";
			case 3:
				return "周二";
			case 4:
				return "周三";
			case 5:
				return "周四";
			case 6:
				return "周五";
			case 7:
				return "周六";
			default:
				return null;
		}
	}
}
