import { Hashcodes } from 'polar-shared/src/util/Hashcodes' ; import { TextHighlight } from './TextHighlight' ; import { IText } from 'polar-shared/src/metadata/Text' ; import { IRect } from 'polar-shared/src/util/rects/IRect' ; import { ISODateTimeStrings } from 'polar-shared/src/metadata/ISODateTimeStrings' ; import { ITextHighlight } from "polar-shared/src/metadata/ITextHighlight" ; import { AnnotationOrder , HighlightColor } from "polar-shared/src/metadata/IBaseHighlight" ; import { ITextRect } from "polar-shared/src/metadata/ITextRect" ; import { Arrays } from "polar-shared/src/util/Arrays" ; export class TextHighlightRecords { return public static create ( rects , textSelections , text , color = 'yellow' , order = undefined ) { const id = Hashcodes . createID ( rects . length > 0 ? rects : text ) ; const created = ISODateTimeStrings . create ( ) ; const lastUpdated = created ; const textHighlight = new TextHighlight ( { id , guid : id , created , lastUpdated , rects : Arrays . toDict ( rects ) , textSelections : Arrays . toDict ( textSelections ) , text , images : { } , notes : { } , questions : { } , flashcards : { } , color , order } ) ; return { id , value : textHighlight } ; } } export interface TextHighlightRecord { readonly id : string ; readonly value : ITextHighlight ; }