/**
 * File:		proposal_hwinfo.ycp
 *
 * Module:		Initial hwinfo
 *
 * $Id: hwinfo_proposal.ycp 15349 2004-03-03 19:29:53Z sh $
 *
 * Author:		Ladislav Slezak <lslezak@suse.cz>
 *
 * Purpose:		Proposal function dispatcher for initial hwinfo module.
 */

{
    textdomain "tune";

    import "InitHWinfo";

    string func  = (string) WFM::Args(0);
    map    param = (map) WFM::Args(1);
    map    ret   = $[];

    // make proposal
    if ( func == "MakeProposal" )
    {
	boolean force_reset = param["force_reset"]:false;
	ret = $[ "raw_proposal" : InitHWinfo::MakeProposal(force_reset) ];
    }
    // start configuration workflow
    else if ( func == "AskUser" )
    {
	boolean has_next = param["has_next"]:false;

	// start inst_hwinfo module - start configuration workflow
	symbol result = (symbol)WFM::CallFunction("inst_hwinfo", []);

	// TODO: change result to `back when no change was done?
	//       this should prevent refreshing proposal
	// Fill return map
	ret =
	    $[
	      "workflow_sequence": result
	    ];
    }
    // return proposal description
    else if ( func == "Description" )
    {
	// Fill return map.
	ret =
	    $[
	      // this is a heading
	      "rich_text_title"	:	_("System"),
	      // this is a menu entry
	      "menu_title"	:	_("S&ystem"),
	      "id"		:	"init_hwinfo"
	    ];
    }
    // write settings
    else if ( func == "Write" )
    {
	// Fill return map.
	ret =
	    $[
	      "success" : true
	    ];
    }

    // return result
    return ret;
}
