import { useProtocolStore } from "@/stores/admin/club/protocol/protocol";
import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAgenda";
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
import { useProtocolPrintoutStore } from "../stores/admin/club/protocol/protocolPrintout";

export async function setProtocolId(to: any, from: any, next: any) {
  const protocol = useProtocolStore();
  protocol.activeProtocol = to.params?.protocolId ?? null;

  useProtocolAgendaStore().$reset();
  useProtocolDecisionStore().$reset();
  useProtocolPresenceStore().$reset();
  useProtocolVotingStore().$reset();
  useProtocolPrintoutStore().$reset();

  next();
}

export async function resetProtocolStores(to: any, from: any, next: any) {
  const protocol = useProtocolStore();
  protocol.activeProtocol = null;
  protocol.activeProtocolObj = null;

  useProtocolAgendaStore().$reset();
  useProtocolDecisionStore().$reset();
  useProtocolPresenceStore().$reset();
  useProtocolVotingStore().$reset();
  useProtocolPrintoutStore().$reset();

  next();
}
