"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildDislikeActivity = exports.sendDislike = void 0;
const logger_1 = require("../../../helpers/logger");
const audience_1 = require("../audience");
const url_1 = require("../url");
const send_utils_1 = require("./shared/send-utils");
function sendDislike(byActor, video, transaction) {
    logger_1.logger.info('Creating job to dislike %s.', video.url);
    const activityBuilder = (audience) => {
        const url = (0, url_1.getVideoDislikeActivityPubUrlByLocalActor)(byActor, video);
        return buildDislikeActivity(url, byActor, video, audience);
    };
    return (0, send_utils_1.sendVideoActivityToOrigin)(activityBuilder, { byActor, video, transaction, contextType: 'Rate' });
}
exports.sendDislike = sendDislike;
function buildDislikeActivity(url, byActor, video, audience) {
    if (!audience)
        audience = (0, audience_1.getAudience)(byActor);
    return (0, audience_1.audiencify)({
        id: url,
        type: 'Dislike',
        actor: byActor.url,
        object: video.url
    }, audience);
}
exports.buildDislikeActivity = buildDislikeActivity;
//# sourceMappingURL=send-dislike.js.map