"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateDevicePushTokenUseCase = void 0;
const not_found_error_1 = require("../../../domain/errors/not-found-error");
class UpdateDevicePushTokenUseCase {
    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.updatePushToken(input.pushToken);
        return this.deviceRepository.update(updated);
    }
}
exports.UpdateDevicePushTokenUseCase = UpdateDevicePushTokenUseCase;
//# sourceMappingURL=update-device-push-token.use-case.js.map