{"version":3,"sources":["src/sdk/VoiceProfileResult.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,uBAAuB,EAGvB,kBAAkB,EAClB,YAAY,EACf,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,gBAAgB,CAAS;gBAEd,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM;IAU3D,IAAW,MAAM,IAAI,YAAY,CAEhC;IAED,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;CACJ;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,uBAAuB;IAExE,OAAO;IAIP;;;;;;;OAOG;WACW,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,+BAA+B;CAUxF","file":"VoiceProfileResult.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\n/* eslint-disable max-classes-per-file */\nimport { CancellationErrorCodePropertyName } from \"../common.speech/Exports.js\";\nimport { Contracts } from \"./Contracts.js\";\nimport {\n    CancellationDetailsBase,\n    CancellationErrorCode,\n    CancellationReason,\n    PropertyCollection,\n    ResultReason\n} from \"./Exports.js\";\n\n/**\n * Output format\n * @class VoiceProfileResult\n */\nexport class VoiceProfileResult {\n    private privReason: ResultReason;\n    private privProperties: PropertyCollection;\n    private privErrorDetails: string;\n\n    public constructor(reason: ResultReason, statusText: string) {\n        this.privReason = reason;\n        this.privProperties = new PropertyCollection();\n        if (reason === ResultReason.Canceled) {\n            Contracts.throwIfNullOrUndefined(statusText, \"statusText\");\n            this.privErrorDetails = statusText;\n            this.privProperties.setProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.ServiceError]);\n        }\n    }\n\n    public get reason(): ResultReason {\n        return this.privReason;\n    }\n\n    public get properties(): PropertyCollection {\n        return this.privProperties;\n    }\n\n    public get errorDetails(): string {\n        return this.privErrorDetails;\n    }\n}\n\n/**\n * @class VoiceProfileCancellationDetails\n */\nexport class VoiceProfileCancellationDetails extends CancellationDetailsBase {\n\n    private constructor(reason: CancellationReason, errorDetails: string, errorCode: CancellationErrorCode) {\n        super(reason, errorDetails, errorCode);\n    }\n\n    /**\n     * Creates an instance of VoiceProfileCancellationDetails object for the canceled VoiceProfileResult.\n     * @member VoiceProfileCancellationDetails.fromResult\n     * @function\n     * @public\n     * @param {VoiceProfileResult} result - The result that was canceled.\n     * @returns {VoiceProfileCancellationDetails} The cancellation details object being created.\n     */\n    public static fromResult(result: VoiceProfileResult): VoiceProfileCancellationDetails {\n        const reason = CancellationReason.Error;\n        let errorCode: CancellationErrorCode = CancellationErrorCode.NoError;\n\n        if (!!result.properties) {\n            errorCode = (CancellationErrorCode as any)[result.properties.getProperty(CancellationErrorCodePropertyName, CancellationErrorCode[CancellationErrorCode.NoError])]; //eslint-disable-line\n        }\n\n        return new VoiceProfileCancellationDetails(reason, result.errorDetails, errorCode);\n    }\n}\n"]}