package com.xinelu.common.enums;

import java.util.Arrays;

/**
 * @author gaoyu
 * @description: 文件上传类型
 * @date 2022-11-30 10:46
 */
public enum UploadType {
    AVATAR("1001", "用户头像", "JPG,PNG,JPEG,BMP", "file/user/avatar/"),

    USER_CERT("1002", "用户证书", "JPG,PNG,JPEG,BMP", "file/user/cert/"),

    INSTITUTION_SIGNATURE("1003", "机构签章", "JPG,PNG,JPEG,BMP", "file/institution/signature/"),

    F_RESIDENT_SIGNATURE("1007", "医生随访签字","JPG,PNG,JPEG,BMP", "file/resident/followup/signature/"),

    F_RESIDENT_HEADIMG("1004", "居民随访头像（佐证）","JPG,PNG,JPEG,BMP", "file/resident/followup/signature/"),

    F_RESIDENT_FINGER("1008", "居民指纹","JPG,PNG,JPEG,BMP", "file/resident/followup/finger/"),

    A_RESIDENT_SIGNATURE("1005", "档案居民签名","JPG,PNG,JPEG,BMP", "file/resident/archive/signature/"),

    A_RESIDENT_HEADIMG("1006", "档案居民头像","JPG,PNG,JPEG,BMP", "file/resident/archive/headimg/"),

	A_RESIDENT_FAMILY_SIGNATURE("1007", "档案居民家属签名","JPG,PNG,JPEG,BMP", "file/resident/archive/family/signature/"),

	LEFT_EYE_RESULT("2001", "眼底镜筛查结果-左眼", "JPG,PNG,JPEG", "file/screening/lefteye/"),

    RIGHT_EYE_RESULT("2002", "眼底镜筛查结果-右眼", "JPG,PNG,JPEG", "file/screening/righteye/"),

    PLATELET_RESULT("2003", "血小板筛查结果", "JPG,PNG,JPEG,PDF", "file/screening/platelet/"),

    DOPPLER_RESULT("2004", "多普勒筛查结果", "JPG,PNG,JPEG", "file/screening/doppler/"),

    SCREENING_BARCODE("2005", "筛查预约条形码", "JPG,PNG,JPEG", "file/screening/barcode/"),

    REGISTRATION_BARCODE("2006", "登记条形码", "JPG,PNG,JPEG", "file/registration/barcode/"),

    ALZHEIMER_DISEASE_BARCODE("2007", "阿尔兹海默症结果", "DOC,DOCX", "file/alzheimer/disease/"),

	/**
	 * APP安装包保存路径
	 */
	APP_UPLOAD_PATH("5001", "APP安装包", "APK", "file/apk/"),

	/**
	 * APP安装包二维码保存路径
	 */
	APP_QRCODE_PATH("5002", "APP安装包二维码", "JPG,PNG", "file/img/qrcode/app/"),

    EMPTY("", "", "", "");

    private final String code;
    private final String label;
    private final String suffix;
    private final String path;

    UploadType(String code, String label, String suffix, String path) {
        this.code = code;
        this.label = label;
        this.suffix = suffix;
        this.path = path;
    }

    public String getCode() {
        return code;
    }

    public String getLabel() {
        return label;
    }

    public String getSuffix() {
        return suffix;
    }

    public String getPath() {
        return path;
    }

    public static UploadType getUploadType(final String code) {
        return Arrays.stream(UploadType.values()).filter(ut -> ut.code.equals(code)).findFirst().orElse(EMPTY);
    }
}
