//---------------------------------------------------------------------------

#ifndef CDSWebUserFH
#define CDSWebUserFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <ADODB.hpp>
#include <DB.hpp>
#include "ITSLibF.h"
//---------------------------------------------------------------------------

/*
*  User class
*/
class TWebUser
{
public:
    TWebUser();
    virtual ~TWebUser();
    void Clear();
private:
    bool    FCompleted;
    int     FEditMode;
	int     FGridIndex;

public:
    String USER_ID;             //	N	NUMBER(10)	    N			홈페이지 사용자 아이디
    String EMAIL;               //	N	VARCHAR2(50)	N			이메일 주소(유일키)
    String NAME;                //	N	VARCHAR2(30)	Y			사용자 명
    String PWD;                 //	N	VARCHAR2(64)	Y			비밀번호
    String CONTACTNUM;          //	N	VARCHAR2(20)	Y			연락처
    String USERAUTH;            //	N	VARCHAR2(3)	    Y			사용자인증
    String QUESTION;            //	N	VARCHAR2(200)	Y			사용자인증질문
    String ANSWER;              //	N	VARCHAR2(100)	Y			사용자인증답변
    String RGST_DT;             //	N	VARCHAR2(14)	Y			등록일시
    String LOGIN_FAIL_COUNT;    //	N	NUMBER(10)	    Y	0		로그인실패횟수
    String IS_ACCOUNT_LOCK;     //	N	CHAR(1)	        Y	'N'		계정잠김여부
    String IP_ADDRESS;          //	N	VARCHAR2(100)	Y			관리자계정접속가능아이피
    String DEL_YN;              //	N	CHAR(1)	        Y	'N'		삭제여부(Y:삭제됨,N:삭제안됌)

    String IS_ACCOUNT_LOCK_NM;
    String USERAUTH_NM;

    String MEM_DEL;

public:
    __property bool   Completed = {read = FCompleted, write = FCompleted};
	__property int    EditMode  = {read = FEditMode,  write = FEditMode };
	__property int    GridIndex = {read = FGridIndex, write = FGridIndex };
};
//---------------------------------------------------------------------------

/*
* User Manager
*/
class TWebUserManager
{
public:
    TWebUserManager();
    virtual ~TWebUserManager();

public:
    TItsMap<String, TWebUser*>   FLists;

public:
    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool GetNextUserId(int &AId, TADOConnection *ADbConn=NULL);
};
//---------------------------------------------------------------------------
extern TWebUserManager *WebUserManager;
//---------------------------------------------------------------------------

#endif

