/*
  File: include/ioutils/Interface_FileSynchFind.h
  Description: Find files , register them, provide lists of files that 
		have been modified since they were registered.
  Part of the Mantis project
  (c) 2002 Lycos Inc.
  
  This file is distributed for the sole purpose of allowing you to write
  software to interface with Sonique 2 and other Mantis programs. It is
  not to be modified or used for any other purpose without written
  authorization.

  If you redistribute this file, it must be in the original package
  complete with all other files provided, including the usage agreement.

  Do not remove this notice.
*/

#ifndef _INTERFACE_FILESYNCHFIND_H_
#define _INTERFACE_FILESYNCHFIND_H_

#ifdef DEBUG_INCLUDE_ORDER
#pragma message("Including " __FILE__ "\n" )
#endif

//#include "Mia.h"
//#include "HeapPtr.h"
#include "mgeneric.h"
#include "charstring.h"
#include "Interface_Prefs.h"


const uint32 FSF_FILE_NEW = 0x1; // file was first found during most recent synch
const uint32 FSF_FILE_MODIFIED = 0x2; // file has been modified since most recent open / synch
const uint32 FSF_FILE_UNCHANGED = 0x4; // file is unchanged since most recent open / synch

const uint32 FSF_FILE_MASK = 0x7;

const uint32 FSF_LIST_ADDED = 0x8; // file was added to list in most recent open / synch
const uint32 FSF_LIST_FOUND = 0x10; // file was already in list before most recent synch
const uint32 FSF_LIST_NOTFOUND = 0x20; // file was in list but not found during most recent synch , will be removed

const uint32 FSF_LIST_MASK = 0x38;
/*
enum FSFState
{
	FSF_New,
	FSF_Modified,
	FSF_Unchanged,
	FSF_Deleted,
	FSF_Error
};*/

struct FSFItem
{
	WString wsPath; // pathname
	uint32 state; // has it changed? 
	MXMLItem* pFileTypeInfo; // additional file-type-specific info
};

namespace filesys 
{
	struct EnumFilesFlags;
}
class MFileSynchFind : public MGeneric
{
public:

	virtual uint32 __stdcall Open(MPreferences* pPrefs)										= 0;
	virtual uint32 __stdcall Synch(const WString& wsPath, filesys::EnumFilesFlags& flags)	= 0;
	virtual uint32 __stdcall UnRegister(const WString& wsPath, bool bRecurse = true)		= 0;
	virtual bool __stdcall GetNext(FSFItem** pItem)											= 0;
	virtual bool __stdcall GetAt(uint32 nI, FSFItem** pItem)								= 0;
	virtual bool __stdcall GetAt(const wchar_t* wcPath, FSFItem** pItem)					= 0;
	virtual bool __stdcall Close()															= 0;
};


// {40355941-960E-49c2-A620-F40F2061496B}
DEFINE_MID( MID_FILESYNCHFIND ,0x40355941, 0x960e, 0x49c2, 0xa6, 0x20, 0xf4, 0xf, 0x20, 0x61, 0x49, 0x6b);

#ifdef DEBUG_INCLUDE_ORDER
#pragma message("Done including " __FILE__ "\n" )
#endif

#endif
