package com.winsea.svc.crew.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.winsea.svc.crew.constant.CrewSeafarerStatusEnum;
import com.yh.saas.common.support.entity.BaseModel;
import com.yh.saas.common.support.util.query.SearchField;
import com.yh.saas.common.support.util.query.SearchMode;
import com.yh.saas.common.support.util.query.SelectColunm;
import com.yh.saas.common.support.util.uniqueness.Unique;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 船员表
 * </p>
 *
 * @author XinGuang
 * @since 2019-06-27
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class CrewSeafarerInfo extends BaseModel<CrewSeafarerInfo> {

    private static final long serialVersionUID = 1L;

    /**
     * 船员ID
     */
    @SelectColunm
    @TableId(type = IdType.INPUT)
    private String seafarerId;

    /**
     * 公司ID
     */
    @NotBlank
    @SearchField(mode = SearchMode.EQ)
    @SelectColunm
    private String compId;
    /**
     * 船员姓名
     */
    @SearchField(mode = SearchMode.LIKE)
    @SelectColunm
    private String seafarerName;

    /**
     * 外派公司id
     */
    @SelectColunm
    private String ownedOutCompId;

    /**
     * 外派公司名称
     */
    @SelectColunm
    private String ownedOutCompName;

    /**
     * 船舶id（在船的时候有，不在船的时候为空）
     */
    @SelectColunm(typeValue = "B")
    private String vesselId;

    /**
     * 船舶名称（在船的时候有，不在船的时候为空）
     */
    @SelectColunm(typeValue = "B")
    private String vesselName;

    /**
     * 在船职务ID
     */
    @SelectColunm(typeValue = "B")
    private String onDutyId;

    /**
     * 在船职务
     */
    @SelectColunm(typeValue = "B")
    private String onDutyName;
    /**
     * 出生日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @SelectColunm(typeValue = "A")
    private Date birthday;
    /**
     * 入司时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @SelectColunm(typeValue = "A")
    private Date enterCompanyDate;
    /**
     * 证书职务ID
     */
    @SelectColunm(typeValue = "A")
    private String crtDutyId;
    /**
     * 证书职务名称
     */
    @SelectColunm(typeValue = "A")
    private String crtDutyName;
    /**
     * 家庭住址
     */
    @SelectColunm(typeValue = "A")
    private String homeAddress;
    /**
     * 手机号
     */
    @Unique(value = "SEAFARER_001", message = "手机号重复")
    @SelectColunm
    private String mobilePhone;
    /**
     * 备注Id
     */
    @SelectColunm(typeValue = "A")
    private String remarkId;
    /**
     * 备注
     */
    @SelectColunm(typeValue = "A")
    private String remark;
    /**
     * 船员状态key
     */
    @SelectColunm(typeValue = "A")
    private CrewSeafarerStatusEnum statusKey;
    /**
     * 状态
     */
    @SelectColunm(typeValue = "A")
    private String statusValue;


    /**
     * 在船船员状态(在船船员的预警状态)
     */
    @SelectColunm(typeValue = "B")
    private String onStatusValue;
    /**
     * 上船日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @SelectColunm(typeValue = "B")
    private Date onBoardDate;

    /**
     * 在船时间
     */
    private String onBoardTime;

    /**
     * 显示在船船员预警天数
     */
    @SelectColunm(typeValue = "B")
    private String alertDays;

    /**
     * 船员头像地址
     */
    private String seafarerHeadimgAddress;
    /**
     * 船员英文名称
     */
    @SelectColunm
    private String seafarerNameEn;
    /**
     * 船员号
     */
    @SelectColunm
    private Long seafarerNumber;
    /**
     * 申请职务ID
     */
    private String applyDutyId;
    /**
     * 申请职务姓名
     */
    private String applyDutyName;

    /**
     * 证书等级
     */
    @SelectColunm(typeValue = "A")
    private String crtLevelId;

    /**
     * 证书等级
     */
    @SelectColunm(typeValue = "A")
    private String crtLevelName;
    /**
     * 国籍Key
     */
    @SelectColunm(typeValue = "A")
    private String nationalityKey;
    /**
     * 国籍
     */
    @SelectColunm(typeValue = "A")
    private String nationalityValue;
    /**
     * 出生省key
     */
    private Integer brithplaceProvKey;
    /**
     * 出生省
     */
    private String brithplaceProvValue;
    /**
     * 出生城市key
     */
    private Integer brithplaceCityKey;
    /**
     * 出生城市
     */
    private String brithplaceCityValue;
    /**
     * 民族
     */
    private String nation;
    /**
     * 政治面貌key
     */
    private String politicalKey;
    /**
     * 政治面貌
     */
    private String politicalValue;
    /**
     * 籍贯省ID
     */
    @SelectColunm(typeValue = "A")
    private Integer placeOfOriginProvKey;
    /**
     * 籍贯省
     */
    @SelectColunm(typeValue = "A")
    private String placeOfOriginProvValue;
    /**
     * 籍贯城市
     */
    @SelectColunm(typeValue = "A")
    private Integer placeOfOriginCityKey;
    /**
     * 籍贯城市
     */
    @SelectColunm(typeValue = "A")
    private String placeOfOriginCityValue;
    /**
     * 身份证号
     */
    @Unique(value = "SEAFARER_002", message = "身份证号重复")
    @SelectColunm(typeValue = "B")
    private String seafarerIdNo;
    /**
     * 婚姻状况key
     */
    private String marriageStatusKey;
    /**
     * 婚姻状况
     */
    private String marriageStatusValue;
    /**
     * 健康状况
     */
    private String healthy;
    /**
     * 性别key
     */
    private String seafarerSexKey;
    /**
     * 性别
     */
    private String seafarerSexValue;
    /**
     * 腰围
     */
    private String waistline;
    /**
     * 身高
     */
    private String height;
    /**
     * 血型key
     */
    private String bloodKey;
    /**
     * 血型
     */
    private String bloodValue;
    /**
     * 体重
     */
    private String weight;
    /**
     * 工作服号
     */
    private String suitSize;
    /**
     * 鞋号
     */
    private String shoeSize;
    /**
     * 船员类型key
     */
    @SelectColunm(typeValue = "A")
    private String seafarerTypeKey;
    /**
     * 船员类型
     */
    @SelectColunm(typeValue = "A")
    private String seafarerTypeValue;
    /**
     * 用工形式ID
     */
    private String employmentId;
    /**
     * 用工形式名称
     */
    private String employmentName;
    /**
     * 航海经验key
     */
    @SelectColunm(typeValue = "A")
    private String maritimeExperienceKey;
    /**
     * 航海经验
     */
    @SelectColunm(typeValue = "A")
    private String maritimeExperienceValue;
    /**
     * 遣返地
     */
    private String repatriateCity;
    /**
     * 参加工作日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date beginWorkDate;
    /**
     * 其他电话
     */
    private String otherTel;
    /**
     * 邮箱
     */
    private String email;
    /**
     * qq或微信
     */
    private String qqWechat;
    /**
     * 邮政编号
     */
    private String postCode;
    /**
     * 通讯地址
     */
    private String currentAddress;
    /**
     * 英文地址
     */
    @SelectColunm(typeValue = "A")
    private String homeAddressEn;
    /**
     * 户口地址
     */
    private String censusRegister;
    /**
     * 联络备注
     */
    private String liaisonRemark;
    /**
     * 毕业学校
     */
    private String school;
    /**
     * 学校所在地
     */
    private String schoolPlace;
    /**
     * 学校性质key
     */
    private String schoolNatureKey;
    /**
     * 学校性质
     */
    private String schoolNatureValue;
    /**
     * 学历key
     */
    private String educationKey;
    /**
     * 学历
     */
    private String educationValue;
    /**
     * 学历证号
     */
    private String educationCertNo;
    /**
     * 入学日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date enrollmentDate;
    /**
     * 结业日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date graduationDate;
    /**
     * 专业
     */
    private String major;
    /**
     * 职称
     */
    private String jobTitle;
    /**
     * 第二学历标识
     */
    private String secondEducationKey;
    /**
     * 第二学历
     */
    private String secondEducationValue;
    /**
     * 第二学历证号
     */
    private String secondEducationCertNo;
    /**
     * 英语等级
     */
    private String englishLevel;
    /**
     * 船型ID
     */
    private String vesselKey;
    /**
     * 船型
     */
    private String vesselValue;
    /**
     * 月薪要求
     */
    private String salary;
    /**
     * 币种key
     */
    private String currencyKey;
    /**
     * 币种名称
     */
    private String currencyValue;
    /**
     * 要求载重吨key
     */
    private String tonKey;
    /**
     * 要求载重吨
     */
    private String tonValue;
    /**
     * 航区key
     */
    private String navigatingAreaKey;
    /**
     * 航区
     */
    private String navigatingAreaValue;
    /**
     * 计划上船时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date planDate;
    /**
     * 上船要求_备注
     */
    private String otherRemark;

    /**
     * 社保号
     */
    private String socialSecurityNo;

    /**
     * 是否ISM培训
     */
    private String ismTraining;

    /**
     * 签名地址
     */
    private String autographUrl;

    /**
     * 当前船舶ID
     */
    private String currentVesselId;

    /**
     * 当前船舶名称
     */
    private String currentVesselName;

    /**
     * 最近服务资历id
     */
    private String serviceId;

    /**
     * 船员年龄
     */
    @TableField(exist = false)
    private String seafarerAge;

    /**
     * 任职时间
     */
    @TableField(exist = false)
    private String servingTime;

    /**
     * 显示参加工作时间
     */
    @TableField(exist = false)
    private String beginWorkTime;
    /**
     * 显示的船员标号
     */
    @TableField(exist = false)
    private String seafarerNo;

    /**
     * 开始出生时间
     */
    @TableField(exist = false)
    @SearchField(value = "birthday", mode = SearchMode.GE)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginBirthday;

    /**
     * 结束出生时间
     */
    @SearchField(value = "birthday", mode = SearchMode.LE)
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endBirthday;

    /**
     * 计划开始上船时间
     */
    @TableField(exist = false)
    @SearchField(value = "on_board_date", mode = SearchMode.GE)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginOnday;

    /**
     * 计划结束上船时间
     */

    @SearchField(value = "on_board_date", mode = SearchMode.LE)
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endOnday;

    /**
     * 开始上船时间
     */
    @TableField(exist = false)
    @SearchField(value = "on_board_date", mode = SearchMode.GE)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginOnBoardDate;

    /**
     * 结束上船时间
     */

    @SearchField(value = "on_board_date", mode = SearchMode.LE)
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endOnBoardDate;

    /**
     * 证书种类
     */
    @TableField(exist = false)
    @SearchField(value = "crt_duty_id", mode = SearchMode.IN)
    private String cdis;

    /**
     * 船舶ID集合
     */
    @TableField(exist = false)
    @SearchField(value = "vessel_id", mode = SearchMode.IN)
    private String vesselIds;

    /**
     * 外派公司种类
     */
    @TableField(exist = false)
    @SearchField(value = "owned_out_comp_id", mode = SearchMode.IN)
    private String outCompIds;

    /**
     * 船员状态key
     */
    @TableField(exist = false)
    @SearchField(value = "status_key", mode = SearchMode.IN)
    private String seafarerStatus;

    /**
     * 下船原因种类
     */
    @TableField(exist = false)
    private String downBoardReasonKeys;


    /**
     * 合同下船日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @SelectColunm(typeValue = "B")
    private Date downBoardDate;


    /**
     * 在船状态（多条用,分隔）
     */
    @TableField(exist = false)
    @SearchField(value = "on_status_key", mode = SearchMode.IN)
    private String onStatusKeys;

    /**
     * 多条证书状态
     */
    @TableField(exist = false)
    private String crtStatuses;

    /**
     * 动态表单数据
     */
    @TableField(exist = false)
    private String dynamicData;

    /**
     * 在船职务
     */
    @TableField(exist = false)
    @SearchField(value = "on_duty_id", mode = SearchMode.IN)
    private String onDutyIds;

    /**
     * 开始下船时间
     */
    @TableField(exist = false)
    @SearchField(value = "down_board_date", mode = SearchMode.GE)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDownday;

    /**
     * 结束下船时间
     */

    @SearchField(value = "down_board_date", mode = SearchMode.LE)
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDownday;

    /**
     * 航区keys（查询）
     */
    @TableField(exist = false)
    private String navigatingAreaKeys;

    /**
     * 电子签名地址
     */
    private String eSignatureAddress;

    /**
     * 船员状态s
     */
    @TableField(exist = false)
    private String statusKeys;

    @Override
    protected Serializable pkVal() {
        return this.seafarerId;
    }

    /**
     * 查询用字段
     */
    public static class QueryFields {

        public static final String SEAFARER_ID = "seafarer_id";

        public static final String SEAFARER_NAME = "seafarer_name";

        public static final String GETPY_SEAFARER_NAME = "getPY(seafarer_name)";

        public static final String SEAFARER_NAME_EN = "seafarer_name_en";

        public static final String STATUS_KEY = "status_key";

        public static final String BIRTHDAY = "birthday";

        public static final String COMP_ID = "comp_id";

        public static final String ENTER_COMPANY_DATE = "enter_company_date";

        public static final String OWNED_OUT_COMP_ID = "owned_out_comp_id";

        public static final String VESSEL_ID = "vessel_id";

        public static final String MOBILE_PHONE = "mobile_phone";

        public static final String ON_DUTY_ID = "on_duty_id";

        public static final String CREATE_DATE = "create_date";

        public static final String DOWN_BOARD_DATE = "down_board_date";

        public static final String ON_BOARD_DATE = "on_board_date";

        public static final String SEAFARER_ID_NO = "seafarer_id_no";

        public static final String SEAFARER_NUMBER = "seafarer_number";

        public static final String SEAFARER_TYPE_KEY = "seafarer_type_key";

        public static final String APPLY_DUTY_ID = "apply_duty_id";

        public static final String CRT_DUTY_ID = "crt_duty_id";

        private QueryFields() {
        }
    }

}
