import { defineStore } from 'pinia'; import { ref, computed } from 'vue'; import type { ValidationIssue } from '../types/validation'; export const useValidationStore = defineStore('validation', () => { const issues = ref([]); const errorCount = computed(() => issues.value.filter(i => i.severity === 'Error').length); const warningCount = computed(() => issues.value.filter(i => i.severity === 'Warning').length); const hasIssues = computed(() => issues.value.length > 0); function setIssues(newIssues: ValidationIssue[]) { issues.value = newIssues; } function clear() { issues.value = []; } return { issues, errorCount, warningCount, hasIssues, setIssues, clear, }; });