const { DataTypes } = require("sequelize"); const sequelize = require("../config/database"); const Entry = sequelize.define("entry", { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, title: { type: DataTypes.STRING(500) }, original_title: { type: DataTypes.STRING(100), field: "original_title" }, release_date: { type: DataTypes.DATE, field: "release_date" }, release_status: { type: DataTypes.STRING(50), field: "release_status" }, runtime: { type: DataTypes.INTEGER }, tagline: { type: DataTypes.STRING(200) }, storyline: { type: DataTypes.STRING(3000) }, country: { type: DataTypes.STRING(30) }, certification: { type: DataTypes.STRING(20) }, network_studio: { type: DataTypes.STRING(100), field: "network_studio" }, // ? TMDB details adult: { type: DataTypes.BOOLEAN, defaultValue: false }, tmdb_popularity: { type: DataTypes.FLOAT, field: "tmdb_popularity" }, original_language: { type: DataTypes.STRING(10), field: "original_language" }, origin_country: { type: DataTypes.JSON, field: "origin_country" }, spoken_languages: { type: DataTypes.JSON, field: "spoken_languages" }, production_countries: { type: DataTypes.JSON, field: "production_countries" }, production_companies: { type: DataTypes.JSON, field: "production_companies" }, homepage: { type: DataTypes.STRING(500) }, budget: { type: DataTypes.BIGINT }, revenue: { type: DataTypes.BIGINT }, keywords: { type: DataTypes.JSON }, tmdb_videos: { type: DataTypes.JSON, field: "tmdb_videos" }, watch_providers: { type: DataTypes.JSON, field: "watch_providers" }, alternative_titles: { type: DataTypes.JSON, field: "alternative_titles" }, // ? TV-only TMDB details tv_type: { type: DataTypes.STRING(30), field: "tv_type" }, created_by: { type: DataTypes.JSON, field: "created_by" }, number_of_seasons: { type: DataTypes.INTEGER, field: "number_of_seasons" }, number_of_episodes: { type: DataTypes.INTEGER, field: "number_of_episodes" }, last_air_date: { type: DataTypes.DATEONLY, field: "last_air_date" }, in_production: { type: DataTypes.BOOLEAN, field: "in_production" }, next_episode_to_air: { type: DataTypes.JSON, field: "next_episode_to_air" }, last_episode_to_air: { type: DataTypes.JSON, field: "last_episode_to_air" }, collection_id: { type: DataTypes.INTEGER, field: "collection_id" }, max_cast: { type: DataTypes.INTEGER, field: "max_cast", defaultValue: 10 }, credit_fetched: { type: DataTypes.BOOLEAN, defaultValue: false, field: "credit_fetched", }, watchlist: { type: DataTypes.BOOLEAN, defaultValue: false }, favorit: { type: DataTypes.BOOLEAN, defaultValue: false }, hidden: { type: DataTypes.BOOLEAN, defaultValue: false }, showInCalendar: { type: DataTypes.BOOLEAN, defaultValue: true, field: "show_in_calendar", }, autoSync: { type: DataTypes.BOOLEAN, defaultValue: true, field: "auto_sync" }, note: { type: DataTypes.STRING(2000) }, is_tvseries: { type: DataTypes.BOOLEAN, field: "is_tvseries" }, status: { type: DataTypes.STRING(20) }, poster_path: { type: DataTypes.STRING(200), field: "poster_path" }, banner_path: { type: DataTypes.STRING(200), field: "banner_path" }, date_first_seen: { type: DataTypes.DATEONLY, field: "date_first_seen" }, date_last_seen: { type: DataTypes.DATEONLY, field: "date_last_seen" }, last_fetch: { type: DataTypes.DATE }, entry_sync_status: { type: DataTypes.STRING(50), field: "entry_sync_status", allowNull: true, }, director: { type: DataTypes.STRING(200), allowNull: true }, watch_status: { type: DataTypes.STRING(20), field: "watch_status", allowNull: true, defaultValue: null, }, }); // Large JSON columns only needed on the details page; left out of list queries. Entry.DETAIL_ONLY_ATTRIBUTES = [ "keywords", "tmdb_videos", "watch_providers", "alternative_titles", "production_companies", "spoken_languages", "production_countries", "created_by", "next_episode_to_air", "last_episode_to_air", ]; module.exports = Entry;