package com.engine.recruit.entity.card;

import com.engine.recruit.conn.ModeBrowserCommonInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author:dxfeng
 * @createTime: 2024/08/01
 * @version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ResumeCardInfo {
    private Integer id;
    private String image;
    private String lastName;
    private String applicantUrl;
    private String jobTitle;
    private String currentStage;
    private String sex;
    private String age;
    private String education;
    private String workYear;
    private String submissionTime;
    private String submissionFrom;
    private List<Tags> tags;
    private List<RecruitProcess> recruitProcess;
    private List<WorkInfo> workInfo;
    private List<EduInfo> eduInfo;

    public String getSex() {
        if (StringUtils.isNotBlank(sex)) {
            if ("0".equals(sex)) {
                return "男";
            } else {
                return "女";
            }
        }
        return sex;
    }

    public String getAge() {
        if (StringUtils.isNotBlank(age)) {
            return age + "岁";
        }
        return age;
    }

    public String getWorkYear() {
        if (StringUtils.isNotBlank(workYear)) {
            return "工作" + workYear;
        }
        return workYear;
    }

    public String getEducation() {
        return ModeBrowserCommonInfo.getEducationLevelById(education);
    }

    public String getCurrentStage() {
        String stageStr = "";
        if (StringUtils.isNotBlank(currentStage)) {
            switch (currentStage) {
                case "0":
                    stageStr = "初筛";
                    break;
                case "1":
                    stageStr = "笔试";
                    break;
                case "2":
                    stageStr = "面试";
                    break;
                case "3":
                    stageStr = "测评";
                    break;
                case "4":
                    stageStr = "薪酬谈判";
                    break;
                case "5":
                    stageStr = "背调";
                    break;
                case "6":
                    stageStr = "offer";
                    break;
                default:
                    break;
            }

        }
        return stageStr;
    }
}
