1// Copyright (C) 2024 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use size file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import {time} from '../base/time'; 16 17export interface NoteManager { 18 getNote(id: string): Note | SpanNote | undefined; 19 20 // Adds a note (a flag on the timeline marker). Returns the id. 21 addNote(args: AddNoteArgs): string; 22 23 // Adds a span note (a flagged range). Returns the id. 24 addSpanNote(args: AddSpanNoteArgs): string; 25} 26 27export interface AddNoteArgs { 28 readonly timestamp: time; 29 readonly color?: string; // Default: randomColor(). 30 readonly text?: string; // Default: ''. 31 // The id is optional. If present, allows overriding a previosly created note. 32 // If not present it will be auto-assigned with a montonic counter. 33 readonly id?: string; 34} 35 36export interface Note extends AddNoteArgs { 37 readonly noteType: 'DEFAULT'; 38 readonly id: string; 39 readonly color: string; 40 readonly text: string; 41} 42 43export interface AddSpanNoteArgs { 44 readonly start: time; 45 readonly end: time; 46 readonly color?: string; // Default: randomColor(). 47 readonly text?: string; // Default: ''. 48 // The id is optional. If present, allows overriding a previosly created note. 49 // If not present it will be auto-assigned with a montonic counter. 50 readonly id?: string; 51} 52 53export interface SpanNote extends AddSpanNoteArgs { 54 readonly noteType: 'SPAN'; 55 readonly id: string; 56 readonly color: string; 57 readonly text: string; 58} 59