import getUrls from 'config/urls';
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',
  },
};

const { URL_GET_USER, URL_CORE_FINGAP, URL_CRM_GRAPHQL } = getUrls();

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