import { __esDecorate, __runInitializers } from "tslib";
import { MessagePriority } from "@zwave-js/core";
import { FunctionType, Message, MessageType, expectedResponse, messageTypes, priority, } from "@zwave-js/serial";
import { Bytes } from "@zwave-js/shared";
let SetSerialApiTimeoutsRequest = (() => {
    let _classDecorators = [messageTypes(MessageType.Request, FunctionType.SetSerialApiTimeouts), expectedResponse(FunctionType.SetSerialApiTimeouts), priority(MessagePriority.Controller)];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = Message;
    var SetSerialApiTimeoutsRequest = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            SetSerialApiTimeoutsRequest = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
            __runInitializers(_classThis, _classExtraInitializers);
        }
        constructor(options) {
            super(options);
            this.ackTimeout = options.ackTimeout;
            this.byteTimeout = options.byteTimeout;
        }
        ackTimeout;
        byteTimeout;
        serialize(ctx) {
            this.payload = Bytes.from([
                Math.round(this.ackTimeout / 10),
                Math.round(this.byteTimeout / 10),
            ]);
            return super.serialize(ctx);
        }
    };
    return SetSerialApiTimeoutsRequest = _classThis;
})();
export { SetSerialApiTimeoutsRequest };
let SetSerialApiTimeoutsResponse = (() => {
    let _classDecorators = [messageTypes(MessageType.Response, FunctionType.SetSerialApiTimeouts)];
    let _classDescriptor;
    let _classExtraInitializers = [];
    let _classThis;
    let _classSuper = Message;
    var SetSerialApiTimeoutsResponse = class extends _classSuper {
        static { _classThis = this; }
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
            SetSerialApiTimeoutsResponse = _classThis = _classDescriptor.value;
            if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
            __runInitializers(_classThis, _classExtraInitializers);
        }
        constructor(options) {
            super(options);
            // TODO: Check implementation:
            this.oldAckTimeout = options.oldAckTimeout;
            this.oldByteTimeout = options.oldByteTimeout;
        }
        static from(raw, _ctx) {
            const oldAckTimeout = raw.payload[0] * 10;
            const oldByteTimeout = raw.payload[1] * 10;
            return new this({
                oldAckTimeout,
                oldByteTimeout,
            });
        }
        oldAckTimeout;
        oldByteTimeout;
    };
    return SetSerialApiTimeoutsResponse = _classThis;
})();
export { SetSerialApiTimeoutsResponse };
//# sourceMappingURL=SetSerialApiTimeoutsMessages.js.map