import { generatePath } from 'react-router-dom';
import { getNavigationValue } from '@brojs/cli';

import { Order } from '../models/landing';

const getFullUrls = (url: string) =>
  `${getNavigationValue('dry-wash.main')}${url}`;

export const URLs = {
  landing: {
    url: getNavigationValue('dry-wash.main'),
    getUrl() {
      return this.url;
    },
  },
  orderCreate: {
    url: getFullUrls(getNavigationValue('dry-wash.order.create')),
    getUrl() {
      return this.url;
    },
  },
  orderView: {
    url: getFullUrls(getNavigationValue('dry-wash.order.view')),
    getUrl(orderId: Order.Id) {
      return generatePath(this.url, { orderId });
    },
  },
  armMaster: {
    url: getNavigationValue('dry-wash.arm.master'),
    isOn: Boolean(getNavigationValue('dry-wash.arm.master')),
  },
  armOrder: {
    url: getNavigationValue('dry-wash.arm.order'),
    isOn: Boolean(getNavigationValue('dry-wash.arm.order')),
  },
  armBase: {
    url: getFullUrls(getNavigationValue('dry-wash.arm')),
    isOn: Boolean(getNavigationValue('dry-wash.arm')),
  },
};
