// Copyright 2025 Google LLC
//
// 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.

syntax = "proto3";

package google.cloud.capacityplanner.v1beta;

import "google/cloud/capacityplanner/v1beta/allocation.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.CapacityPlanner.V1Beta";
option go_package = "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb;capacityplannerpb";
option java_multiple_files = true;
option java_outer_classname = "FutureReservationProto";
option java_package = "com.google.cloud.capacityplanner.v1beta";
option php_namespace = "Google\\Cloud\\CapacityPlanner\\V1beta";
option ruby_package = "Google::Cloud::CapacityPlanner::V1beta";

// Repesents Future Reservation request which is part of aggregated
// reservations data response of "QueryReservations".
message FutureReservation {
  // Represents specific SKU properties for the Future Reservation.
  message SpecificSKUProperties {
    // Properties of the SKU instances being reserved.
    Allocation.SpecificSKUAllocation.AllocatedInstanceProperties
        instance_properties = 1;

    // Total number of instances for which capacity assurance is requested at a
    // future time period.
    int64 total_count = 2;
  }

  // Represents time window for the Future Reservation.
  message TimeWindow {
    // Start time of the Future Reservation.
    google.protobuf.Timestamp start_time = 1;

    // End time of the Future Reservation.
    google.protobuf.Timestamp end_time = 2;
  }

  // Represents status related to the future reservation.
  message Status {
    // Represents procurement status of the Future Reservation.
    enum ProcurementStatus {
      // This is unused status value.
      PROCUREMENT_STATUS_UNSPECIFIED = 0;

      // Future reservation is pending approval by Google Cloud Platform.
      PENDING_APPROVAL = 1;

      // Future reservation is approved by Google Cloud Platform.
      APPROVED = 2;

      // Future reservation is committed by the customer.
      COMMITTED = 3;

      // Future reservation is rejected by Google Cloud Platform.
      DECLINED = 4;

      // Future reservation is cancelled by the customer.
      CANCELLED = 5;

      // Future reservation is being procured by Google Cloud Platform. Beyond
      // this point, Future reservation is locked and no further modifications
      // are allowed.
      PROCURING = 6;

      // Future reservation capacity is being provisioned. This state will be
      // entered after start_time, while reservations are being created to
      // provide total_count reserved instance slots. This state will not
      // persist past start_time + 24h.
      PROVISIONING = 7;

      // Future reservation is fulfilled completely.
      FULFILLED = 8;

      // Future reservation failed. No additional reservations were provided.
      FAILED = 9;

      // Future reservation is partially fulfilled. Additional reservations were
      // provided but did not reach total_count reserved instance slots.
      FAILED_PARTIALLY_FULFILLED = 10;

      // Related status for PlanningStatus.Draft. Transitions to
      // PENDING_APPROVAL upon user submitting FR.
      DRAFTING = 11;

      // An Amendment to the Future Reservation has been requested. If the
      // Amendment is declined, the Future Reservation will be restored to the
      // last known good state.
      PENDING_AMENDMENT_APPROVAL = 12;
    }

    // Current state of this Future Reservation
    ProcurementStatus procurement_status = 1;

    // Time when Future Reservation would become LOCKED, after which no
    // modifications to Future Reservation will be allowed. Applicable only
    // after the Future Reservation is in the APPROVED state. The lock_time is
    // an RFC3339 string. The procurement_status will transition to PROCURING
    // state at this time.
    google.protobuf.Timestamp lock_time = 2;

    // Fully qualified urls of the automatically created reservations at
    // start_time.
    repeated string auto_created_reservations = 3;

    // This count indicates the fulfilled capacity so far. This is set during
    // "PROVISIONING" state. This count also includes capacity delivered as part
    // of existing matching reservations.
    int64 fulfilled_count = 4;
  }

  // The type of the future reservation which can only be for a specific SKU for
  // now.
  oneof type {
    // Future Reservation configuration to indicate instance properties and
    // total count.
    SpecificSKUProperties specific_sku_properties = 8;
  }

  // A unique identifier for this future reservation. The server
  // defines this identifier.
  int64 id = 1;

  // The creation timestamp for this future reservation.
  google.protobuf.Timestamp create_time = 2;

  // URL of the Zone where this future reservation resides.
  string zone = 5;

  // Description of the future reservation provided by user.
  string description = 6;

  // The future reservation resource name.
  string future_reservation = 7;

  string owner_project_id = 15;

  // Time window for this Future Reservation.
  TimeWindow time_window = 9;

  // List of Projects/Folders to share with.
  Allocation.ShareSettings share_settings = 10;

  // Name prefix for the reservations to be created at the time of
  // delivery. The name prefix must comply with RFC1035.
  // Maximum allowed length for name prefix is 20. Automatically created
  // reservations name format will be <name-prefix>-date-####.
  string name_prefix = 11;

  // Status of the Future Reservation
  Status status = 12;

  // Future timestamp when the FR auto-created reservations will be deleted by
  // Compute Engine. Format of this field must be a valid RFC3339 value.
  google.protobuf.Timestamp auto_created_reservations_delete_time = 13;

  // Setting for enabling or disabling automatic deletion for auto-created
  // reservation. If set to true, auto-created reservations will be
  // deleted at Future Reservation's end time (default) or at user's defined
  // timestamp if any of the
  // [auto_created_reservations_delete_time, auto_created_reservations_duration]
  // values is specified.
  // For keeping auto-created reservation indefinitely, this value should be set
  // to false.
  bool auto_delete_auto_created_reservations = 14;
}
