"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VideoFileQueryBuilder = void 0;
const abstract_video_query_builder_1 = require("./abstract-video-query-builder");
class VideoFileQueryBuilder extends abstract_video_query_builder_1.AbstractVideoQueryBuilder {
    constructor(sequelize) {
        super(sequelize, 'get');
        this.sequelize = sequelize;
    }
    queryWebTorrentVideos(options) {
        this.buildWebtorrentFilesQuery(options);
        return this.runQuery(options);
    }
    queryStreamingPlaylistVideos(options) {
        this.buildVideoStreamingPlaylistFilesQuery(options);
        return this.runQuery(options);
    }
    buildWebtorrentFilesQuery(options) {
        this.attributes = {
            '"video"."id"': ''
        };
        this.includeWebtorrentFiles();
        if (options.includeRedundancy) {
            this.includeWebTorrentRedundancies();
        }
        this.whereId(options);
        this.query = this.buildQuery();
    }
    buildVideoStreamingPlaylistFilesQuery(options) {
        this.attributes = {
            '"video"."id"': ''
        };
        this.includeStreamingPlaylistFiles();
        if (options.includeRedundancy) {
            this.includeStreamingPlaylistRedundancies();
        }
        this.whereId(options);
        this.query = this.buildQuery();
    }
    buildQuery() {
        return `${this.buildSelect()} FROM "video" ${this.joins} ${this.where}`;
    }
}
exports.VideoFileQueryBuilder = VideoFileQueryBuilder;
//# sourceMappingURL=video-file-query-builder.js.map