import { mergePartially, NestedPartial } from 'merge-partially';
import { faker } from '@faker-js/faker';

export interface IUser {
  id: string;
  name?: string;
  firstName?: string;
  lastName?: string;
  email?: string;
  city?: string;
  state?: string;
  country?: string;
  biography?: string;
  online?: boolean;
  musician?: boolean;
  photo_url?: string;
}

export default function makeFakeUser(overrides?: NestedPartial<IUser>): IUser {
  const fname: string = faker.person.firstName();
  const lname: string = faker.person.lastName();
  return mergePartially.deep(
    {
      id: faker.string.uuid(),
      email: faker.internet.email(),
      firstName: fname,
      lastName: lname,
      name: fname + ' ' + lname,
    },
    overrides
  );
}
