/// <reference path="./sigApi.PropertyObject.d.ts" />

declare namespace SigApi {
    interface Property {
        /**
         * Returns the value of the Property. The return can be different from Property to Property.
         * 
         * All Properties which can have a unit, covert their actual value with the Unit. (NumberConstants, Datapoints, Schemes)
         * 
         * @returns {any} 
         * * Constants -> The Constant value (converted with the unit if it is a number)
         * * Unit -> The Unit Object which is used
         * * Text -> The Text in the current Language with the formatSymbols beeing resolved
         * * CompositeControl -> The used CompositeControl Oject
         * * FunctionBlock -> The Id of the used Funcitionblock
         * * Event -> A String which describes the Event (ListId:EventName)
         * * Datapoint -> The Value of the Datapoint (converted with the unit)
         * * Color -> The Color in an rgba() format
         * * Scheme -> the result of the getValue() function of the currently active property
         * * Resource -> The resource url as string
         * * Font -> The Font object
         * * Format -> The FormatString which is used
         * * Menu -> The Id of the used menu
         * * AccessNumber -> The AccessNumber which is used
         * * Checkbit -> A boolean Checkbit value
         */
        getValue(): any
        /**
         * Awaits all async operations and returns the value of the Property
         * 
         * @returns {Promise<*>}  Returns a Promise which returns the value of the Property when the Promise has been resolved.
         */
        getValueForced(): Promise<any>
        /**
         * Returns the same as the getValue function with the following exceptions:
         * 
         * @returns {any} The same as getValue() except:
         * * Constants -> The value without unit conversion
         * * Text -> The text int the current Language without the formatSymbols beeing resolved
         * * Datapoint -> The Value of the Datapoint without unit conversion
         * * Color -> The Value of the color in integer representation (bit 31-24:alpha|23-16:red|15-8:green|7-0:blue)
         * * Scheme -> the result of the getUnconvertedValue() function of the currently active property
         */
        getUnconvertedValue(): any
        /**
         * Returns a boolean which indicates if the unitProperty formats Overflow as >>> or as the max Number
         * 
         * @returns {boolean} 
         */
        isIndicateOverflow(): boolean
        /**
         * Returns the roundtype which is used for this property (0 = normalRound, 1 = ceil, 2 = floor)
         * 
         * @returns {number} 
         */
        getRoundType(): number
        /**
         * Returns a boolean which indicated if the value from the property is treated as float or integer 
         * 
         * @returns {boolean}
         */
        isFloatingPoint(): boolean
        /**
         * Returns the description Object of the Property
         * @returns {PropertyObject} Returns the descriptionObject of an property
         */
        getPropertyObject(): PropertyObject
        /**
         * Returns the source id of the Property
         * 
         * @returns {number} The Source ID of the Property (SIG_CONST.PROP_SRC_...)
         */
        getSource(): number
        /**
         * Returns the destination id of the Property
         * 
         * @returns {number} The destination ID of the Property (SIG_CONST.PROP_DEST_...)
         */
        getDestination(): number
        /**
         * Returns the Value of the Reference. Based on the Property Source, the value could have different layouts -> see getPropertyObject()
         *
         * @returns {string|number} The value of the reference
         */
        getReferenceValue(): number | string
        /**
         * Adds an observer callback to the property and returns an id for later removal
         * callback parameter value is dependent on Property (see Property.getValue for more details)
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         * @param {function} callback 
         * @param {boolean} [ignoreOldValueCheck = false] 
         * @returns {string} observerId
         */
        addObserver(callback: (value: any, updatedProperty: Property) => void, ignoreOldValueCheck?: boolean): string
        /**
         * Removes an observer by its id (return value of addObserver)
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         * @param observerId 
         * @returns {boolean}
         */
        removeObserver(observerId: string): boolean
        /**
         * The property will be overloaded with the given datapoint
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         * @param dataPointId 
         * @param selectionGroup 
         * @param targetDatapointId 
         */
        overload(
            dataPointId: number | string,
            selectionGroup?: number,
            targetDatapointId?: number | string
        ): void
        /**
         * The property will start to trigger logic and updates (properties are created in active state)
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         */
        setActive(): void
        /**
         * The property will no longer trigger any logic or updates
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         */
        setInactive(): void
        /**
         * The property will be destroyed to enable garbage collection - all observers will be removed
         * 
         * This Function is only available when property has been created by sigApi.properties.createProperty
         */
        destroy(): void
    }
}
