import { defineConfig } from '@umijs/max';
import {
  alarmsRoute,
  commonManagerRoutes,
  forgotPasswordRoute,
  loginRoute,
  managerRouteBase,
  notFoundRoute,
  profileRoute,
} from './config/routes';

export default defineConfig({
  favicons: ['/sgw-logo.png'],
  layout: {
    title: 'SGW',
  },
  routes: [
    loginRoute,
    forgotPasswordRoute,
    alarmsRoute,
    profileRoute,
    {
      name: 'sgw.map',
      icon: 'icon-map',
      path: '/map',
      component: './Slave/SGW/Map',
    },
    {
      name: 'sgw.ships',
      icon: 'icon-ship',
      path: '/ships',
      component: './Slave/SGW/Ship',
      access: 'canEndUser_User',
    },
    {
      name: 'sgw.trips',
      icon: 'icon-trip',
      path: '/trips',
      component: './Slave/SGW/Trip',
    },
    {
      ...managerRouteBase,
      routes: [
        ...commonManagerRoutes,
        {
          name: 'sgw.fishes',
          icon: 'icon-fish',
          path: '/manager/fish',
          routes: [
            {
              path: '/manager/fish',
              component: './Slave/SGW/Manager/Fish',
            },
          ],
        },
        {
          name: 'sgw.zones',
          icon: 'icon-prohibited',
          path: '/manager/area',
          routes: [
            {
              path: '/manager/area',
              component: './Slave/SGW/Manager/Area',
            },
          ],
        },
      ],
    },
    {
      path: '/',
      redirect: '/map',
    },
    notFoundRoute,
  ],
});
