const path = require('path'); /** * AppState - Manages application state */ class AppState { constructor() { this.currentDirectory = null; this.currentFiles = []; this.currentShow = null; this.currentSeasons = []; this.currentEpisodes = []; this.selectedSeasonEpisodeCount = 0; this.isUpdatingEpisodeNumbers = false; } /** * Set the current directory * @param {string} directory - Directory path */ setCurrentDirectory(directory) { this.currentDirectory = directory; } /** * Get the current directory * @returns {string|null} Current directory path */ getCurrentDirectory() { return this.currentDirectory; } /** * Set current files * @param {Array} files - Array of file objects */ setCurrentFiles(files) { this.currentFiles = files; } /** * Get current files * @returns {Array} Array of file objects */ getCurrentFiles() { return this.currentFiles; } /** * Set current show * @param {Object} show - Show object */ setCurrentShow(show) { this.currentShow = show; } /** * Get current show * @returns {Object|null} Current show object */ getCurrentShow() { return this.currentShow; } /** * Set current seasons * @param {Array} seasons - Array of season objects */ setCurrentSeasons(seasons) { this.currentSeasons = seasons; } /** * Get current seasons * @returns {Array} Array of season objects */ getCurrentSeasons() { return this.currentSeasons; } /** * Set current episodes * @param {Array} episodes - Array of episode objects */ setCurrentEpisodes(episodes) { this.currentEpisodes = episodes; } /** * Get current episodes * @returns {Array} Array of episode objects */ getCurrentEpisodes() { return this.currentEpisodes; } /** * Set selected season episode count * @param {number} count - Episode count */ setSelectedSeasonEpisodeCount(count) { this.selectedSeasonEpisodeCount = count; } /** * Get selected season episode count * @returns {number} Episode count */ getSelectedSeasonEpisodeCount() { return this.selectedSeasonEpisodeCount; } /** * Check if episode numbers are currently updating * @returns {boolean} True if updating */ isUpdatingEpisodeNumbers() { return this.isUpdatingEpisodeNumbers; } /** * Set episode numbers updating flag * @param {boolean} updating - Updating state */ setUpdatingEpisodeNumbers(updating) { this.isUpdatingEpisodeNumbers = updating; } /** * Reset state to initial values */ reset() { this.currentDirectory = null; this.currentFiles = []; this.currentShow = null; this.currentSeasons = []; this.currentEpisodes = []; this.selectedSeasonEpisodeCount = 0; this.isUpdatingEpisodeNumbers = false; } } module.exports = AppState;