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

#ifndef CDSVmsIfscTrafFH
#define CDSVmsIfscTrafFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include <SyncObjs.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <GIFimg.hpp>
//---------------------------------------------------------------------------
#include "ITSLibF.h"
#include "CDSItsObjectF.h"
//---------------------------------------------------------------------------

typedef struct _VMS_TRAF
{
    int        SPED;            //	N	NUMBER(3)	Y	0		속도
    int        TRVL_HH;         //	N	NUMBER(6)	Y	0		통행 시간
    AnsiString CMTR_GRAD_CD;    //	N	VARCHAR2(7)	Y			소통 등급 코드
} VMS_TRAF;
//---------------------------------------------------------------------------

/*
*  class
*/
class TCDSIfscTraf
{
public:
    TCDSIfscTraf()
    {
        IsValid = false;
    };
    ~TCDSIfscTraf() {};

public:
    AnsiString IFSC_ID;
    int        SECT_LNGT;
    bool       IsValid;
    int        SPED;
    int        TRVL_HH;
public:
};
//---------------------------------------------------------------------------

class TVmsIfscGrad
{
public:
    TVmsIfscGrad()
    {
        IsValid = true;
    };
    ~TVmsIfscGrad() {};

public:
    bool       IsValid;
    AnsiString CMTR_GRAD_CD;
    int        LWSTSPED;
    int        HGHSSPED;
};
//---------------------------------------------------------------------------

class TObjectId
{
public:
    TObjectId()
    {
        IsValid = true;
    };
    ~TObjectId() {};
public:
    bool       IsValid;
    AnsiString ID;
};
//---------------------------------------------------------------------------

/*
*  class
*/
class TCDSVmsIfscTraf
{
public:
    TCDSVmsIfscTraf()
    {
        IsValid = true;
        traf.SPED      = 0;
        traf.TRVL_HH   = 0;
        traf.CMTR_GRAD_CD = "0";
    };
    ~TCDSVmsIfscTraf() {};

public:
    bool       IsValid;
    AnsiString VMS_IFSC_ID;
    int        SECT_LNGT;

    TItsMap<int,        TObjectId*>    FLists;
    TItsMap<AnsiString, TVmsIfscGrad*> FGrads;

    VMS_TRAF   traf;

public:

    int  CreateTraffic();
};
//---------------------------------------------------------------------------

/*
* Manager
*/
class TCDSVmsIfscTrafManager : public TCDSItsObject
{
public:
    TCDSVmsIfscTrafManager();
    virtual ~TCDSVmsIfscTrafManager();

public:

    TItsMap<AnsiString, TCDSIfscTraf*>      FIfscTrafLists;
    TItsMap<AnsiString, TCDSVmsIfscTraf*>   FVmsIfscLists;

public:
    int InitVmsIfscTraffic(TADOConnection *ADbConn);
    int CreateVmsIfscTraffic(TADOConnection *ADbConn);

    int INIT_TB_VMS_IFSC_TRAF(TADOConnection *ADbConn);
    int INIT_TB_IFSC_TRAF(TADOConnection *ADbConn);

    int SEL_TB_IFSC_TRAF(TADOConnection *ADbConn);
    int SEL_TB_VMS_IFSC_RLTN_IFSC(TADOConnection *ADbConn);
    int SEL_TB_VMS_IFSC_CMTR_GRAD(TADOConnection *ADbConn);

    int UPD_TB_VMS_IFSC_TRAF(TADOConnection *ADbConn);

};
//---------------------------------------------------------------------------
extern TCDSVmsIfscTrafManager *CDSVmsIfscTrafManager;
//---------------------------------------------------------------------------

#endif
