"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskHelpers = exports.DONE_TASK_STATUES = exports.OPEN_TASK_STATUES = void 0;
var types_1 = require("@bringg/types");
var lodash_1 = require("lodash");
exports.OPEN_TASK_STATUES = [
    types_1.TaskStatus.Created,
    types_1.TaskStatus.Assigned,
    types_1.TaskStatus.OnTheWay,
    types_1.TaskStatus.CheckedIn,
    types_1.TaskStatus.Accepted
];
exports.DONE_TASK_STATUES = [types_1.TaskStatus.Cancelled, types_1.TaskStatus.Done, types_1.TaskStatus.Rejected];
var TaskHelpers = /** @class */ (function () {
    function TaskHelpers() {
    }
    TaskHelpers.isReadyToExecute = function (task) {
        return task.ready_to_execute;
    };
    TaskHelpers.isTaskInOpenState = function (task) {
        return (0, lodash_1.includes)(exports.OPEN_TASK_STATUES, task.status);
    };
    TaskHelpers.isDone = function (task) {
        return (0, lodash_1.includes)(exports.DONE_TASK_STATUES, task.status);
    };
    TaskHelpers.isGroupFollower = function (task) {
        return Boolean(task.group_leader_id);
    };
    TaskHelpers.isUnacknowledged = function (task) {
        return task.status === types_1.TaskStatus.Unacknowledged;
    };
    TaskHelpers.isLate = function (task) {
        return task.late;
    };
    TaskHelpers.isInOpenState = function (task) {
        return TaskHelpers.isTaskInOpenState(task) && TaskHelpers.isReadyToExecute(task);
    };
    TaskHelpers.isInPlanningState = function (task) {
        return TaskHelpers.isTaskInOpenState(task) && !TaskHelpers.isReadyToExecute(task);
    };
    TaskHelpers.isInClosedState = function (task) {
        return TaskHelpers.isDone(task);
    };
    TaskHelpers.isInvalid = function (task) {
        return task.invalidated === true;
    };
    return TaskHelpers;
}());
exports.TaskHelpers = TaskHelpers;
//# sourceMappingURL=TaskHelpers.js.map