import SQLite from 'react-native-sqlite-2';
import * as RNFS from 'react-native-fs';
import bgimage1 from '../assets/performics/circle_cream.svg';
import bgimage2 from '../assets/performics/circle_green.svg';
import bgimage3 from '../assets/performics/circle_red.svg';
import { AppName, DBName as AppDBName } from '../../../AppSpecificContant';
import DeviceInfo from 'react-native-device-info';
import { Platform } from 'react-native';


const HierarchyTbls = { "Master_Category": "Master_Category", "Master_SubCategory": "Master_SubCategory", "Master_Brand": "Master_Brand", "Master_SubBrand": "Master_SubBrand", "Master_Product": "Master_Product", "Master_Program": "Master_Program" }
const fixedurl = 'https://api1.parinaam.in/api/generic/GetAppSettingWithDeviceInfo';//'https://api.parinaam.in/api/GetAppDetails';
const ServerDTurl = 'https://api1.parinaam.in/api/generic/GetServerDateTime_INTL';//GetServerDateTime
const GyanCastURL = 'https://gyancast.parinaam.in/api/Cast/'
const baseurl = '';//'https://th.parinaam.in/Webservice/Performics_ThailandService.svc/';
const URL_IMAGE = '';//'https://th.parinaam.in/webservice/Imageupload.asmx/';
// const URL_GET_OTP = "https://cpmmfa.parinaam.in/Webservice/MFMService.svc/";
// const URL_GETTRAINING = "https://th.parinaam.in/conten/training.html";
// const testurl='https://Anitemp.parinaam.in/Webservice/Abbott_MnancService.svc/DownloadJson';
// const testurl_upload='https://Anitemp.parinaam.in/Webservice/Abbott_MnancService.svc/UploadJson';
// const testurl_image='https://th.parinaam.in/webservice/Imageupload.asmx/';
// const myKeys={"DownloadKey":[{"KeyId":1,"DownloadKey":"Table_Structure","IsMandatory":true,"DevActive":true,"ProdActive":true,"DownloadSequence":1},{"KeyId":4,"DownloadKey":"Mapping_JourneyPlan","IsMandatory":false,"DevActive":true,"ProdActive":true,"DownloadSequence":3},{"KeyId":5,"DownloadKey":"Adhoc_JourneyPlan","IsMandatory":true,"DevActive":true,"ProdActive":true,"DownloadSequence":4},{"KeyId":6,"DownloadKey":"Product_Master","IsMandatory":true,"DevActive":true,"ProdActive":true,"DownloadSequence":5},{"KeyId":7,"DownloadKey":"Non_Working_Reason","IsMandatory":true,"DevActive":true,"ProdActive":true,"DownloadSequence":2}]}; 
const sloganline = '...Any slogan line here...';
const appname = 'Supervisor App';

// const db = SQLite.openDatabase({'name':'Performics.db'});
// GD change
const Production = false
const proDate = "11/12/2024"
const DevType = Production ? "Prod" : "Dev"
const AppVersion = Platform.OS === 'ios' ? DeviceInfo.getVersion() : '6.9';
//const DBName=AppDBName+'_'+AppVersion.replace(".","_")+'.db';
const DBName = AppDBName + '_' + AppVersion.replace(".", "_");

console.log('DBName in contants:', DBName);
const db = SQLite.openDatabase(DBName, AppVersion);
const version = `Version ${AppVersion}`;
const copyrightText = '© copyright CPM India';
const cpm_logo = 'cpm_logo.png';
const logoImage = require('../assets/image/olay_logo.png');
const gMap_key = 'AIzaSyCI1EaTZk3eXA_J_UsnBC1STOAFe`d5unJ4A';
const OQAD_TimeConst = 30;
const LAST_ServerAPI_CALL = 'lastCallTime';
const OLA_MAP_KEY = '4BsmswcWSrAjOhoUJiFKlhh4rNiksal1IrsRvE36'
const CONFIG = {
  API_BASE_URL: "https://gbapi.parinaam.in/api",
  CLIENT_ID: "84ee1898d70a24992a30b5c1",
  CLIENT_SECRET: "ff46ca4523416076b50ab6691b107244f7b78f005af671613a36a14fb4e1be77",
  DEFAULT_USER_ID: "demo_user_123",
  DEFAULT_USER_NAME: "Demo User",
  MAX_MESSAGE_LENGTH: 300,
  CHAT_TITLE: "CPM India Chat",
  WELCOME_MESSAGE:
    "Welcome to Gyan Buddy. How may I help you?",
  SESSION_END_MESSAGE: "Chat session has been ended successfully.",
  DEFAULT_DISCLAIMER: "Gyan Buddy can make mistakes. Please verify details with an authorized representative before taking action."
};


// const colors_Arr={"0":{bg:['#d0f5fb','#43b0c3'],color:'#0c8fa5'},"1":{bg:['#fdeacf','#ffbb58'],color:'#f39a19'},"2":{bg:['#ffdede','#f99292'],color:'#ff5f5f'},"3":{bg:['#ddd4ff','#a48ef9'],color:'#4551e7'},"4":{bg:['#d1efd3','#83c188'],color:'#3b9542'},"5":{bg:['#efeed1','#e1de7d'],color:'#bfbb44'},"6":{bg:['#fdeffd','#fdb9ff'],color:'#fc86ff'}};
// const colors_Arr={"0":{bg:['#faf7ef','#e4d9be'],color:'#0c8fa5','bgImage':bgimage1},"1":{bg:['#e6f9f5','#8cdccc'],color:'#f39a19','bgImage':bgimage2},"2":{bg:['#faebed','#eec8ce'],color:'#ff5f5f','bgImage':bgimage3}};
const colors_Arr = { "0": { bg: ['#eddeb8', '#e4b43c'], color: '#0c8fa5', 'bgImage': bgimage1 }, "1": { bg: ['#dcf2ee', '#30cfb0'], color: '#f39a19', 'bgImage': bgimage2 }, "2": { bg: ['#eebdc3', '#e88191'], color: '#ff5f5f', 'bgImage': bgimage3 } };
const common_ImagePath = `${RNFS.DocumentDirectoryPath}/`;
//const common_ImagePath = `${RNFS.ExternalDirectoryPath}/`;
const ImageFolderPath = `${common_ImagePath}PerformicsAllImages/`;
const TrainingContentFolderPath = `${common_ImagePath}TrainingContent`;
const VisitorImageFolderPath = ImageFolderPath + `VisitorFeedbackImages/`;
const VisitorLoginImageFolderPath = ImageFolderPath + `VisitorLoginFeedbackImages/`;
const StoreCheckListImagePath = ImageFolderPath + 'StoreChecklist/';
const ContractFormImagePath = ImageFolderPath + 'ContractForm/';
const CoverageImagePath = ImageFolderPath + 'CoverageImages/';
const AddStoreImagePath = ImageFolderPath + 'AddNewStoreImages/';
const visiCoolerImgPath = `${common_ImagePath}VISICoolerImages`;
const kycImagePath = ImageFolderPath + 'KYCImages/';
const dbbackupFolder = `${common_ImagePath}DbBackup`;
const GroomingImagePath = ImageFolderPath + 'GROOMINGIMG/';



const defUploadFolder = 'BulkImages';
const KPIFolders = {
  'STOCK': 'StockSingleKPIImages',
  'STOCKWITHCATEGORY': 'StockWithCatImages',
  'OPSTOCK': 'StockImages',
  'BACKSTOCK': '',
  'MDSTOCK': 'StockImages',
  'CLSSTOCK': 'StockImages',
  'SOS': 'ShareOfShelfImages',
  'PAIDVISI': 'VisibilityImages',
  'ADDITIONALVISI': 'VisibilityImages',
  'COMPVISI': 'CompetitionVisibilityImages',
  'PROMOTION': 'PromotionImages',
  'COMPROMO': 'CompetionPromotionImages',
  'CONCOV': '',
  'SALE': '',
  'SURVEY': 'SurveyImages',
  'WINDOW': 'WindowImages',
  'POSM': 'POSMImages',
  'FEEDBACK': 'FeedbackImages',
  'PROMOTION2': 'Promotion2Images',
  'STOREIMG': 'StoreImages',
  'SHELFTALKER': 'ShelfTalkerImages',
  'PROMOTIONONEAPP': 'PromotionImages',
  'PAIDVISIONEAPP': 'PaidVisibilityImages',
  'POSSALEONEAPP': 'POSSaleImages',
  'SOSONEAPP': 'SOSImages',
  'CATEXEONEAPP': 'CategoryExecutionImages',
  'STORESCORE': '',
  'ORDER': 'OrderImages',
  'ORDERSIMPLIFYONEAPP':'OrderImages',
  'ORDERSTATUS': 'OrderImages',
  'TRAININGONEAPP': '',
  'StoreChecklist': 'StoreChecklistImages',
  'SAMPLINGONEAPP': 'SamplingImages',
  "PROGRAMONEAPP": 'ProgramImages',
  "TGBASEDONEAPP": "TargetBasedImages",
  "ContractForm": 'ContractFormImages',
  "CoverageImages": 'CoverageImages',
  "AddNewStoreImages": "AddNewStoreImages",
  "WAREHOUSEDEPLOY": "WareHouseDeployImages",
  "WAREHOUSECAMPAIGN": "WareHouseCampaignImages",
  'DBVISICOOLERONEAPP': 'DistributorVisicoolerImages',
  'STOCKWITHPROMO': 'StockWithPromoImages',
  'VISICoolerImages': 'VISICoolerImages',
  "KYCImages": "KYCImages",
  "KYCONEAPP": "KYCImages",
  "DBPOSMONEAPP": "DBPosmImages",
  "DBWINDOWONEAPP": "DBWindowImages",
  "RETURNSTOCKONEAPP": "ReturnStockImages",

}

const FolderForREC = {
  'SURVEY': 'SurveyVoicefiles',
  'VisitorFeedback': 'VisitorFeedbackImages',
  'VisitorLoginFeedback': 'VisitorLoginFeedbackImages',

}
const NonProgramLabel_def = "Non Prog."
const StoreSearch_def = "Store Search."

const IRSyncStatus = {
  'NOT_SYNCED': 'NOT_SYNCED',
  'SYNCED': 'SYNCED',
  'SYNCING': 'SYNCING',
  'FAILED': 'FAILED',
}
const API_TIMEOUT = 60000
const loaderTimeOut = 30 * 1000; // in ms
const loaderTimeOut_longer = 2 * 60 * 1000; // in ms
export { API_TIMEOUT,OLA_MAP_KEY, dbbackupFolder, fixedurl, version, CONFIG, GyanCastURL, cpm_logo, sloganline, Production, appname, db, baseurl, URL_IMAGE, copyrightText, logoImage, AppVersion, gMap_key, colors_Arr, common_ImagePath, ImageFolderPath, OQAD_TimeConst, KPIFolders, defUploadFolder, VisitorImageFolderPath, VisitorLoginImageFolderPath, FolderForREC, StoreCheckListImagePath, IRSyncStatus, DBName, HierarchyTbls, NonProgramLabel_def, StoreSearch_def, ContractFormImagePath, DevType, TrainingContentFolderPath, ServerDTurl, loaderTimeOut, loaderTimeOut_longer, CoverageImagePath, AddStoreImagePath, visiCoolerImgPath, kycImagePath, LAST_ServerAPI_CALL,GroomingImagePath };