/*
 * Copyright 2020 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "skip_action.hpp"

#include <memory>

namespace ipmi_flash
{

std::unique_ptr<TriggerableActionInterface> SkipAction::CreateSkipAction()
{
    return std::make_unique<SkipAction>();
}

bool SkipAction::trigger()
{
    if (cb)
    {
        cb(*this);
    }
    return true;
}

void SkipAction::abort()
{}

ActionStatus SkipAction::status()
{
    return ActionStatus::success;
}

} // namespace ipmi_flash
