/*
 * $Id: scpm.hh,v 1.33 2005/02/10 16:47:41 jg Exp $
 *
 *
 * Project     :  SCPM (System Configuration Profile Management)
 * Module      :  SCPM main engine
 * File        :  scpm.hh
 * Description :  defines the SCPM interface
 * Author      :  Joachim Gleissner <jg@suse.de>
 *
 * Copyright 2001 SuSE GmbH
 *           2002-2004 SuSE Linux AG
 *
 * Released under the terms of the GNU General Public License
 * (see file COPYRIGHT in project root directory).
 *
 */
#ifndef SCPM_H
#define SCPM_H

using namespace std;

#include <string>
#include <vector>
#include <scpm_types.h>
#include <scdb.h>

class SCPM
{
public:

  SCPM( int options=0, ostream &info_out=cout, ostream &hash_out=cout, string root="" );
  ~SCPM();

  bool Enable( bool force=false );
  bool Disable( );

  bool Active( string &profile );
  bool List( vector<string> &profiles );

  bool Add( string profile, bool auto_switch=true );
  bool Copy( string source_profile, string profile );
  bool Create( string profile, string source_profile );
  bool Delete( string profile );
  bool Rename( string profile, string newprofile );
  bool Reload( );
  bool PrepareSwitch( string profile, switch_info_t &switch_info );
  bool Switch( switch_info_t &switch_info );
  bool Save( switch_info_t &switch_info );
  bool Modify( string profile, string action );
  bool Set( string command, string argument, string profile="" );
  bool Get( string command, string &result, string profile="" );
  bool Status( scpm_status_t &status );

  bool ShowChanges( ostream &output, string resource_type, string resource_name, bool backup=false );

  bool SetResourceSet( string set );
  bool GetResourceSet( string &set );
  bool ListResourceSets( vector<string> &predefined, vector<string> &individual );
  bool CopyResourceSet( string set, string newset );
  bool DeleteResourceSet( string set );

  bool ListResourceGroups( vector<resource_group_t> &groups );
  bool GetResourceGroup( const string &name, vector<resource_entry_t> &group );
  bool GetResourceGroup( const string &name, vector<resource_entry_t> &group,
			 string &description );
  bool SetResourceGroup( const string &name, const vector<resource_entry_t> &group,
			 const string &description );
  bool DeleteResourceGroup( const string &group );
  bool RenameResourceGroup( const string &group, const string &newgroup );
  bool SetActiveResourceGroups( const vector<string> &groups );
  bool GetActiveResourceGroups( vector<string> &groups );
  bool ActivateResourceGroup( const string &group, bool auto_add=false );
  bool DeactivateResourceGroup( const string &group, bool auto_remove=false );
  bool ResetResourceGroup( const string &group );
  bool ResetAllGroups( );

  bool RebuildDB( rebuild_mode_t mode=REBUILD_MODE_QUICK );

  bool SetConfigOption( const string &option, const string &value );
  bool GetConfigOption( const string &option, string &value );

  // update and backup functions
  bool Update( const string &scriptname, vector<pair<string, string> > resources );
  bool UpdateResources( );
  bool Backup( const string &command, const vector<pair<string,string> > &resources,
	       const string &profile, vector<backup_info_t> *reslist=NULL );
  bool Recover( bool rollback=false );

  bool Commit( );

};


#endif
