import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class PlanningInputService { private projectId: string | null = null; private pdvFile: File | null = null; private usuariosFile: File | null = null; setFiles(projectId: string, pdvFile: File, usuariosFile: File): void { this.projectId = projectId; this.pdvFile = pdvFile; this.usuariosFile = usuariosFile; } getFormData(projectId: string): FormData | null { if (this.projectId !== projectId || !this.pdvFile || !this.usuariosFile) return null; const data = new FormData(); data.append('pdv_file', this.pdvFile, this.pdvFile.name); data.append('usuarios_file', this.usuariosFile, this.usuariosFile.name); return data; } clear(projectId?: string): void { if (projectId && this.projectId !== projectId) return; this.projectId = null; this.pdvFile = null; this.usuariosFile = null; } }