// import * as PlussCore from '../../pluss-core/src';
import * as PlussCore from '@plusscommunities/pluss-core-web';
import { values } from './values.config';

export { PlussCore };

const FeatureConfig = {
  key: values.featureKey,
  aliases: values.aliases,
  singularName: values.textSingularName,
  description: 'Submit maintenance requests and track the progress.',
  emptyText: values.textYourRequestHere,
  widgetOptions: [
    {
      key: values.featureKey,
      widget: true,
      main: true,
      hideOnTabNumbers: [],
      optionKey: values.optionOnlyForResidents,
      type: 'toggle',
      inverseOption: false,
      title: 'Limit Admins to Only Submit on Behalf of Primary Users',
      description:
        'This will limit admins to only make a submission on behalf of a primary users in the site. Otherwise they can also submit on behalf of other admins/staff users.',
      defaultNew: false,
      default: false,
    },
  ],
  menu: {
    order: values.menuOrder,
    text: values.textMenuTitle,
    icon: values.menuIcon,
    isFontAwesome: values.isFontAwesomeIcon,
    isSVGIcon: values.isSVGIcon,
    url: values.routeRequestsHub,
    countProps: null,
    visibleExps: {
      type: 'and',
      exps: [
        { type: 'feature', value: values.featureKey },
        {
          type: 'or',
          exps: [
            { type: 'permission', value: values.permissionMaintenanceTracking },
            { type: 'permission', value: values.permissionMaintenanceTypes },
            { type: 'permission', value: values.permissionMaintenanceAssignment },
          ],
        },
      ],
    },
  },
  addUrl: values.routeAddRequest,
  addPermission: values.permissionMaintenanceTracking,
  activities: [
    values.activityMaintenanceJobStatusChanged,
    values.activityAddMaintenanceJob,
    values.activityEditMaintenanceJob,
    values.activityDeleteMaintenanceJob,
  ],
  permissions: [
    {
      displayName: values.textPermissionMaintenanceTracking,
      key: values.permissionMaintenanceTracking,
      hq: false,
    },
    {
      displayName: values.textPermissionManageMaintenanceTypes,
      key: values.permissionMaintenanceTypes,
      hq: false,
    },
    {
      displayName: values.textPermissionManageAssignedMaintenance,
      key: values.permissionMaintenanceAssignment,
      hq: false,
    },
  ],
  hiddenSections: [
    {
      displayName: values.textHiddenSectionMaintenanceRequests,
      key: values.keyHiddenSectionMaintenanceRequests,
      defaultNew: false,
      default: false,
    },
  ],
  moreSections: values.hasMoreSection
    ? [
        {
          displayName: values.textMoreSectionMaintenance,
          featureKey: values.featureKeyMoreSectionMaintenance,
          optionKey: values.optionKeyMoreSectionMaintenance,
          hiddenKey: values.hiddenKeyMoreSectionMaintenance,
          inverseOption: true,
        },
      ]
    : [],
  routes: [
    { path: values.routeRequestsHub, component: values.screenRequestsHub, exact: false },
    { path: values.routeAddRequest, component: values.screenAddJob, exact: true },
    { path: `${values.routeAddRequest}/:jobId`, component: values.screenAddJob, exact: true },
    { path: `${values.routeRequestDetails}/:jobId`, component: values.screenJob, exact: true },
    { path: values.routeRequestTypes, component: values.screenJobTypes, exact: false },
    { path: values.routeAddRequestType, component: values.screenAddJobType, exact: true },
    { path: `${values.routeAddRequestType}/:jobTypeId`, component: values.screenAddJobType, exact: true },
  ],
  env: {
    baseStage: '',
    baseAPIUrl: '',
    baseUploadsUrl: '',
    uploadBucket: '',
    colourBrandingMain: '',
    colourBrandingOff: '',
    colourBrandingApp: '',
    defaultProfileImage: '',
    utcOffset: '',
    hasAvailableNews: false,
    newsHaveTags: true,
    defaultAllowComments: true,
    makeApiKey: '',
    logo: '',
    clientName: '',
  },
  init: (environment) => {
    FeatureConfig.env = environment;
    PlussCore.Config.init(environment);
  },
  notificationPreference: values.notificationPreference,
};
export default FeatureConfig;
