import { inject } from 'vue';
import { AppConfigType } from '../types';

// Return the number of used plus planned tokens
export default function () {
    // Get plugin config
    const config: AppConfigType = inject('pluginConfig');

	// Get used articles from current schedules
	let currentUsedTokens = 0;

	config.settings.schedules.forEach((schedule) => {
		if (schedule.advSchedule) {
       		// Advanced schedule
			currentUsedTokens += Object.values(schedule.advSchedule).reduce((sum, arr) => sum + arr.length, 0);
		} else {
			// Basic schedule
			currentUsedTokens += schedule.days.length;
		}
	});

	// config.settings.used_tokens += currentUsedTokens;
}
