/////////////////////////////////////////////////////////////////////
//  模拟测试数据
//  
//
/////////////////////////////////////////////////////////////////////


function HQData()  { }

HQData.Explain="本地测试数据";

HQData.NetworkFilter=function(data, callback)
{
    console.log(`[HQData::NetworkFilter] ${HQData.Explain}`, data);

    switch(data.Name) 
    {
        case 'MinuteChartContainer::RequestMinuteData':                 //分时图数据对接
            HQData.RequestMinuteData(data, callback);
            break;
        case "MinuteChartContainer::RequestHistoryMinuteData":          //多日分时图
            HQData.RequestMinuteDaysData(data, callback);
            break;

        case 'KLineChartContainer::RequestHistoryData':                 //日线全量数据下载
            HQData.RequestHistoryData(data,callback);
            break;
        case 'KLineChartContainer::RequestRealtimeData':                //日线实时数据更新
            HQData.RequestRealtimeData(data,callback);
            break;
        case 'KLineChartContainer::RequestFlowCapitalData':             //流通股本
            HQData.RequestFlowCapitalData(data,callback);
            break;

        case 'KLineChartContainer::ReqeustHistoryMinuteData':           //分钟全量数据下载
            HQData.RequestHistoryMinuteData(data, callback);
            break;
        case 'KLineChartContainer::RequestMinuteRealtimeData':          //分钟增量数据更新
            HQData.RequestMinuteRealtimeData(data,callback);
            break;
    }
}

HQData.RequestMinuteData=function(data, callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol[0]; //请求的股票代码
    var dayCount=data.Request.Data.daycount;
    console.log(`[HQData::RequestMinuteData] Symbol=${symbol}`);
    
    var hqchartData=MINUTE_1DAY_DATA;
    hqchartData.stock[0].symbol=symbol;
    hqchartData.stock[0].name=symbol;

    callback(hqchartData);
}

HQData.RequestMinuteDaysData=function(data, callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol; //请求的股票代码
    var dayCount=data.Request.Data.daycount;
  
    console.log(`[HQData::RequestMinuteDaysData] Symbol=${symbol}`);
    
    var hqchartData=MINUTE_5DAY_DATA;
    hqchartData.symbol=symbol;
    hqchartData.name=symbol;
   
    callback(hqchartData);
}

HQData.RequestHistoryData=function(data,callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol; //请求的股票代码
  
    console.log(`[HQData::RequestMinuteDaysData] Symbol=${symbol}`);
    
    var hqchartData=KLINE_DAY_DATA;
    hqchartData.symbol=symbol;
    hqchartData.name=symbol;
   
    callback(hqchartData);
}

HQData.RequestFlowCapitalData=function(data,callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol; //请求的股票代码

    console.log(`[HQData::RequestFlowCapitalData] Symbol=${symbol}`);

    var hqchartData=KLINE_CAPITAL_DATA;
    callback(hqchartData);
}

HQData.RequestRealtimeData=function(data,callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol[0]; //请求的股票代码

    console.log(`[HQData::RequestRealtimeData] Symbol=${symbol}`);

    var hqchartData=KLINE_1DAY_DATA;
    hqchartData.stock[0].name=symbol;
    hqchartData.stock[0].symbol=symbol;
    callback(hqchartData);
}


HQData.RequestHistoryMinuteData=function(data, callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol; //请求的股票代码

    console.log(`[HQData::RequestHistoryMinuteData] Symbol=${symbol}`);

    var hqchartData=KLINE_MINUTE_DATA;
    hqchartData.name=symbol;
    hqchartData.symbol=symbol;
    callback(hqchartData);

}


HQData.RequestMinuteRealtimeData=function(data,callback)
{
    data.PreventDefault=true;
    var symbol=data.Request.Data.symbol[0]; //请求的股票代码

    console.log(`[HQData::RequestMinuteRealtimeData] Symbol=${symbol}`);

    var hqchartData=KLINE_1MINUTE_DATA;
    hqchartData.name=symbol;
    hqchartData.symbol=symbol;
    callback(hqchartData);
}
