import faker from 'faker';
import tjanster from './tjanster.js';

faker.locale = 'sv';

const TJANSTER = tjanster.generate();
const STATUSES = ['active', 'follow-up'];
const STEPS = ['Gemensam planering', 'Periodisk rapport', 'Resultatrapport', 'Slutrapport'];

function generateParticipants(amount = 10) {
  const participants = [];

  for (let i = 1; i <= amount; ++i) {
    const participant = {
      id: faker.datatype.uuid(),
      firstName: faker.name.firstName(),
      lastName: faker.name.lastName(),
      status: STATUSES[Math.floor(Math.random() * STATUSES.length)],
      service: TJANSTER[Math.floor(Math.random() * TJANSTER.length)].label,
      nextStep: STEPS[Math.floor(Math.random() * STEPS.length)],
      errandNumber: faker.datatype.number({ min: 100000, max: 999999 }),
      startDate: faker.date.recent(),
      endDate: faker.date.future(),
      handleBefore: faker.date.soon(),
    };
    participants.push({ ...participant, fullName: `${participant.firstName} ${participant.lastName}` });
  }

  console.info('Participants generated...');
  return participants;
}

export default {
  generate: generateParticipants,
};
