// Import express types
import { Request } from 'express';

/**
 * Record an action occurrence
 * @author Gabe Abrams
 * @author Karen Dolan
 * @param {string} type - the action type
 * @param {string} description - the error message
 * @param {object} req - Express request object
 * @param {number} [userId=value in session] - the Canvas id of the user who is
 *   attending
 * @param {string} [userFirstName=value in session] - the first name of the user
 * @param {string} [userLastName=value in session] - the last name of the user
 * @param {number} [courseId=value in session] - the Canvas Course Id
 * @param {object} [metadata={}] - additional metadata object
 * @param {boolean} [isLearner=value in session] - true if the user is a learner
 * @param {boolean} [isAdmin=value in session] - true if the user is an admin
 */
type LogAction = (opts: {
  type: string,
  description: string,
  req: Request,
  userId?: number,
  userFirstName?: string,
  userLastName?: string,
  courseId?: number,
  metadata?: { [k: string]: any },
  isLearner?: boolean,
  isAdmin?: boolean,
}) => Promise<void>;

export default LogAction;
