<?php

namespace Cleancrm\Advancedcrm\Workflow;

use Exception;
use Litepie\Workflow\Exceptions\WorkflowActionNotPerformedException;

use Cleancrm\Advancedcrm\Models\CalendarEventPriority;

class CalendarEventPriorityAction
{
    /**
     * Perform the complete action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */
    public function complete(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'complete';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }

    /**
     * Perform the verify action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */public function verify(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'verify';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }

    /**
     * Perform the approve action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */public function approve(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'approve';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }

    /**
     * Perform the publish action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */public function publish(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'publish';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }

    /**
     * Perform the archive action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */
    public function archive(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'archive';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }

    /**
     * Perform the unpublish action.
     *
     * @param CalendarEventPriority $calendar_event_priority
     *
     * @return CalendarEventPriority
     */
    public function unpublish(CalendarEventPriority $calendar_event_priority)
    {
        try {
            $calendar_event_priority->status = 'unpublish';
            return $calendar_event_priority->save();
        } catch (Exception $e) {
            throw new WorkflowActionNotPerformedException();
        }
    }
}