var appSalar = {},
    common = require('./../utils/common.js'),
    fs = require('fs');
    request = require('request');
	csvparse = require('csv');


(function (appSalar) {

    //0 index is field name, 1 index is field index from file. 
    //So that if column sequence is later changed we have the actual index generted from file.
    appSalar.FieldList=[
        ["Install Time",-1],
        ["Click Time",-1],
        ["Device ID",-1],
        ["Longname",-1],
        ["Campaign",-1],
        ["Platform",-1],
        ["Ad Group",-1],
        ["Network",-1],
        ["Site",-1]
    ];

    appSalar.DateFormat={
    	"format":"yyyy-mm-dd hh:mm:ss.000000",
        "dateSeparator":"-",
        "dateTimeSeparator":" ",
        "timeSeparator":":",
        "dayIndex":2,
        "monthIndex":1,
        "yearIndex":0,
        "hourIndex":0,
        "minuteIndex":1,
        "secondIndex":2,
        "milliSeconIndex":-1
    };

    appSalar.delimiterChar = '\t';

    appSalar.getDateFormat= function(){
		return appSalar.DateFormat;
    };

    appSalar.getFieldList = function(data){
        var fields=appSalar.FieldList;
        for (var i = 0; i<fields.length ; i++) {
            for(var j=0;j<data[0].length;j++){
                if(fields[i][0]==data[0][j]){
                    fields[i][1]=j;
                    break;
                }
            }   
        }

        return fields;
    };


}(appSalar));

module.exports = appSalar;