package com.yonge.cooleshow.biz.dal.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yonge.cooleshow.biz.dal.entity.Employee;
import com.yonge.cooleshow.biz.dal.enums.GenderEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * @Author: liweifan
 * @Data: 2022-04-06 16:18:03
 */
@ApiModel(value = "EmployeeDto对象", description = "员工表数据传输对象")
public class EmployeeDto extends Employee{
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "用户姓名不能为空")
    @ApiModelProperty("昵称")
    private String username;
    @NotNull(message = "性别不能为空")
    @ApiModelProperty(value = "性别 0女 1男")
    private GenderEnum gender;
    @NotBlank(message = "手机号不能为空")
    @ApiModelProperty(value = "手机号")
    private String phone;
    @NotNull(message = "入职时间不能为空")
    @ApiModelProperty("入职时间 ")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date entryDate;
    @NotNull(message = "角色不能为空")
    @ApiModelProperty(value = "角色id列表")
    private List<Long> roleIds;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(Object gender) {
        if(gender instanceof GenderEnum ){
            this.gender = (GenderEnum) gender;
        }else if (null != gender) {
            this.gender = GenderEnum.valueOf(Integer.parseInt(gender.toString()));
        }
    }

    

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public List<Long> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(List<Long> roleIds) {
        this.roleIds = roleIds;
    }

    @Override
    public Date getEntryDate() {
        return entryDate;
    }

    @Override
    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }

}