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

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


class TVmsLinkIfsc
{
public:
    TVmsLinkIfsc();
    ~TVmsLinkIfsc();

public:
    int     VMS_IFSC_ID;        //NUMBER(10)	N			VMS 정보제공구간 ID
    String  IFSC_ID;            //NUMBER(10)	N			정보제공구간 ID
    int     ORD;                //NUMBER(3)	Y	0		순서
    //String  DSPL_STRT_NODE_NM;  //VARCHAR2(30)	Y			표출 시작 노드 명
    //String  DSPL_END_NODE_NM;   //VARCHAR2(30)	Y			표출 종료 노드 명

    String  IFSC_NM;            //NUMBER(10)	N			정보제공구간 ID
};

//---------------------------------------------------------------------------
class TVmsIfsc
{
public:
    TVmsIfsc();
    ~TVmsIfsc();

private:
    bool    FCompleted;
    int     FEditMode;
	int     FGridIndex;
    String  FMEM_DEL;

public:
    int     VMS_IFSC_ID;        //NUMBER(10)	N			VMS 정보제공구간 ID
    String  VMS_IFSC_NM;        ///VARCHAR2(60)	Y			VMS 정보제공구간 명
    String  DSPL_STRT_NODE_NM;  //VARCHAR2(30)	Y			표출 시작 노드 명
    String  DSPL_END_NODE_NM;   //VARCHAR2(30)	Y			표출 종료 노드 명
    int     DETR_ID;            //NUMBER(10)	Y			우회도로 ID
    String  USE_YN;             //CHAR(1)	    Y			사용 여부
    String  ROAD_NM;            //VARCHAR2(30)	Y			도로명
    String  SPOT_NM;            //VARCHAR2(30)	Y			지점명
    String  AXIS_YN;            //CHAR(1)	    Y	'N'		축정보 생성용

    String  DEL_YN;

//1	EDI0	EDI	추가	insert					Y
//2	EDI1	EDI	수정	update					Y
//3	EDI2	EDI	삭제	delete					Y

    int     MIN[3];
    int     MAX[3];

    String  PRCN_DT;	    //N	VARCHAR2(14)	Y			가공 일시
    int     SPED;	        //N	NUMBER(3)	    Y	0		속도
    String  CMTR_GRAD_CD;	//N	VARCHAR2(7)	    Y			소통 등급 코드 ==>예는 0,1,2,3으로 들어가네???
    int     TRVL_HH;	    //N	NUMBER(6)	    Y	0		통행 시간
    int     CNGS_SPD;

    void InitTraffic();

public:
    TItsMap<int, TVmsLinkIfsc*>  FLists;

public:
    __property bool   Completed = {read = FCompleted, write = FCompleted};
	__property int    EditMode  = {read = FEditMode,  write = FEditMode };
	__property int    GridIndex = {read = FGridIndex, write = FGridIndex };
	__property String MEM_DEL   = {read = FMEM_DEL,   write = FMEM_DEL };
};


//---------------------------------------------------------------------------
class TVmsIfscManager
{
public:
    TVmsIfscManager();
    ~TVmsIfscManager();

private:

public:
    TItsMap<int, TVmsIfsc*>  FLists;

public:
    void InitTraffic();

    bool LoadFromDb(TADOConnection *ADbConn=NULL);
    bool LoadSubFromDb(TADOConnection *ADbConn=NULL);
    bool LoadTraffic(TADOConnection *ADbConn=NULL);

    bool GetNextVmsIfscId(int &AIfscId, TADOConnection *ADbConn=NULL);
    bool DeleteVmsIfsc(TVmsIfsc *AObj, TADOConnection *ADbConn=NULL);
    bool InsertVmsIfsc(TVmsIfsc *AObj, TADOConnection *ADbConn=NULL);
    bool UpdateVmsIfsc(TVmsIfsc *AObj, TADOConnection *ADbConn=NULL);
    bool MergeVmsIfsc(TVmsIfsc *AObj, TADOConnection *ADbConn=NULL);
    bool UpdateIfscSpeedInfo(TVmsIfsc *AObj, TADOConnection *ADbConn=NULL);
    bool UpdateIfscCngsSpeedInfo(int ACngsSpd, TADOConnection *ADbConn=NULL);
};
//---------------------------------------------------------------------------
extern TVmsIfscManager *VmsIfscManager;
//---------------------------------------------------------------------------

#endif
