/// <reference path="./sigApi.ApiBase.d.ts" />
/// <reference path="./sigApi.SessionVariableImage.d.ts" />
/// <reference path="./sigApi.ProgressCallbackObject.d.ts" />

declare namespace SigApi {
    interface ApiSessionVariableManager extends ApiBase {
        /**
         * Fetches values of session variables and returns {@link SessionVariableImage}
         * 
         * @param {string} [headertext = ''] some text, written at the beginning of the file
         * @param {number|string|bigInt} [filterInclude = 0] bitmask for all entries that should be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number|string|bigInt} [filterExclude = 0] bitmask for all entries that should not be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number} [filterBase = 10] the base for filterInclude and filterExclude, if these are given as a string (e.g. 2 or 10 or 16)
         * @returns {Promise} 
         * resolve: ({@link SessionVariableImage})
         * 
         * reject: ({{number} id, {number} status, {string} errortxt}[])
         * 
         * Possible statuscodes on reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0003 -> ERROR_INVALID_LASALID -> The Datapoint is known to the DS, but its was not found in the Lasal Class2 Project
         * * 0x0005 -> ERROR_ACCESS_DENIED -> The current user is not allowed to interact with the dp (This error should not show, up because it means the accessCheck in the RT passed, but fails in the DS -> please report this to a developer)
         * * 0x0007 -> ERROR_COMMUNICATION -> The request was not successfully send to the DS, therefore the promise timed out
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> The request has been denied, because the current user is not allowed to interact with that datapoint
         * * 0x001C -> ERROR_INSUFFICIENT_CHECKBITS -> The request has been denied, because the checkbit of the datapoint evaluates to false
         */
        createImage(
            headertext?: string,
            filterInclude?: number,
            filterExclude?: number,
            filterBase?: number
        ): Promise<SessionVariableImage>
        /**
         * Writes {@link SessionVariableImage} to a file
         * 
         * @param {SessionVariableImage} image a image returned by createImage/readImage
         * @param {string} dpne drive, path, name and extension of the file, that should be written (e.g. 'c:\\temp\\test.txt')
         * @param {function ({uid: number, progress: number}) : void} [progress] a callback function - invoked, on progress (returns an object with parameter 'uid' and 'progress' (in a resolution of 0,1%))
         * @param {function ({uid: number}) : void} [begin] a callback function - invoked, on begin (returns an object with parameter 'uid')
         * @param {function ({uid: number}) : void} [end] a callback function - invoked, on end (returns an object with parameter 'uid')
         * @returns {Promise}
         * resolve: ({{number} uid})
         * 
         * reject: ({{number} uid, {number} status, {string} errortxt})
         * 
         * Possible status for reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0007 -> ERROR_COMMUNICATION -> no response from dataservice for this request
         * * 0x0010 -> DS_ERROR_INVALID_USER_PARAM -> user parameter is out of range or unknown
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> not enough privileges to write a file
         * * 0x0044 -> ERROR_INVALID_PARAMETER -> invalid parameter
         * * 0x0106 -> DS_ERROR_FILE_NAME_INVALID -> filename or directory is invalid
         * * 0x7xxx -> error from operating system (POSIX errno + 0x7000)
         */
        writeImage(
            image: SessionVariableImage,
            dpne: string,
            progress?: (progressCallbackObject: ProgressCallbackObject) => void,
            begin?: (progressCallbackObject: ProgressCallbackObject) => void,
            end?: (progressCallbackObject: ProgressCallbackObject) => void
        ): Promise<{ uid: number }>
        /**
         * Writes values of session variables to a file
         * 
         * @param {string} dpne drive, path, name and extension of the file, that should be written (e.g. 'c:\\temp\\test.txt')
         * @param {string} [headertext = ''] some text, written at the beginning of the file
         * @param {number|string|bigInt} [filterInclude = 0] bitmask for all entries that should be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number|string|bigInt} [filterExclude = 0] bitmask for all entries that should not be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number} [filterBase = 10] the base for filterInclude and filterExclude, if these are given as a string (e.g. 2 or 10 or 16)
         * @param {function ({uid: number, progress: number}) : void} [progress] a callback function - invoked, on progress (returns an object with parameter 'uid' and 'progress' (in a resolution of 0,1%))
         * @param {function ({uid: number}) : void} [begin] a callback function - invoked, on begin (returns an object with parameter 'uid')
         * @param {function ({uid: number}) : void} [end] a callback function - invoked, on end (returns an object with parameter 'uid')
         * @returns {Promise}
         * resolve: ({{number} uid})
         * 
         * reject: ({{number} uid, {number} status, {string} errortxt}) | ({{number} id, {number} status, {string} errortxt}[])
         * 
         * Possible status for reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0007 -> ERROR_COMMUNICATION -> no response from dataservice for this request
         * * 0x0010 -> DS_ERROR_INVALID_USER_PARAM -> user parameter is out of range or unknown
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> not enough privileges to write a file
         * * 0x0106 -> DS_ERROR_FILE_NAME_INVALID -> filename or directory is invalid
         * * 0x7xxx -> error from operating system (POSIX errno + 0x7000)
         */
        write(
            dpne: string,
            headertext?: string,
            filterInclude?: number,
            filterExclude?: number,
            filterBase?: number,
            progress?: (progressCallbackObject: ProgressCallbackObject) => void,
            begin?: (progressCallbackObject: ProgressCallbackObject) => void,
            end?: (progressCallbackObject: ProgressCallbackObject) => void
        ): Promise<{ uid: number }>
        /**
         * Reads {@link SessionVariableImage} from a file
         * 
         * @param {string} dpne drive, path, name and extension of the file, that should be read (e.g. 'c:\\temp\\test.txt')
         * @param {function ({uid: number, progress: number}) : void} [progress] a callback function - invoked, on progress (returns an object with parameter 'uid' and 'progress' (in a resolution of 0,1%))
         * @param {function ({uid: number}) : void} [begin] a callback function - invoked, on begin (returns an object with parameter 'uid')
         * @param {function ({uid: number}) : void} [end] a callback function - invoked, on end (returns an object with parameter 'uid')
         * @returns {Promise} 
         * resolve: ({@link SessionVariableImage})
         * 
         * reject: ({{number} uid, {number} status, {string} errortxt})
         * 
         * Possible status for reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0007 -> ERROR_COMMUNICATION -> no response from dataservice for this request
         * * 0x0010 -> DS_ERROR_INVALID_USER_PARAM -> user parameter is out of range or unknown
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> not enough privileges to reads the content of a file
         * * 0x0101 -> DS_ERROR_FILE_WRONG_CRC -> the crc of file from which the file data should be loaded is not valid
         * * 0x0106 -> DS_ERROR_FILE_NAME_INVALID -> filename or directory is invalid
         * * 0x7xxx -> error from operating system (POSIX errno + 0x7000)
         */
        readImage(
            dpne: string,
            progress?: (progressCallbackObject: ProgressCallbackObject) => void,
            begin?: (progressCallbackObject: ProgressCallbackObject) => void,
            end?: (progressCallbackObject: ProgressCallbackObject) => void
        ): Promise<SessionVariableImage>
        /**
         * Loads session variables from {@link SessionVariableImage}
         * 
         * @param {SessionVariableImage} image a image returned by createImage/readImage
         * @param {number|string|bigInt} [filterInclude = 0] bitmask for all entries that should be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number|string|bigInt} [filterExclude = 0] bitmask for all entries that should not be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number} [filterBase = 10] the base for filterInclude and filterExclude, if these are given as a string (e.g. 2 or 10 or 16)
         * @returns {Promise}
         * resolve: ({{number} id, {number|string} value}[])
         * 
         * reject: ({{number} uid, {number} status, {string} errortxt}) | ({{number} id, {number} status, {string} errortxt}[])
         * 
         * Possible statuscodes on reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0003 -> ERROR_INVALID_LASALID -> The Datapoint is known to the DS, but its was not found in the Lasal Class2 Project
         * * 0x0005 -> ERROR_ACCESS_DENIED -> The current user is not allowed to interact with the dp (This error should not show, up because it means the accessCheck in the RT passed, but fails in the DS -> please report this to a developer)
         * * 0x0006 -> ERROR_INVALID_LIMIT -> The value does not match limit (limitLow, limitHigh) constraints
         * * 0x0007 -> ERROR_COMMUNICATION -> The request was not successfully send to the DS, therefore the promise timed out
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> The request has been denied, because the current user is not allowed to interact with that datapoint
         * * 0x001C -> ERROR_INSUFFICIENT_CHECKBITS -> The request has been denied, because the checkbit of the datapoint evaluates to false
         * * 0x0044 -> ERROR_INVALID_PARAMETER -> invalid parameter
         */
        loadImage(
            image: SessionVariableImage,
            filterInclude?: number,
            filterExclude?: number,
            filterBase?: number
        ): Promise<{ id: number, value: string | number } | { id: number, value: string | number }[]>
        /**
         * Loads session variables from a file
         * 
         * @param {string} dpne drive, path, name and extension of the file, that should be read (e.g. 'c:\\temp\\test.txt')
         * @param {number|string|bigInt} [filterInclude = 0] bitmask bitmask for all entries that should not be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))for all entries that should be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number|string|bigInt} [filterExclude = 0] bitmask for all entries that should not be contained (bits for each datapoint can set in VisualDesigner -> Datapoints - Properties - 'User defined bits') (e.g. 123456 or 'FFFFFFFFFFFFFFFF' or bigInt(11446744073709551614))
         * @param {number} [filterBase = 10] the base for filterInclude and filterExclude, if these are given as a string (e.g. 2 or 10 or 16)
         * @param {function ({uid: number, progress: number}) : void} [progress] a callback function - invoked, on progress (returns an object with parameter 'uid' and 'progress' (in a resolution of 0,1%))
         * @param {function ({uid: number}) : void} [begin] a callback function - invoked, on begin (returns an object with parameter 'uid')
         * @param {function ({uid: number}) : void} [end] a callback function - invoked, on end (returns an object with parameter 'uid')
         * @returns {Promise}
         * resolve: ({{number} id, {number|string} value}[])
         * 
         * reject: ({{number} uid, {number} status, {string} errortxt}) | ({{number} id, {number} status, {string} errortxt}[])
         * 
         * Possible status for reject:
         * * 0x0001 -> ERROR_UNKNOWN -> Unknown error: see errortext for details
         * * 0x0003 -> ERROR_INVALID_LASALID -> The Datapoint is known to the DS, but its was not found in the Lasal Class2 Project
         * * 0x0005 -> ERROR_ACCESS_DENIED -> The current user is not allowed to interact with the dp (This error should not show, up because it means the accessCheck in the RT passed, but fails in the DS -> please report this to a developer)
         * * 0x0006 -> ERROR_INVALID_LIMIT -> The value does not match limit (limitLow, limitHigh) constraints
         * * 0x0007 -> ERROR_COMMUNICATION -> no response from dataservice for this request
         * * 0x0010 -> DS_ERROR_INVALID_USER_PARAM -> user parameter is out of range or unknown
         * * 0x0012 -> ERROR_INSUFFICIENT_PRIVILEGES -> not enough privileges to reads the content of a file
         * * 0x001C -> ERROR_INSUFFICIENT_CHECKBITS -> The request has been denied, because the checkbit of the datapoint evaluates to false
         * * 0x0101 -> DS_ERROR_FILE_WRONG_CRC -> the crc of file from which the file data should be loaded is not valid
         * * 0x0106 -> DS_ERROR_FILE_NAME_INVALID -> filename or directory is invalid
         * * 0x7xxx -> error from operating system (POSIX errno + 0x7000)
         */
        load(
            dpne: string,
            filterInclude?: number,
            filterExclude?: number,
            filterBase?: number,
            progress?: (progressCallbackObject: ProgressCallbackObject) => void,
            begin?: (progressCallbackObject: ProgressCallbackObject) => void,
            end?: (progressCallbackObject: ProgressCallbackObject) => void
        ): Promise<{ id: number, value: string | number } | { id: number, value: string | number }[]>
    }
}
