package com.charlesdream.office.shared.enums;

import com.charlesdream.office.BaseEnum;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * Specifies an extrusion (three-dimensional) format.The msoPresetThreeDFormat constants are numbered according to the order (left to right, top to bottom) in which they are shown in the 3-D Style button on the Formatting toolbar.
 * <p>
 *
 * @author Charles Cui on 5/5/2016.
 * @since 1.0
 */
public enum MsoPresetThreeDFormat implements BaseEnum {

    /**
     * Not used.
     *
     * @since 1.0
     */
    msoPresetThreeDFormatMixed(-2),

    /**
     * First 3-D format.
     *
     * @since 1.0
     */
    msoThreeD1(1),

    /**
     * Tenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD10(10),

    /**
     * Eleventh 3-D format.
     *
     * @since 1.0
     */
    msoThreeD11(11),

    /**
     * Twelfth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD12(12),

    /**
     * Thirteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD13(13),

    /**
     * Fourteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD14(14),

    /**
     * Fifteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD15(15),

    /**
     * Sixteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD16(16),

    /**
     * Seventeenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD17(17),

    /**
     * Eighteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD18(18),

    /**
     * Nineteenth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD19(19),

    /**
     * Second 3-D format.
     *
     * @since 1.0
     */
    msoThreeD2(2),

    /**
     * Twentieth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD20(20),

    /**
     * Third 3-D format.
     *
     * @since 1.0
     */
    msoThreeD3(3),

    /**
     * Fourth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD4(4),

    /**
     * Fifth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD5(5),

    /**
     * Sixth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD6(6),

    /**
     * Seventh 3-D format.
     *
     * @since 1.0
     */
    msoThreeD7(7),

    /**
     * Eighth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD8(8),

    /**
     * Ninth 3-D format.
     *
     * @since 1.0
     */
    msoThreeD9(9);


    private static final Map<Integer, MsoPresetThreeDFormat> lookup;

    static {
        lookup = new HashMap<>();

        for (MsoPresetThreeDFormat e : EnumSet.allOf(MsoPresetThreeDFormat.class)) {
            lookup.put(e.value(), e);
        }
    }


    private final int value;

    MsoPresetThreeDFormat(int value) {
        this.value = value;
    }


    /**
     * Find the enum type by its value.
     *
     * @param value The enum value.
     * @return The enum type, or null if this enum value does not exists.
     * @since 1.0
     */
    public static MsoPresetThreeDFormat find(int value) {
        MsoPresetThreeDFormat result = lookup.get(value);

        return result;
    }

    /**
     * Find the enum type by its value, with the default value.
     *
     * @param value        The enum value.
     * @param defaultValue The default return value if the enum value does not exists.
     * @return The enum type, or the default value if this enum value does not exists.
     * @since 1.0
     */
    public static MsoPresetThreeDFormat find(int value, MsoPresetThreeDFormat defaultValue) {
        MsoPresetThreeDFormat result = MsoPresetThreeDFormat.find(value);

        if (result == null) {
            result = defaultValue;
        }

        return result;
    }

    /**
     * Get the value of a enum type.
     *
     * @return The value of a enum type.
     * @since 1.0
     */
    public int value() {
        return this.value;
    }
}
