/**
 * 审方页列表/卡片视图偏好本地存储
 */
export type AuditPrescriptionViewMode = 'list' | 'card';

const STORAGE_KEY = 'audit-prescription-view-mode';

/** 读取上次视图模式，默认列表 */
export function readAuditViewMode(): AuditPrescriptionViewMode {
  try {
    const raw = localStorage.getItem(STORAGE_KEY);
    if (raw === 'list' || raw === 'card') return raw;
  } catch {
    // ignore
  }
  return 'list';
}

/** 写入视图模式，下次打开直接进入对应视图 */
export function writeAuditViewMode(mode: AuditPrescriptionViewMode) {
  try {
    localStorage.setItem(STORAGE_KEY, mode);
  } catch {
    // ignore
  }
}
