package com.fdkankan.ucenter.common;

import java.util.*;

public enum SceneEnum {
    KK("kk", Arrays.asList(1,2,12,13,14),1),
    kJ("kJ", Arrays.asList(3),1),
    SS("SS", Arrays.asList(4),0),
    SS_OBJ("SS_OBJ", Arrays.asList(4),1),
    SG("SG", Arrays.asList(5),0),
    SG_OBJ("SG_OBJ", Arrays.asList(5),1),
    e57("e57", Arrays.asList(57),0),
    e57_OBJ("e57_OBJ", Arrays.asList(57),1),
    sx("sx", Arrays.asList(7),0),

    ;

    private String name;
    private List<Integer> sceneSource;

    private Integer isObj;



    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Integer> getSceneSource() {
        return sceneSource;
    }

    public void setSceneSource(List<Integer> sceneSource) {
        this.sceneSource = sceneSource;
    }

    public Integer getObj() {
        return isObj;
    }

    public void setObj(Integer obj) {
        isObj = obj;
    }

    SceneEnum(String name, List<Integer> sceneSource,Integer isObj) {
        this.name = name;
        this.sceneSource = sceneSource;
        this.isObj = isObj;
    }

    public static List<String> getKeys(){
        List<String> keys = new ArrayList<>();
        SceneEnum[] values = SceneEnum.values();
        for (SceneEnum value : values) {
            keys.add( value.getName());
        }
        return keys;
    }

    public static SceneEnum getBySceneSource(Integer sceneSource,Integer isObj){
        SceneEnum[] values = SceneEnum.values();
        for (SceneEnum value : values) {

            if(SceneSourceUtil.isLaser(sceneSource)){
                if(value.getSceneSource().contains(sceneSource) && value.getObj().equals(isObj)){
                    return value;
                }
            }else {
                if(value.getSceneSource().contains(sceneSource)){
                    return value;
                }
            }

        }
        return null;
    }

    public static SceneEnum getBySceneSource(Integer sceneSource){
        SceneEnum[] values = SceneEnum.values();
        for (SceneEnum value : values) {
            if(value.getSceneSource().contains(sceneSource)){
                return value;
            }
        }
        return null;
    }
    public static SceneEnum getKey(String key) {
        SceneEnum[] values = SceneEnum.values();
        for (SceneEnum value : values) {
            if(value.getName().equals(key) ){
                return value;
            }
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(getKeys());
    }
}
