package dev.fyloz.trial.colorrecipesexplorer.web.response;

public enum ResponseCode {
    SUCCESS_USING_MATERIALS(1, ResponseCodeType.SUCCESS, 0),
    SUCCESS_SAVING_RECIPE_INFORMATIONS(2, ResponseCodeType.SUCCESS, 0),
    ERROR_SAVING(3, ResponseCodeType.ERROR, 0),
    ERROR_SAVING_IMAGE(4, ResponseCodeType.ERROR, 0),
    ERROR_SAVING_SIMDUT(5, ResponseCodeType.ERROR, 0),
    AUTH_ERROR(6, ResponseCodeType.ERROR, 0),
    RECIPE_NOT_FOUND(7, ResponseCodeType.ERROR, 1),
    MIX_NOT_FOUND(8, ResponseCodeType.ERROR, 1),
    MATERIAL_NOT_FOUND(9, ResponseCodeType.ERROR, 1),
    MATERIAL_ALREADY_EXIST(10, ResponseCodeType.ERROR, 1),
    MATERIAL_TYPE_ALREADY_EXIST(11, ResponseCodeType.ERROR, 1),
    COMPANY_NOT_FOUND(12, ResponseCodeType.ERROR, 1),
    COMPANY_ALREADY_EXIST(13, ResponseCodeType.ERROR, 1),
    MATERIAL_LINKED(14, ResponseCodeType.ERROR, 1),
    COMPANY_LINKED(15, ResponseCodeType.ERROR, 1),
    MIX_NOT_ASSOCIATED_WITH_RECIPE(16, ResponseCodeType.ERROR, 2),
    NOT_ENOUGH_MATERIAL(17, ResponseCodeType.ERROR, 1),
    MIX_TYPE_ALREADY_USED(18, ResponseCodeType.ERROR, 1),
    MATERIAL_TYPE_NOT_FOUND(19, ResponseCodeType.ERROR, 1),
    MATERIAL_TYPE_ALREADY_EXIST_PREFIX(20, ResponseCodeType.ERROR, 1),
    MATERIAL_TYPE_LINKED(21, ResponseCodeType.ERROR, 1),
    NO_COMPANY(22, ResponseCodeType.ERROR, 0),
    NO_MATERIAL(23, ResponseCodeType.ERROR, 0),
    FILE_NOT_IMAGE(24, ResponseCodeType.ERROR, 0),
    RECIPE_NOT_FOUND_NO_PARAMS(25, ResponseCodeType.ERROR, 0),
    MATERIAL_NOT_FOUND_BY_NAME(26, ResponseCodeType.ERROR, 1),
    SUCCESS_DELETING_COMPANY(27, ResponseCodeType.SUCCESS, 1),
    SUCCESS_SAVING_MATERIAL(28, ResponseCodeType.SUCCESS, 1),
    SUCCESS_SAVING_MATERIAL_TYPE(29, ResponseCodeType.SUCCESS, 1),
    SUCCESS_SAVING_RECIPE(30, ResponseCodeType.SUCCESS, 1),
    SUCCESS_DELETING_MATERIAL(31, ResponseCodeType.SUCCESS, 1),
    SUCCESS_SAVING_COMPANY(32, ResponseCodeType.SUCCESS, 1),
    SUCCESS_DELETING_RECIPE(33, ResponseCodeType.SUCCESS, 1),
    SUCCESS_DELETING_MATERIAL_TYPE(34, ResponseCodeType.SUCCESS, 1),
    RECIPE_ALREADY_EXIST(35, ResponseCodeType.ERROR, 1),
    CANNOT_REMOVE_DEFAULT_MATERIAL_TYPE(36, ResponseCodeType.ERROR, 0),
    CANNOT_EDIT_DEFAULT_MATERIAL_TYPE(37, ResponseCodeType.ERROR, 0),
    MATERIAL_AND_MIX_TYPE_CANNOT_HAVE_SAME_NAME(38, ResponseCodeType.ERROR, 0),

    // HTTP Errors
    _500(100, ResponseCodeType.ERROR, 0),
    _404(101, ResponseCodeType.ERROR, 0),
    _401(102, ResponseCodeType.ERROR, 0),
    ;

    public static final int MAX_PARAMETERS_NUMBER = 2;

    private int code;
    private ResponseCodeType type;
    private int parametersNumber;

    ResponseCode(int code, ResponseCodeType type, int parametersNumber) {
        this.code = code;
        this.type = type;
        this.parametersNumber = parametersNumber;
    }

    public int getCode() {
        return code;
    }

    public ResponseCodeType getType() {
        return type;
    }

    public int getParametersNumber() {
        return parametersNumber;
    }

    public enum ResponseCodeType {
        ERROR,
        SUCCESS
    }

}
