classdef Recipe  
  methods (Static = true)
    function [output_par, error] = call_recipe(command,varargin)
      error.flag = false;
      error.desc = "";
      error.complete = [];
      try
        if strcmpi(command,'load_settings')
          [Settings, error] = Recipe.load_settings(error);
          output_par = Settings;
        elseif strcmpi(command,'load_categories')
          [Settings,error] = Recipe.load_settings(error);
          [Categories, error] = Recipe.load_category_names(Settings, error);
          output_par = Categories;
        else
          output_par = [];
          error.flag = true;
          error.desc = sprintf("%s Call error: incorrect command provided.\n", error.desc);
        endif
      catch ME
        output_par = [];
        error.flag = true;
        error.desc = sprintf("%s Call error: unknown error.\n");
        error.desc = sprintf("%s Error message: %s\n",error.desc,ME.message);
        error.complete = ME;
      end_try_catch
    endfunction
  endmethods
  
  methods (Access = private, Static =true)
    function [Settings, error] = load_settings(error)
      %% define variables:
      Settings.MinPercScore = 0.1;  
      Settings.SkewFactor = 2.5;    
    endfunction
    
    function [cat_list, error] = load_category_names(Settings, error)
      try
        cat_list{1} = 'test category 1';
        cat_list{2} = 'test category 2';
      catch ME
        cat_list = [];
        error.flag = true;
        error.desc = sprintf("%s Load error: unable to load categories.\n",error.desc);
        error.desc = sprintf("%s Error message: %s\n",error.desc,ME.message);
        error.complete = ME;
      end_try_catch
    endfunction
    
  endmethods   
endclassdef