/**
 * Flowtype definitions for file-format-spec
 * Generated by Flowgen from a Typescript Definition
 * Flowgen v1.11.0
 * @flow
 */

declare var FileFormat: typeof npm$namespace$FileFormat;

declare var npm$namespace$FileFormat: {|
  ProfileType: typeof FileFormat$ProfileType,
  EventType: typeof FileFormat$EventType,
|};
export type FileFormat$Profile =
  | FileFormat$EventedProfile
  | FileFormat$SampledProfile;

export interface FileFormat$File {
  $schema: "https://www.speedscope.app/file-format-schema.json";
  shared: {
    frames: FileFormat$Frame[],
  };
  profiles: FileFormat$Profile[];
  name?: string;
  activeProfileIndex?: number;
  exporter?: string;
}

export interface FileFormat$Frame {
  name: string;
  file?: string;
  line?: number;
  col?: number;
}

declare export var FileFormat$ProfileType: {|
  +EVENTED: "evented", // "evented"
  +SAMPLED: "sampled", // "sampled"
|};

export interface FileFormat$IProfile {
  type: $Values<typeof FileFormat$ProfileType>;
}

export type FileFormat$EventedProfile = {
  type: typeof FileFormat$ProfileType.EVENTED,
  name: string,
  unit: FileFormat$ValueUnit,
  startValue: number,
  endValue: number,
  events: (FileFormat$OpenFrameEvent | FileFormat$CloseFrameEvent)[],
} & FileFormat$IProfile;

declare type FileFormat$SampledStack = number[];

export type FileFormat$SampledProfile = {
  type: typeof FileFormat$ProfileType.SAMPLED,
  name: string,
  unit: FileFormat$ValueUnit,
  startValue: number,
  endValue: number,
  samples: FileFormat$SampledStack[],
  weights: number[],
} & FileFormat$IProfile;

export type FileFormat$ValueUnit =
  | "none"
  | "nanoseconds"
  | "microseconds"
  | "milliseconds"
  | "seconds"
  | "bytes";

declare export var FileFormat$EventType: {|
  +OPEN_FRAME: "O", // "O"
  +CLOSE_FRAME: "C", // "C"
|};

export interface FileFormat$IEvent {
  type: $Values<typeof FileFormat$EventType>;
  at: number;
}

declare type FileFormat$OpenFrameEvent = {
  type: typeof FileFormat$EventType.OPEN_FRAME,
  frame: number,
} & FileFormat$IEvent;

declare type FileFormat$CloseFrameEvent = {
  type: typeof FileFormat$EventType.CLOSE_FRAME,
  frame: number,
} & FileFormat$IEvent;

declare export {};
