import { SavedObjectAttributes } from 'src/core/public' ; import { SavedObjectMetaData } from '../../../../saved_objects/public' ; import { EmbeddableInput , EmbeddableOutput , IEmbeddable } from './i_embeddable' ; import { ErrorEmbeddable } from './error_embeddable' ; import { IContainer } from '../containers/i_container' ; import { PropertySpec } from '../types' ; import { PersistableState } from '../../../../opensearch_dashboards_utils/common' ; export interface EmbeddableInstanceConfiguration { id : string ; savedObjectId ? : string ; } export interface OutputSpec { [ key ] : PropertySpec ; } /**
 * EmbeddableFactories create and initialize an embeddable instance
 */ export interface EmbeddableFactory < TEmbeddableInput extends EmbeddableInput = EmbeddableInput , TEmbeddableOutput extends EmbeddableOutput = EmbeddableOutput , TEmbeddable extends IEmbeddable < TEmbeddableInput , TEmbeddableOutput > = IEmbeddable < TEmbeddableInput , TEmbeddableOutput > , TSavedObjectAttributes extends SavedObjectAttributes = SavedObjectAttributes > extends PersistableState < EmbeddableInput > { readonly type : string ; /**
     * Returns whether the current user should be allowed to edit this type of
     * embeddable. Most of the time this should be based off the capabilities service, hence it's async.
     */ readonly isEditable : ( ) => Promise < boolean > ; readonly savedObjectMetaData ? : SavedObjectMetaData < TSavedObjectAttributes > ; /**
     * True if is this factory create embeddables that are Containers. Used in the add panel to
     * conditionally show whether these can be added to another container. It's just not
     * supported right now, but once nested containers are officially supported we can probably get
     * rid of this interface.
     */ readonly isContainerType : boolean ; /**
     * Returns a display name for this type of embeddable. Used in "Create new... " options
     * in the add panel for containers.
     */ getDisplayName ( ) : string ; /**
     * If false, this type of embeddable can't be created with the "createNew" functionality. Instead,
     * use createFromSavedObject, where an existing saved object must first exist.
     */ canCreateNew ( ) : boolean ; param partial getDefaultInput ( partial ) : Partial < TEmbeddableInput > ; /**
     * Can be used to request explicit input from the user, to be passed in to `EmbeddableFactory:create`.
     * Explicit input is stored on the parent container for this embeddable. It overrides any inherited
     * input passed down from the parent container.
     */ getExplicitInput ( ) : Promise < Partial < TEmbeddableInput > > ; param savedObjectId param input param parent createFromSavedObject ( savedObjectId , input , parent ? ) : Promise < TEmbeddable | ErrorEmbeddable > ; /**
     * Resolves to undefined if a new Embeddable cannot be directly created and the user will instead be redirected
     * elsewhere.
     *
     * This will likely change in future iterations when we improve in place editing capabilities.
     */ create ( initialInput , parent ? ) : Promise < TEmbeddable | ErrorEmbeddable | undefined > ; }