import faker from 'faker';
import organizations from './organizations.js';
import chooseRandom from './utils/choose-random.util.js';

faker.locale = 'sv';

const ORGANIZATIONS = organizations.generate();
const AUTHORIZATIONS = ['Hantera användare', 'Hantera origisation', 'Hantera ekonomi'];

function generateCurrentUser() {
  return {
    id: faker.datatype.uuid(),
    firstName: faker.name.firstName(),
    lastName: faker.name.lastName(),
    roles: ['Admin'],
    organizations: chooseRandom(ORGANIZATIONS, ORGANIZATIONS.length),
    authorizations: chooseRandom(AUTHORIZATIONS, faker.datatype.number(3)),
  };
}

export default {
  generate: generateCurrentUser,
};
