export function useTravelReimbursementCreateViewDrawerControls({
  REVIEW_DRAWER_MODE_DOCUMENTS,
  REVIEW_DRAWER_MODE_FLOW,
  REVIEW_DRAWER_MODE_REVIEW,
  REVIEW_DRAWER_MODE_RISK,
  hasInsightPanelContent,
  insightPanelCollapsed,
  reviewDocumentDrawerAvailable,
  reviewDrawerMode,
  reviewFlowDrawerAvailable,
  reviewOverviewDrawerAvailable,
  reviewRiskDrawerAvailable
}) {
  function toggleInsightPanel() {
    if (!hasInsightPanelContent.value) {
      return
    }
    insightPanelCollapsed.value = !insightPanelCollapsed.value
  }

  function switchReviewDrawerMode(mode) {
    if (reviewDrawerMode.value === mode) {
      return
    }
    reviewDrawerMode.value = mode
  }

  function switchToReviewOverviewDrawer() {
    if (!reviewOverviewDrawerAvailable.value) {
      return
    }
    switchReviewDrawerMode(REVIEW_DRAWER_MODE_REVIEW)
  }

  function toggleReviewDocumentDrawer() {
    if (!reviewDocumentDrawerAvailable.value) {
      return
    }
    switchReviewDrawerMode(REVIEW_DRAWER_MODE_DOCUMENTS)
  }

  function toggleReviewRiskDrawer() {
    if (!reviewRiskDrawerAvailable.value) {
      return
    }
    switchReviewDrawerMode(REVIEW_DRAWER_MODE_RISK)
  }

  function toggleReviewFlowDrawer() {
    if (!reviewFlowDrawerAvailable.value) {
      return
    }
    switchReviewDrawerMode(REVIEW_DRAWER_MODE_FLOW)
  }

  return {
    switchReviewDrawerMode,
    switchToReviewOverviewDrawer,
    toggleInsightPanel,
    toggleReviewDocumentDrawer,
    toggleReviewFlowDrawer,
    toggleReviewRiskDrawer
  }
}
