export type FileAction = 'ADD' | 'DOWNLOAD' | 'EDIT' | 'REVIEW' | 'REMOVE' | 'REPLACE' | 'VIEW';

/** 只消费运行态裁决，不解释流程规则。未配置保持旧行为，受控但未就绪则关闭动作。 */
export interface FileAccess {
  reviewEnabled?: boolean;
  status: 'error' | 'loading' | 'ready';
  actions?: Partial<Record<FileAction, boolean>>;
}

export function allowsFileAction(access: FileAccess | undefined, action: FileAction): boolean {
  return access === undefined || (access?.status === 'ready' && access.actions?.[action] === true);
}
