package com.sensetime.demo.bean;

import android.graphics.Rect;

import com.sensetime.demo.SenseTimeMtc;

public enum FaceStatus{
    AI_STATUS_UNDEFINE(-1),
    AI_STATUS_UNKNOWN(0),
    AI_STATUS_NONLIVENESS(1),
    AI_STATUS_USER(2),
    AI_STATUS_STRANGER(3),
    AI_STATUS_ALREADY(4),
    AI_STATUS_VERIFY_PASS(5),
    AI_STATUS_VERIFY_FAILED(6);

    private int status;

    FaceStatus(int status) {
        this.status = status;
    }

    public int getStatus() {
        return status;
    }


    public static FaceStatus getByStatus(int status) {
        for (FaceStatus fs : values()) {
            if (fs.getStatus() == status) {
                return fs;
            }
        }
        return AI_STATUS_UNDEFINE;
    }

    public static Rect calcShowRect( Rect r) {
        SenseTimeMtc senseTimeMtc = SenseTimeMtc.getInstance();
        int aiCameraWidth;
        int aiCameraHeight;
        if (senseTimeMtc.getmDeviceModule() == SenseTimeMtc.M10 && (senseTimeMtc.getmM10_L_P() == SenseTimeMtc.LANDSCAPE_0 || senseTimeMtc.getmM10_L_P() == SenseTimeMtc.LANDSCAPE_180)) {
            aiCameraWidth = senseTimeMtc.getmAICameraWidth();
            aiCameraHeight = senseTimeMtc.getmAICameraHeight();
        } else {
            aiCameraWidth = senseTimeMtc.getmAICameraHeight();
            aiCameraHeight = senseTimeMtc.getmAICameraWidth();
        }
        //左右镜像
        int right = aiCameraWidth - (r.left -25) ;
        int left = aiCameraWidth - (r.right +25)  ;

        int top = r.top - 45;
        int bottom = r.bottom + 20;
        //上下镜像
//        top = aiCameraHeight - top;
//        bottom = aiCameraHeight - bottom;

        return new Rect(left, top, right, bottom);//NOTE mirror image
//            return new Rect(r.left - 25, r.top - 45, r.right + 25, r.bottom + 20);
    }
}