import { pick } from '@osd/std' ; import { AppCategory } from '../../' ; public export interface ChromeNavLink { /**
     * A unique identifier for looking up links.
     */ readonly id : string ; /**
     * The title of the application.
     */ readonly title : string ; /**
     * The category the app lives in
     */ readonly category ? : AppCategory ; /**
     * The base route used to open the root of an application.
     */ readonly baseUrl : string ; /**
     * The route used to open the  AppBase . defaultPath of an application.
     * If unset, `baseUrl` will be used instead.
      readonly url ? : string ; /**
     * An ordinal used to sort nav links relative to one another for display.
     */ readonly order ? : number ; /**
     * A tooltip shown when hovering over an app link.
     */ readonly tooltip ? : string ; /**
     * A EUI iconType that will be used for the app's icon. This icon
     * takes precedence over the `icon` property.
     */ readonly euiIconType ? : string ; /**
     * A URL to an image file used as an icon. Used as a fallback
     * if `euiIconType` is not provided.
     */ readonly icon ? : string ; /**
     * Settled state between `url`, `baseUrl`, and `active`
     */ readonly href : string ; internalRemarks readonly disabled ? : boolean ; /**
     * Hides a link from the navigation.
     */ readonly hidden ? : boolean ; } public export type ChromeNavLinkUpdateableFields = Partial < Pick < ChromeNavLink , 'disabled' | 'hidden' | 'url' | 'href' > > ; export class NavLinkWrapper { public readonly id : string ; public readonly properties : Readonly < ChromeNavLink > ; constructor ( properties ) { if ( ! properties || ! properties . id ) { throw new Error ( '`id` is required.' ) ; } this . id = properties . id ; this . properties = Object . freeze ( properties ) ; } public update ( newProps ) { newProps = pick ( newProps , [ 'disabled' , 'hidden' , 'url' , 'href' ] ) ; return new NavLinkWrapper ( { ... this . properties , ... newProps } ) ; } }