import {formState} from '~/types/interfaces'
import {FORM_STATUS} from "~/types/enums";

export const state = () => ({
  formStatus: FORM_STATUS.EDIT,
  violations: [],
  readonly: false,
  dirty: false,
  showConfirmToLeave: false,
  goAfterLeave: null
})

export const mutations = {
  setViolations (state: formState, violations: Array<string>) {
    state.violations = violations
  },
  setReadOnly (state: formState, readonly: boolean) {
    state.readonly = readonly
  },
  setFormStatus (state: formState, formStatus: FORM_STATUS) {
    state.formStatus = formStatus
  },
  setDirty (state: formState, dirty: boolean) {
    state.dirty = dirty
  },
  setShowConfirmToLeave (state: formState, showConfirmToLeave: boolean) {
    state.showConfirmToLeave = showConfirmToLeave
  },
  setGoAfterLeave (state: formState, goAfterLeave: string) {
    state.goAfterLeave = goAfterLeave
  }
}

export const actions = {
}
