# Reference: submit context

Available in code:

# Description of Asset object

 type Asset = {
    
    // Unique asset ID
    assetId: string,

    // Display name of the asset
    title: string,

    // Under what name file was uploaded to FTP (without extension)
    uploadedBasename: string,

    // Asset type
    type: string,

    // Asset metadata
    metadata: {[prop:string]: any},

    // List of files included in the asset
    files: AssetFile[],

    // Main asset file
    get mainFile(): AssetFile | undefined,

    // Statuses assigned to the asset
    markers: AssetMarker[],
        
    // Add a new status to the asset
    // markerName - service name of status
    // subject - related microstock, if required
    // data - bound data to the status (optional)
    addMarker: (markerName: string, subject: string | null, data?: object) => Promise<void>

    // Asset contains assigned result
    processed: boolean,        

    // Add a message to the asset log
    log: (message: string) => void,

    // Add a warning to the asset log
    warn: (message: string) => void,
    
    // Set the progress value for the current block
    // progress - value within 0..1
    // prepare - "preparing" status
    progress: (progress: number, prepare: boolean) => void,

    // Assign result to asset - error
    markFailed: (message: string) => void,

    // Assign result to asset - file not found
    markNotFound: () => void,

    // Assign result to asset - processed successfully
    // data - an object that is written to the status
    markDone: (data: object) => void,

    // Assign result to asset - user not authorized
    markUnauthorized: () => void,

    // Assign result to asset - file will be processed later
    // Used when it is necessary to make a script that
    // switches between pages
    markPostponed: () => void,
}

type AssetFile =  {

    // File name
    name: string,

    // Role of file in asset
    role: string

    // Get file content
    getBlob: () => Promise<Blob>
}

type AssetMarker = {
        
    // Service name of the marker
    name: string,
    
    // Related microstock
    subject: string | null,

    // Data written to the status
    data: any

}

# Description of the submitContext object

type SubmitContext = {

    // Submission process settings
    settings: {[prop: string]: any},

    // Dictionaries passed to the submit process
    dictionaries: object

}

# Description of the window.imshost object

type ImsHost = {
    
    // Load an asset from the program by its ID
    loadAsset(assetId: string): Promise<Asset>,
    
    // Get the common state of the submit process
    getProcessSharedState(): Promise<{
        [step: string]: {[prop:string]: any}
    }>
    
}