import { type State } from './state';
import { type UserTask } from './task';

export enum ApprovalPolicyType {
  ALL = 'ALL',
  ANY = 'ANY',
  ONLY_ADMINS = 'ONLY_ADMINS',
}

export enum ApprovalStateName {
  APPROVED = 'APPROVED',
  REJECTED = 'REJECTED',
  CANCELLED = 'CANCELLED',
  PENDING = 'PENDING',
}

export enum ApprovalScreenSource {
  APPROVALS_LIST_PORTAL = 'APPROVALS_LIST_PORTAL',
  APPROVAL_DETAIL = 'APPROVAL_DETAIL',
  APPROVALS_LIST_AGENT_WORKSPACE = 'APPROVALS_LIST_AGENT_WORKSPACE',
  APPROVALS_TAB = 'APPROVALS_TAB',
}

export type ApprovalGroupTask = {
  taskId: string;
  assignee: UserTask;
  state: State;
  createdAt: string;
  updatedAt: string;
  completedAt?: string;
  message: string;
};

export type ApprovalGroup = {
  id: string;
  name: string;
  approvalPolicy: {
    policyType: ApprovalPolicyType;
  };
  status: ApprovalStateName;
  tasks: ApprovalGroupTask[];
};
