// Copyright 2022 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package power_manager;
option go_package = "chromiumos/system_api/power_manager_proto";

// Charge History message sent from powerd to Chrome on request. Charge History
// only tracks up to the last 30 days of charging.
message ChargeHistoryState {
  // Details for a Charge Event.
  message ChargeEvent {
    // The start time of a charge event, as given by
    // base::Time::ToInternalValue().
    optional int64 start_time = 1;

    // The duration of a charge event, as given by
    // base::TimeDelta::ToInternalValue().
    optional int64 duration = 2;

    // Next value to use: 3
  }

  // Charging duration details for an individual day.
  message DailyHistory {
    // The start time of the day, as given by base::Time::ToInternalValue()
    // called on a value returned from base::Time::UTCMidnight().
    optional int64 utc_midnight = 1;

    // The total time spent on an AC charger (low power USB chargers aren't
    // tracked right now, as given by base::TimeDelta::ToInternalValue().
    optional int64 time_on_ac = 2;

    // The total time spent on an AC charger with the battery full, as given by
    // base::TimeDelta::ToInternalValue().
    optional int64 time_full_on_ac = 3;

    // The total time spent holding charge due to Adaptive Charging, as given by
    // base::TimeDelta::ToInternalValue().
    optional int64 hold_time_on_ac = 4;

    // Next value to use: 5
  }

  // Up to the last 50 ChargeEvents tracked in ChargeHistory.
  repeated ChargeEvent charge_event = 1;

  // Up to the last 30 days of DailyHistory tracked in ChargeHistory/
  repeated DailyHistory daily_history = 2;
}
