export interface Style {
  display: string;
  fontFamily: string;
  fontSize: string;
  fontStyle: string;
  fontWeight: string;
  color: string;
}

export const defaultStyle: Style = {
  display: 'inline-block',
  fontFamily: 'sans-serif',
  fontSize: '12pt',
  fontStyle: 'regular',
  fontWeight: 'light',
  color: 'white',
};

export interface TextFragment {
  body: string;
  style?: Style;
}

export interface ChapterFile {
  path: string;
  hasStyle: boolean;
}

export interface ChapterView {
  id: number;
  min: number;
  max: number;
  chapters: ChapterFile[];
}

export interface Resource {
  id: number;
  hash: string;
  slug: string;
  startsAt: number;
  endsAt: number;
  url?: string;
  fetch: (from: number, to: number) => Promise<ChapterView>;
}

export type ResourceMeta = Omit<Resource, 'fetch'>;
