import { v4 as uuid } from 'uuid';

export const userSetting = {
  userData: {
    key: 'user_data',
    type: 'json',
    defaultVal: {},
  },
  userId: {
    key: 'user_id',
    type: 'string',
    defaultVal: '',
  },
  userName: {
    key: 'user_name',
    type: 'string',
    defaultVal: '',
  },
  userPassword: {
    key: 'user_password',
    type: 'string',
    defaultVal: '',
  },
  userToken: {
    key: 'user_token',
    type: 'string',
    defaultVal: '',
  },
  userExtensionPlan: {
    key: 'user_extension_plan',
    type: 'string',
    defaultVal: 'Free',
  },
};

export const indentifySetting = {
  appUuid: {
    key: 'indentify_app_uuid',
    type: 'string',
    defaultVal: uuid(),
  },
  profileId: {
    key: 'indentify_profile_id',
    type: 'string',
    defaultVal: '',
  },
  databaseId: {
    key: 'indentify_database_id',
    type: 'string',
    defaultVal: uuid(),
  },
  browserIp: {
    key: 'indentify_browser_ip',
    type: 'string',
    defaultVal: '',
  },
  browserAgent: {
    key: 'indentify_browser_agent',
    type: 'string',
    defaultVal: '',
  },
  browserPlatform: {
    key: 'indentify_browser_platform',
    type: 'string',
    defaultVal: '',
  },
  browserName: {
    key: 'indentify_browser_name',
    type: 'string',
    defaultVal: '',
  },
  fingerprintId: {
    key: 'indentify_browser_fingerprint',
    type: 'string',
    defaultVal: '',
  },
};

export const platformSetting = {
  saveHistoryPrint: {
    key: 'save_history_print',
    type: 'json',
    defaultVal: {
      shopee: false,
      lazada: false,
      tiktok: false,
    },
  },
};

export const appSetting = {
  useShopManager: {
    key: 'use_shopmanager',
    type: 'bool',
    defaultVal: false,
  },
  usePopup: {
    key: 'use_popup',
    type: 'bool',
    defaultVal: false,
  },
  betaMode: {
    key: 'beta_mode',
    type: 'bool',
    defaultVal: false,
  },
  workerFetchService: {
    key: 'worker_fetch_service',
    type: 'bool',
    defaultVal: true,
  },
  readNotifyId: {
    key: 'notify_read_id',
    type: 'string',
    defaultVal: '',
  },
  extensionInfo: {
    key: 'config_extension_data',
    type: 'json',
    defaultVal: {},
  },
  platformShopConfig: {
    key: 'config_platform_shop_data',
    type: 'json',
    defaultVal: {
      shopee: {},
      lazada: {},
      tiktok: {},
    },
  },
  toggleMenu: {
    key: 'toggle_menu',
    type: 'bool',
    defaultVal: false,
  },
  badWord: {
    key: 'bard_word_v4',
    type: 'json',
    defaultVal: ['chuyển khoản', 'stk', 'lazada', 'tiktok'],
  },
};

export const shopeeSetting = {
  shopeeAffId: {
    key: 'shopee_aff_id',
    type: 'string',
    defaultVal: '',
  },
  shopeeAffToken: {
    key: 'shopee_aff_token',
    type: 'string',
    defaultVal: '',
  },
  shopeeAffSubId: {
    key: 'shopee_aff_subid',
    type: 'json',
    defaultVal: ['', '', '', '', ''],
  },
  shopeeAffContent: {
    key: 'shopee_aff_content_v2',
    type: 'string',
    defaultVal: ['Gửi bạn sản phẩm', '- [PRODUCT_NAME]', '👉 [SHORT_LINK]'].join('\n'),
  },
  shopeeShopWarehouse: {
    key: 'shopee_shop_warehouse',
    type: 'json',
    defaultVal: [],
  },
  shopeeShopId: {
    key: 'shopee_shop_id',
    type: 'string',
    defaultVal: '',
  },
  shopeeShopName: {
    key: 'shopee_shop_name',
    type: 'string',
    defaultVal: '',
  },
  shopeeShopImage: {
    key: 'shopee_shop_image',
    type: 'string',
    defaultVal: '',
  },
  shopeeShopRef: {
    key: 'shopee_shop_ref',
    type: 'string',
    defaultVal: '',
  },
  shopeeShopSpcCds: {
    key: 'shopee_shop_set_spccds',
    type: 'string',
    defaultVal: '',
  },
  shopeeShopSpcf: {
    key: 'shopee_shop_set_spcf',
    type: 'string',
    defaultVal: '',
  },
  shopeeConfigProduct: {
    key: 'shopee_config_product_v2',
    type: 'json',
    defaultVal: {
      spyDetail: true,
      spySearch: true,
      spyAds: true,
      showShopName: false,
      addCloneBtn: false,
    },
  },
  cloneProductEditData: {
    key: 'clone_product_change_v2',
    type: 'json',
    defaultVal: {},
  },
  shopeeFlashsaleCampaignAuto: {
    key: 'shopee_flashsale_campaign_auto',
    type: 'bool',
    defaultVal: false,
  },
  shopeeFlashsaleSchedulerAuto: {
    key: 'shopee_flashsale_scheduler_auto',
    type: 'bool',
    defaultVal: true,
  },
};

export const tiktokSetting = {
  tiktokShopId: {
    key: 'tiktok_shop_id',
    type: 'string',
    defaultVal: '',
  },
  tiktokShopName: {
    key: 'tiktok_shop_name',
    type: 'string',
    defaultVal: '',
  },
};

export const lazadaSetting = {
  lazadaShopId: {
    key: 'lazada_shop_id',
    type: 'string',
    defaultVal: '',
  },
  lazadaShopName: {
    key: 'lazada_shop_name',
    type: 'string',
    defaultVal: '',
  },
};

export const affiliateSetting = {
  affTrackingShopeeTime: {
    key: 'tracker_id_sp_last_time',
    type: 'number',
    defaultVal: 0,
  },
  affTrackingLazadaTime: {
    key: 'tracker_id_lz_last_time',
    type: 'number',
    defaultVal: 0,
  },
  affTrackingTikiTime: {
    key: 'tracker_id_tk_last_time',
    type: 'number',
    defaultVal: 0,
  },
};

export const allSetting = {
  ...userSetting,
  ...appSetting,
  ...shopeeSetting,
  ...affiliateSetting,
  ...indentifySetting,
};
