package com.sckw.fleet.model.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sckw.core.utils.FileUtils;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author zk
 * @desc 司机身份证信息
 * @date 2023/7/7 0007
 */
@Data
public class KwfDriverCardDto {

    /**
     * 主键
     */
    private Long id;

    /**
     * 司机主键
     */
    private Long driverId;

    /**
     * 身份证号
     */
    @Pattern(regexp = "[0-9A-Za-z]{18}", message = "身份证号码格式不正确！")
    private String idcard;

    /**
     * 有效日期
     */
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date expireTime;

    /**
     * 联系地址
     */
    @Size(max=100, message = "联系地址长度不能大于100个字符！")
    private String address;

    /**
     * 证书正面URL地址
     */
    @Size(max=200, message = "证书正面URL地址长度不能大于200个字符！")
    private String certificateMain;

    /**
     * 证书反面URL地址
     */
    @Size(max=200, message = "证书反面URL地址长度不能大于200个字符！")
    private String certificateRevolt;

    public void setCertificateMain(String certificateMain) {
        this.certificateMain = FileUtils.replaceAll(certificateMain);
    }

    public void setCertificateRevolt(String certificateRevolt) {
        this.certificateRevolt = FileUtils.replaceAll(certificateRevolt);
    }
}
