chromium/chrome/browser/ash/child_accounts/time_limit_consistency_test/consistency_golden_converter.h

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Utilities for converting goldens to and from the structures used by the time
// limit processor.

#ifndef CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_GOLDEN_CONVERTER_H_
#define CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_GOLDEN_CONVERTER_H_

#include <optional>

#include "chrome/browser/ash/child_accounts/time_limit_consistency_test/goldens/consistency_golden.pb.h"
#include "chrome/browser/ash/child_accounts/usage_time_limit_processor.h"

namespace base {
class Value;
}  // namespace base

namespace ash {
namespace time_limit_consistency {

// Converts the input part of a consistency golden case to the structure used by
// the time limit processor.
base::Value::Dict ConvertGoldenInputToProcessorInput(
    const ConsistencyGoldenInput& input);

// Converts the output struct generated by the time limit processor to the
// consistency golden output proto.
ConsistencyGoldenOutput ConvertProcessorOutputToGoldenOutput(
    const usage_time_limit::State& state);

// Generates a State struct representing the previous state required by the
// processor if there is a UNLOCK_USAGE_LIMIT override present. The generated
// state simulates being locked by usage limit since one minute before the
// override was created.
// If the override is of another type, std::nullopt will be returned.
std::optional<usage_time_limit::State>
GenerateUnlockUsageLimitOverrideStateFromInput(
    const ConsistencyGoldenInput& input);

}  // namespace time_limit_consistency
}  // namespace ash

#endif  // CHROME_BROWSER_ASH_CHILD_ACCOUNTS_TIME_LIMIT_CONSISTENCY_TEST_CONSISTENCY_GOLDEN_CONVERTER_H_