"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateDeviceStatusUseCase = void 0;
const not_found_error_1 = require("../../../domain/errors/not-found-error");
class UpdateDeviceStatusUseCase {
    deviceRepository;
    constructor(deviceRepository) {
        this.deviceRepository = deviceRepository;
    }
    async execute(id, input) {
        const device = await this.deviceRepository.findById(id);
        if (!device) {
            throw new not_found_error_1.NotFoundError('Device', id);
        }
        const updated = device.updateStatus(input.status);
        return this.deviceRepository.update(updated);
    }
}
exports.UpdateDeviceStatusUseCase = UpdateDeviceStatusUseCase;
//# sourceMappingURL=update-device-status.use-case.js.map