"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hap_types_1 = require("../hap-types");
class Fan {
    sync(service) {
        return {
            id: service.uniqueId,
            type: 'action.devices.types.FAN',
            traits: [
                'action.devices.traits.OnOff',
            ],
            name: {
                defaultNames: [
                    service.serviceName,
                    service.accessoryInformation.Name,
                ],
                name: service.serviceName,
                nicknames: [],
            },
            willReportState: true,
            deviceInfo: {
                manufacturer: service.accessoryInformation.Manufacturer,
                model: service.accessoryInformation.Model,
            },
            customData: {
                aid: service.aid,
                iid: service.iid,
                instanceUsername: service.instance.username,
                instanceIpAddress: service.instance.ipAddress,
                instancePort: service.instance.port,
            },
        };
    }
    query(service) {
        return {
            on: service.characteristics.find(x => x.type === hap_types_1.Characteristic.On).value,
            online: true,
        };
    }
    execute(service, command) {
        if (!command.execution.length) {
            return { characteristics: [] };
        }
        switch (command.execution[0].command) {
            case ('action.devices.commands.OnOff'): {
                return {
                    characteristics: [{
                            aid: service.aid,
                            iid: service.characteristics.find(x => x.type === hap_types_1.Characteristic.On).iid,
                            value: command.execution[0].params.on,
                        }],
                };
            }
        }
    }
}
exports.Fan = Fan;
//# sourceMappingURL=fan.js.map