"use strict";
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
    var _, done = false;
    for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
            if (result === void 0) continue;
            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
            if (_ = accept(result.get)) descriptor.get = _;
            if (_ = accept(result.set)) descriptor.set = _;
            if (_ = accept(result.init)) initializers.unshift(_);
        }
        else if (_ = accept(result)) {
            if (kind === "field") initializers.unshift(_);
            else descriptor[key] = _;
        }
    }
    if (target) Object.defineProperty(target, contextIn.name, descriptor);
    done = true;
};
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
    var useValue = arguments.length > 2;
    for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
    }
    return useValue ? value : void 0;
};
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
    if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
    return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Series = void 0;
var typeorm_1 = require("typeorm");
var category_entity_1 = require("../../categories/entities/category.entity");
var season_entity_1 = require("./season.entity");
var Series = function () {
    var _classDecorators = [(0, typeorm_1.Entity)('series')];
    var _classDescriptor;
    var _classExtraInitializers = [];
    var _classThis;
    var _id_decorators;
    var _id_initializers = [];
    var _id_extraInitializers = [];
    var _title_decorators;
    var _title_initializers = [];
    var _title_extraInitializers = [];
    var _synopsis_decorators;
    var _synopsis_initializers = [];
    var _synopsis_extraInitializers = [];
    var _posterUrl_decorators;
    var _posterUrl_initializers = [];
    var _posterUrl_extraInitializers = [];
    var _backdropUrl_decorators;
    var _backdropUrl_initializers = [];
    var _backdropUrl_extraInitializers = [];
    var _rating_decorators;
    var _rating_initializers = [];
    var _rating_extraInitializers = [];
    var _year_decorators;
    var _year_initializers = [];
    var _year_extraInitializers = [];
    var _isActive_decorators;
    var _isActive_initializers = [];
    var _isActive_extraInitializers = [];
    var _createdAt_decorators;
    var _createdAt_initializers = [];
    var _createdAt_extraInitializers = [];
    var _categories_decorators;
    var _categories_initializers = [];
    var _categories_extraInitializers = [];
    var _seasons_decorators;
    var _seasons_initializers = [];
    var _seasons_extraInitializers = [];
    var Series = _classThis = /** @class */ (function () {
        function Series_1() {
            this.id = __runInitializers(this, _id_initializers, void 0);
            this.title = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _title_initializers, void 0));
            this.synopsis = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _synopsis_initializers, void 0));
            this.posterUrl = (__runInitializers(this, _synopsis_extraInitializers), __runInitializers(this, _posterUrl_initializers, void 0));
            this.backdropUrl = (__runInitializers(this, _posterUrl_extraInitializers), __runInitializers(this, _backdropUrl_initializers, void 0));
            this.rating = (__runInitializers(this, _backdropUrl_extraInitializers), __runInitializers(this, _rating_initializers, void 0));
            this.year = (__runInitializers(this, _rating_extraInitializers), __runInitializers(this, _year_initializers, void 0));
            this.isActive = (__runInitializers(this, _year_extraInitializers), __runInitializers(this, _isActive_initializers, void 0));
            this.createdAt = (__runInitializers(this, _isActive_extraInitializers), __runInitializers(this, _createdAt_initializers, void 0));
            this.categories = (__runInitializers(this, _createdAt_extraInitializers), __runInitializers(this, _categories_initializers, void 0));
            this.seasons = (__runInitializers(this, _categories_extraInitializers), __runInitializers(this, _seasons_initializers, void 0));
            __runInitializers(this, _seasons_extraInitializers);
        }
        return Series_1;
    }());
    __setFunctionName(_classThis, "Series");
    (function () {
        var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
        _id_decorators = [(0, typeorm_1.PrimaryGeneratedColumn)('uuid')];
        _title_decorators = [(0, typeorm_1.Column)()];
        _synopsis_decorators = [(0, typeorm_1.Column)({ type: 'text', nullable: true })];
        _posterUrl_decorators = [(0, typeorm_1.Column)({ nullable: true })];
        _backdropUrl_decorators = [(0, typeorm_1.Column)({ nullable: true })];
        _rating_decorators = [(0, typeorm_1.Column)({ type: 'float', nullable: true })];
        _year_decorators = [(0, typeorm_1.Column)({ nullable: true })];
        _isActive_decorators = [(0, typeorm_1.Column)({ default: true })];
        _createdAt_decorators = [(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' })];
        _categories_decorators = [(0, typeorm_1.ManyToMany)(function () { return category_entity_1.Category; }, { eager: true }), (0, typeorm_1.JoinTable)({
                name: 'series_categories',
                joinColumn: { name: 'seriesId', referencedColumnName: 'id' },
                inverseJoinColumn: { name: 'categoryId', referencedColumnName: 'id' },
            })];
        _seasons_decorators = [(0, typeorm_1.OneToMany)(function () { return season_entity_1.Season; }, function (season) { return season.series; }, { cascade: true })];
        __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: function (obj) { return "id" in obj; }, get: function (obj) { return obj.id; }, set: function (obj, value) { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
        __esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: function (obj) { return "title" in obj; }, get: function (obj) { return obj.title; }, set: function (obj, value) { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
        __esDecorate(null, null, _synopsis_decorators, { kind: "field", name: "synopsis", static: false, private: false, access: { has: function (obj) { return "synopsis" in obj; }, get: function (obj) { return obj.synopsis; }, set: function (obj, value) { obj.synopsis = value; } }, metadata: _metadata }, _synopsis_initializers, _synopsis_extraInitializers);
        __esDecorate(null, null, _posterUrl_decorators, { kind: "field", name: "posterUrl", static: false, private: false, access: { has: function (obj) { return "posterUrl" in obj; }, get: function (obj) { return obj.posterUrl; }, set: function (obj, value) { obj.posterUrl = value; } }, metadata: _metadata }, _posterUrl_initializers, _posterUrl_extraInitializers);
        __esDecorate(null, null, _backdropUrl_decorators, { kind: "field", name: "backdropUrl", static: false, private: false, access: { has: function (obj) { return "backdropUrl" in obj; }, get: function (obj) { return obj.backdropUrl; }, set: function (obj, value) { obj.backdropUrl = value; } }, metadata: _metadata }, _backdropUrl_initializers, _backdropUrl_extraInitializers);
        __esDecorate(null, null, _rating_decorators, { kind: "field", name: "rating", static: false, private: false, access: { has: function (obj) { return "rating" in obj; }, get: function (obj) { return obj.rating; }, set: function (obj, value) { obj.rating = value; } }, metadata: _metadata }, _rating_initializers, _rating_extraInitializers);
        __esDecorate(null, null, _year_decorators, { kind: "field", name: "year", static: false, private: false, access: { has: function (obj) { return "year" in obj; }, get: function (obj) { return obj.year; }, set: function (obj, value) { obj.year = value; } }, metadata: _metadata }, _year_initializers, _year_extraInitializers);
        __esDecorate(null, null, _isActive_decorators, { kind: "field", name: "isActive", static: false, private: false, access: { has: function (obj) { return "isActive" in obj; }, get: function (obj) { return obj.isActive; }, set: function (obj, value) { obj.isActive = value; } }, metadata: _metadata }, _isActive_initializers, _isActive_extraInitializers);
        __esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: function (obj) { return "createdAt" in obj; }, get: function (obj) { return obj.createdAt; }, set: function (obj, value) { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers, _createdAt_extraInitializers);
        __esDecorate(null, null, _categories_decorators, { kind: "field", name: "categories", static: false, private: false, access: { has: function (obj) { return "categories" in obj; }, get: function (obj) { return obj.categories; }, set: function (obj, value) { obj.categories = value; } }, metadata: _metadata }, _categories_initializers, _categories_extraInitializers);
        __esDecorate(null, null, _seasons_decorators, { kind: "field", name: "seasons", static: false, private: false, access: { has: function (obj) { return "seasons" in obj; }, get: function (obj) { return obj.seasons; }, set: function (obj, value) { obj.seasons = value; } }, metadata: _metadata }, _seasons_initializers, _seasons_extraInitializers);
        __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
        Series = _classThis = _classDescriptor.value;
        if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        __runInitializers(_classThis, _classExtraInitializers);
    })();
    return Series = _classThis;
}();
exports.Series = Series;
