{"size": 1436, "ext": "js", "max_stars_repo_path": "static/js/flow/collectionTypes.js", "max_stars_repo_name": "mitodl/odl-video-service", "max_stars_repo_stars_event_min_datetime": "2017-08-19T02:00:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-11T20:53:37.000Z", "max_issues_repo_path": "static/js/flow/collectionTypes.js", "max_issues_repo_name": "mitodl/odl-video-service", "max_issues_repo_issues_event_min_datetime": "2017-04-18T15:46:40.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-23T17:47:03.000Z", "max_forks_repo_path": "static/js/flow/collectionTypes.js", "max_forks_repo_name": "mitodl/odl-video-service", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 915, "max_forks_count": null, "avg_line_length": 22.0923076923, "max_line_length": 55, "alphanum_fraction": 0.6824512535}
// @flow

import type { Video } from './videoTypes'

export type CollectionListItem = {
  key:                string,
  title:              string,
  description:        ?string,
  view_lists:         Array<string>,
  admin_lists:        Array<string>,
  is_logged_in_only:  boolean,
  video_count:        number,
  edx_course_id:      ?string
};

export type Collection = CollectionListItem & {
  videos:              Array<Video>,
  is_admin:            boolean,
  is_edx_course_admin: boolean,
};

export type CollectionList = Array<CollectionListItem>;

export type CollectionFormState = {
  key: ?string,
  title: ?string,
  description: ?string,
  viewChoice: string,
  viewLists: ?string,
  adminChoice: string,
  adminLists: ?string,
  edxCourseId: ?string,
};

export type CollectionValidation = {
  title?:  string,
  view_lists?: string,
  admin_lists?: string,
  edx_course_id?: string
}

export type CollectionUiState = {
  newCollectionForm: CollectionFormState,
  editCollectionForm: CollectionFormState,
  isNew: boolean,
  selectedVideoKey: ?string,
  errors?: CollectionValidation
};

export type CollectionsPage = {
  collections: Array<Collection>,
  status: string,
}

export type CollectionsPagination = {
  count: number,
  currentPage: number,
  currentPageData?: CollectionsPage,
  numPages?: number,
  pages: {
    [string|number]: CollectionsPage,
  },
  setCurrentPage?: (nextCurrentPage: number) => void,
}
