import { faker } from '@faker-js/faker';
import { AKEvent, AKEventType } from '../event.js';
export default class AKTestEvent extends AKEvent {
    type = AKEventType.test;
    constructor(recipient) {
        super();
        this.recipient = recipient;
    }
    static async fromEventData(data, userService) {
        const user = await userService.findById(data.userId);
        return new AKTestEvent(user);
    }
    toEventData() {
        return {
            userId: this.recipient.id,
        };
    }
    shouldSendViaChannels() {
        return ['pushNotification', 'email'];
    }
    static preview() {
        return new AKTestEvent({
            id: faker.string.uuid(),
            firstname: faker.person.firstName(),
            email: faker.internet.email(),
        });
    }
    async emailPayload() {
        return {
            subject: 'Email de test',
            template: 'default',
            data: {
                message: `Message de test`,
                url: new URL('http://akago.fr'),
            },
        };
    }
    async pushNotificationPayload() {
        return {
            title: 'Test',
            body: 'de push notification',
            data: {
                message: `Message de test`,
                url: 'http://akago.fr',
            },
        };
    }
}
//# sourceMappingURL=test_event.js.map