require "helpers.logger"
local m_agentservice  = require "helpers.agentservice"
local m_cassandra     = require "helpers.cassandra"
local m_commandline   = require "helpers.commandline"
local m_csv           = require "helpers.csv"
local m_date          = require "helpers.date"
local m_elasticsearch = require "helpers.elasticsearch"
local m_filesystem    = require "helpers.filesystem"
local m_occLogin      = require "helpers.occLogin"
local m_permissions   = require "helpers.permissions"
local m_redis         = require "helpers.redis"
local m_request       = require "helpers.request"
local m_string        = require "helpers.string"
local m_system        = require "helpers.system"
local m_table         = require "helpers.table"
local m_utils         = require "helpers.utils"
local m_validation    = require "helpers.validation"

module(..., package.seeall)

local function EnableLogger (enabled, owner)
	-- Funcion "SetEnabledLogger" existente en helpers.logger
	if type(SetEnabledLogger) == "function" then
		SetEnabledLogger(enabled, owner)
	end
end
--EnableLogger(true)

-------------------------------------
return {
	-- agentservice
	agentservice = {
		GetVccLicense                         = m_agentservice.GetVccLicense,
		GetAvailableLicenseResources          = m_agentservice.GetAvailableLicenseResources,
		CompanyIsEditable                     = m_agentservice.CompanyIsEditable,
		CompanyIsRequired                     = m_agentservice.CompanyIsRequired,
		ValidateCompany                       = m_agentservice.ValidateCompany,
		ValidateWhatsappActivationCode        = m_agentservice.ValidateWhatsappActivationCode,
		EnableWhatsappActivationCode          = m_agentservice.EnableWhatsappActivationCode,
		SetVccLicense                         = m_agentservice.SetVccLicense,
		GetChannelLicenses                    = m_agentservice.GetChannelLicenses,
		GetVccWithLicenseInfo                 = m_agentservice.GetVccWithLicenseInfo
	},
	-- logger
	logger = {
		Enable                                 = EnableLogger
	},
	-- csv
	csv = {
		ParseCSVHeader                         = m_csv.ParseCSVHeader,
		ParseCSVLine                           = m_csv.ParseCSVLine,
		Csv2Table                              = m_csv.Csv2Table,
		Table2Csv                              = m_csv.Table2Csv
	},
	-- cassandra
	cassandra = {
		Init                                   = m_cassandra.Init,
		GetClient                              = m_cassandra.GetClient,
		GetAllColumns                          = m_cassandra.GetAllColumns,
		SaveRows                               = m_cassandra.SaveRows,
		RemoveColumns                          = m_cassandra.RemoveColumns
	},
	-- commandline
	commandline = {
		RequestAlpha                           = m_commandline.RequestAlpha,
		RequestBoolean                         = m_commandline.RequestBoolean,
		RequestNumeric                         = m_commandline.RequestNumeric
	},
	-- date
	date = {
		ConvertHourToUTCHour                   = m_date.ConvertHourToUTCHour,
		ConvertUTCHourToHour                   = m_date.ConvertUTCHourToHour,
		ConvertDateToUTCDate                   = m_date.ConvertDateToUTCDate,
		ConvertUTCDateToDate                   = m_date.ConvertUTCDateToDate,
		IsEnabledDateBetweenDaylightSavingTime = m_date.IsEnabledDateBetweenDaylightSavingTime
	},
	-- elasticsearch
	elasticsearch = {
		CountElasticSearch                     = m_elasticsearch.CountElasticSearch,
		GetElasticSearchInstance               = m_elasticsearch.GetElasticSearchInstance,
		GetMaxAllowedRowsInES                  = m_elasticsearch.GetMaxAllowedRowsInES,
		MakeAuthorization                      = m_elasticsearch.MakeAuthorization,
		MakeElasticSearchPaged                 = m_elasticsearch.MakeElasticSearchPaged,
		MakeRequestInfo                        = m_elasticsearch.MakeRequestInfo,
		PitElasticSearch                       = m_elasticsearch.PitElasticSearch
	},
	-- filesystem
	filesystem = {
		CopyFile                               = m_filesystem.CopyFile,
		CopyTreeDirectoryWithContent           = m_filesystem.CopyTreeDirectoryWithContent,
		CreateDirectory                        = m_filesystem.CreateDirectory,
		CreateFile                             = m_filesystem.CreateFile,
		FileRead                               = m_filesystem.FileRead,
		FileReadInParts                        = m_filesystem.FileReadInParts,
		IsDirectory                            = m_filesystem.IsDirectory,
		MoveDirectory                          = m_filesystem.MoveDirectory,
		RemoveDirectory                        = m_filesystem.RemoveDirectory,
		RemoveFile                             = m_filesystem.RemoveFile,
		WriteTxtFile                           = m_filesystem.WriteTxtFile
	},
	-- occLogin
	occLogin = {
		BuildCompleteUrl                       = m_occLogin.BuildCompleteUrl,
		GetCookie                              = m_occLogin.GetCookie,
		Login                                  = m_occLogin.Login,
		LoginSystemUser                        = m_occLogin.LoginSystemUser,
		Logout                                 = m_occLogin.Logout,
		SetServerAndPort                       = m_occLogin.SetServerAndPort
	},
	-- permisos
	permissions = {
		fullSystemAccess = {
			UpdatePermissions                  = m_permissions.fullSystemAccess.UpdatePermissions
		},
		GetApplicationsActions                 = m_permissions.GetApplicationsActions
	},
	-- redis
	redis = {
		Init                                   = m_redis.Init,
		GetClient                              = m_redis.GetClient
	},
	-- request
	request = {
		Get                                    = m_request.Get,
		Post                                   = m_request.Post,
		GetLongParamsUrlById                   = m_request.GetLongParamsUrlById,
		MakeShortURL                           = m_request.MakeShortURL
	},
	-- string
	string = {
		CleanCR                                = m_string.CleanCR,
		ltrim                                  = m_string.ltrim,
		rtrim                                  = m_string.rtrim,
		alltrim                                = m_string.alltrim,
		CapitalizeUpperCase                    = m_string.CapitalizeUpperCase,
		ParseString                            = m_string.ParseString
	},
	-- system
	system = {
		GetSystemConfig                       = m_system.GetSystemConfig,
		LoadSystemConfig                      = m_system.LoadSystemConfig
	},
	-- table
	table = {
		ArrayToHash                           = m_table.ArrayToHash,
		DeepCopy                              = m_table.DeepCopy,
		GetRowCount                           = m_table.GetRowCount,
		HashToArray                           = m_table.HashToArray,
		IsArray                               = m_table.IsArray,
		JSON_Decode                           = m_table.JSON_Decode,
		JSON_Encode                           = m_table.JSON_Encode,
		Log                                   = m_table.Log,
		Merge                                 = m_table.Merge,
		SortArray                             = m_table.SortArray,
		StructuralCompare                     = m_table.StructuralCompare,
		TableIsEmpty                          = m_table.TableIsEmpty,
		TruncateArray                         = m_table.TruncateArray
	},
	-- varios
	utils = {
		Analytics                             = {
			Get = m_utils.GetAnalyticsInstance
		},
		ExecuteAsyncTasks                     = m_utils.ExecuteAsyncTasks,
		CompareJsonObjects                    = m_utils.CompareJsonObjects,
		ElapsedTime                           = {
			Start                                = m_utils.StartElapsedTime,
			End                                  = m_utils.EndElapsedTime,
			GetElapsedTimeSec                    = m_utils.GetElapsedTimeSec,
			GetTimeArray                         = m_utils.GetTimeArray
		},
		GetOSDistro                           = m_utils.GetOSDistro,
		HasLicenseSystem                      = m_utils.HasLicenseSystem,
		HasRepositoryService                  = m_utils.HasRepositoryService,
		IsUserFullSystemAccess                = m_utils.IsUserFullSystemAccess,
		Memory                                = {
			Show                                 = m_utils.ShowMemory,
			CollectAll                           = m_utils.CollectAllMemory
		},
		OSCapture                             = m_utils.OSCapture,
		ParseUrlQueryString                   = m_utils.ParseUrlQueryString,
		Round                                 = m_utils.Round,
		Separate                              = m_utils.Separate,
		Sleep                                 = m_utils.Sleep,
		SplitString                           = m_utils.SplitString,
		Uuid                                  = m_utils.Uuid
	},
	validation = {
		StartValidateJsonValues               = m_validation.StartValidateJsonValues,
		ValidateValue                         = m_validation.ValidateValue
	}
}