package com.datarecovery.master.utils;

import com.atmob.common.data.KVUtils;
import com.datarecovery.master.module.member.MemberType;

import java.util.Objects;

public class ReportUtil {

    public static String getReportId(@MemberType String memberType) {
        if (Objects.equals(memberType, MemberType.APP_WX_MESSAGE_RECOVER)) {
            return "hf11011";
        } else if (Objects.equals(memberType, MemberType.APP_WX_FRIEND_RECOVER)) {
            return "hf11009";
        } else if (Objects.equals(memberType, MemberType.APP_IMAGE_RECOVER)) {
            return "hf11001";
        } else if (Objects.equals(memberType, MemberType.APP_FILE_RECOVER)) {
            return "hf11003";
        } else if (Objects.equals(memberType, MemberType.APP_VIDEO_RECOVER)) {
            return "hf11005";
        } else if (Objects.equals(memberType, MemberType.APP_AUDIO_RECOVER)) {
            return "hf11007";
        } else if (Objects.equals(memberType, MemberType.APP_IMAGE_CLEAN)) {
            return "hf11013";
        } else if (Objects.equals(memberType, MemberType.APP_SUPER_RECOVER)) {
            return "hf11035";
        }
        return null;
    }


    /**
     * 记录单次事件是否已经触发过
     *
     * @param eventId
     * @return
     */
    public static boolean isRecordOneEvent(String eventId) {
        boolean eventBoolean = KVUtils.getDefault().getBoolean(eventId, false);
        if (!eventBoolean) {
            KVUtils.getDefault().putBoolean(eventId, true);
        }
        return eventBoolean;
    }
}
