import { peopleAvailableColumnDefinitions } from '@/people/constants/peopleAvailableColumnDefinitions';
import {
  Company,
  Person,
  View,
  ViewField,
  ViewType,
} from '~/generated/graphql';

type RequiredAndNotNull<T> = {
  [P in keyof T]-?: Exclude<T[P], null | undefined>;
};

type MockedPerson = RequiredAndNotNull<
  Pick<
    Person,
    | 'id'
    | 'firstName'
    | 'lastName'
    | 'displayName'
    | 'linkedinUrl'
    | 'xUrl'
    | 'jobTitle'
    | 'email'
    | '__typename'
    | 'phone'
    | 'city'
    | 'avatarUrl'
    | '_activityCount'
    | 'createdAt'
  > & {
    company: Pick<Company, 'id' | 'name' | 'domainName' | '__typename'>;
  }
>;

export const mockedPeopleData: MockedPerson[] = [
  {
    id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
    __typename: 'Person',
    firstName: 'Alexandre',
    lastName: 'Prot',
    displayName: 'Alexandre Prot',
    email: 'alexandre@qonto.com',
    linkedinUrl: 'https://www.linkedin.com/in/alexandreprot/',
    xUrl: 'https://twitter.com/alexandreprot',
    avatarUrl:
      'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAADygAwAEAAAAAQAAADwAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIADwAPAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoa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VPiM7ZW2iCejyHc34Ivyj8zWpmdtqkiq8QfoxYe3bGfryKbNb8HEzIwyUYKCQCOnbP0IPasPwtKb+3JlcvICUck8hgSVYAcLkFSMelSya3LbL5U8Bl28K67efTcD0P0rjm7zZ3UtIocsZEQhDEu5IXrnaTks+Scnqa3LWBY1EaDCqMDkn9TXCSapNBIb+ZR0ZRGSQArY+Vf8Aa4GD9a6XRvE9tdYCuFc/8s3IVvw7MPcVtRStcwrybZuilpopa2Oc/9Ly0J/kUBaVTS1sZl7SNWmtH8yB9pPBBGVYZzhl7j9R611T/ERmHzWqFvXzDt+uNuevb9a4eiolCMtyozlHYu6zrE12QZSAF+6ijCjPfHc+5/Ss3bUlFUkkrITbbuze8P8Aiqe0IDMZIsjcjEsQOh8ticqcduhx26163FKGUMpyGAII6EEZBrwQmvX/AAFIXso93O0ug/3Vdgo/KmI//9k=',
    jobTitle: 'CEO',
    company: {
      id: '5c21e19e-e049-4393-8c09-3e3f8fb09ecb',
      name: 'Qonto',
      domainName: 'qonto.com',
      __typename: 'Company',
    },
    phone: '06 12 34 56 78',
    _activityCount: 1,
    createdAt: '2023-04-20T13:20:09.158312+00:00',

    city: 'Paris',
  },
  {
    id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
    __typename: 'Person',
    firstName: 'John',
    lastName: 'Doe',
    displayName: 'John Doe',
    linkedinUrl: 'https://www.linkedin.com/in/johndoe/',
    xUrl: 'https://twitter.com/johndoe',
    avatarUrl: '',
    jobTitle: 'CTO',
    email: 'john@linkedin.com',
    company: {
      id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6e',
      name: 'LinkedIn',
      domainName: 'linkedin.com',
      __typename: 'Company',
    },
    phone: '06 12 34 56 78',
    _activityCount: 1,
    createdAt: '2023-04-20T13:20:09.158312+00:00',

    city: 'Paris',
  },
  {
    id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6f',
    __typename: 'Person',
    firstName: 'Jane',
    lastName: 'Doe',
    displayName: 'Jane Doe',
    linkedinUrl: 'https://www.linkedin.com/in/janedoe/',
    xUrl: 'https://twitter.com/janedoe',
    avatarUrl: '',
    jobTitle: 'Investor',
    email: 'jane@sequoiacap.com',
    company: {
      id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6g',
      name: 'Sequoia',
      domainName: 'sequoiacap.com',
      __typename: 'Company',
    },
    phone: '06 12 34 56 78',
    _activityCount: 1,
    createdAt: '2023-04-20T13:20:09.158312+00:00',

    city: 'Paris',
  },
  {
    id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6h',
    __typename: 'Person',
    firstName: 'Janice',
    lastName: 'Dane',
    displayName: 'Janice Dane',
    email: 'janice@facebook.com',
    linkedinUrl: 'https://www.linkedin.com/in/janicedane/',
    xUrl: 'https://twitter.com/janicedane',
    avatarUrl: '',
    jobTitle: 'CEO',
    company: {
      id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6i',
      name: 'Facebook',
      domainName: 'facebook.com',
      __typename: 'Company',
    },
    phone: '06 12 34 56 78',
    _activityCount: 2,
    createdAt: '2023-04-20T13:20:09.158312+00:00',

    city: 'Paris',
  },
];

export const mockedPersonViews: View[] = [
  {
    __typename: 'View',
    id: 'afd7737a-bf1d-41a3-8863-c277b56a657b',
    name: 'All people',
    objectId: 'person',
    type: ViewType.Table,
  },
  {
    __typename: 'View',
    id: '89bb825c-171e-4bcc-9cf7-43448d6fb230a',
    name: 'View example 1',
    objectId: 'person',
    type: ViewType.Table,
  },
];

export const mockedPersonViewFields = peopleAvailableColumnDefinitions.map<
  Omit<ViewField, 'view'>
>((viewFieldDefinition) => ({
  __typename: 'ViewField',
  name: viewFieldDefinition.name,
  index: viewFieldDefinition.index,
  isVisible: true,
  key: viewFieldDefinition.key,
  objectId: 'person',
  size: viewFieldDefinition.size,
  viewId: 'afd7737a-bf1d-41a3-8863-c277b56a657b',
}));
