import { TaskType } from 'apps/sales/src/app/modules/task-calendar/defs';

export function taskTypeMapper(hasTask: boolean, options?: { publicationDate: string; taskDate: string }): TaskType {
  if (!!hasTask) {
    return 'Task';
  }

  if (!options || !options.publicationDate || !options.taskDate) {
    return 'Info';
  }

  const publicationDate = new Date(options.publicationDate);
  const taskDate = new Date(options.taskDate);

  return taskDate > publicationDate ? 'PreInfo' : 'Info';
}
