import { rest } from 'msw';
const _ = require('radash');

const users = {
  akalinina: {
    displayName: 'Анна Калинина',
    username: 'akalinina',
    department: 'Управление бизнес процессов, технологий и продуктов',
    position: 'Бизнес-аналитик',
    mail: 'akalinina@evoleasing.ru',
    domain: 'EVOLEASING',
    domainName: 'EVOLEASING\\akalinina',
  },
  vchikalkin: {
    username: 'vchikalkin',
    displayName: 'Влад Чикалкин',
    mail: 'vchikalkin@evoleasing.ru',
    domain: 'EVOLEASING',
    department: 'IT',
    position: 'Старший разработчик',
    domainName: 'EVOLEASING\\vchikalkin',
  },
};

export const handlers = [
  rest.get(process.env.NEXT_PUBLIC_URL_GET_USER_DIRECT, (req, res, ctx) => {
    return res(ctx.json(users.vchikalkin));
  }),
  rest.post(process.env.NEXT_PUBLIC_URL_CORE_FINGAP_PROXY, (req, res, ctx) => {
    return res(
      ctx.json({
        sum: _.random(100000, 200000),
        premium: _.random(1000, 10000),
      })
    );
  }),
  // rest.post(process.env.NEXT_PUBLIC_URL_CRM_GRAPHQL_PROXY, (req, res, ctx) => {
  //   return res(ctx.status(503));
  // }),
];
