const selectedClass = {
  id: btoa('SchoolClassNode:selectedClassId'),
  name: 'Moordale',
  readOnly: false,
  code: 'XXXX',
  members: [],
};

let idIndex = 0;

function* idGenerator(entity) {
  while (true) {
    console.log(`generating id for ${entity}, ${idIndex}`);
    idIndex += 1;
    yield btoa(`${entity}:${idIndex}`);
  }
}

const classMemberIdIterator = idGenerator('ClassMemberNode');
const chapterIdIterator = idGenerator('ChapterNode');
const moduleIdIterator = idGenerator('ModuleNode');
const contentBlockIdIterator = idGenerator('ContentBlockNode');

const getClassMemberId = () => classMemberIdIterator.next().value;
const getChapterId = () => chapterIdIterator.next().value;
const getModuleId = () => moduleIdIterator.next().value;
const getContentBlockId = () => contentBlockIdIterator.next().value;

export default {
  UUID: () => '123-456-789',
  GenericStreamFieldType: () => ({type: 'text_block', value: 'Generic Stream Field Type'}),
  DateTime: () => '2021-01-01Z10:01:23',
  SnapshotNode: () => ({
    chapters: [],
    title: 'MockSnapshotTitle',
    metaTitle: 'MockSnapshotMetaTitle',
  }),
  ChapterNode: () => ({
    slug: 'chapter-slug',
    id: getChapterId(),
    title: 'chapter-title',
    description: 'chapter-description',

  }),
  ContentBlockNode: () => ({
    contents: [],
    title: 'content-block-title',
    slug: 'content-block-slug',
    userCreated: false,
    type: '',
    id: getContentBlockId(),
  }),
  AssignmentNode: () => ({
    id: 'assignment-id',
    title: 'Assignment Title',
    assignment: 'Assignment Text',
    solution: 'Assignment Solution',
  }),
  PrivateUserNode: () => ({
    readOnly: false,
    onboardingVisited: true,
    selectedClass,
    schoolClasses: {
      edges: [
        {node: selectedClass},
      ],
    },
    recentModules: {
      edges: [],
    },
  }),
  SchoolClassNode: () => ({
    readOnly: false,
  }),
  ClassMemberNode: () => ({
    firstName: 'First Name',
    lastName: 'Last Name',
    active: true,
    isTeacher: false,
    isMe: false,
    id: getClassMemberId(),
  }),
  ModuleNode: () => ({
    title: 'Module Title',
    slug: 'some slug',
    metaTitle: 'Meta Title',
    heroImage: '',
    teaser: '',
    intro: '',
    assignments: {nodes: []},
    objectiveGroups: [],
    id: getModuleId(),
  }),
  TopicNode: () => ({
    modules: {
      edges: [],
    },
  }),
  RoomNode: () => ({
    title: 'A Room',
    entryCount: 3,
    appearance: 'blue',
    description: 'A Room description',
    schoolClass: {
      id: 'selectedClassId',
    },
  }),
  RoomEntryNode: () => ({
    title: 'A Room Entry',
    contents: [],
  })
};
