// Copyright 2026 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.ads.admanager.v1;

import "google/ads/admanager/v1/report_definition.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/type/date.proto";
import "google/type/dayofweek.proto";
import "google/type/timeofday.proto";

option csharp_namespace = "Google.Ads.AdManager.V1";
option go_package = "google.golang.org/genproto/googleapis/ads/admanager/v1;admanager";
option java_multiple_files = true;
option java_outer_classname = "ReportDeliveryProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// The options for a scheduled report.
message ScheduleOptions {
  // The schedule for the report
  message Schedule {
    // Days of week to schedule report run.
    message WeeklySchedule {
      // Specifies days of the week on which to run report.
      repeated google.type.DayOfWeek weekly_scheduled_days = 1;
    }

    // Days of Month to schedule report run.
    message MonthlySchedule {
      // Specifies days of the month to run report. Range is from 1-31.
      // Will ignore days that are not valid for the given month.
      repeated int32 monthly_scheduled_days = 1;
    }

    // Frequency to run report.
    enum Frequency {
      // No Frequency specified.
      FREQUENCY_UNSPECIFIED = 0;

      // Schedule report to run every hour.
      HOURLY = 1;

      // Schedule report to run twice a day (every 12 hours).
      TWO_TIMES_DAILY = 2;

      // Schedule report to run three times a day (every 8 hours).
      THREE_TIMES_DAILY = 3;

      // Schedule report to run four times a day (every 6 hours).
      FOUR_TIMES_DAILY = 4;

      // Schedule report to run on a daily basis.
      DAILY = 5;

      // Schedule report to run on a weekly basis.
      WEEKLY = 6;

      // Schedule report to run on a monthly basis.
      MONTHLY = 7;
    }

    // The scheduled values based on the frequency selected.
    // WEEKLY - uses WeeklySchedule
    // MONTHLY - uses MonthlySchedule
    oneof frequency_schedule {
      // Days of week to schedule report run.
      WeeklySchedule weekly_schedule = 6;

      // Days of month to schedule report run.
      MonthlySchedule monthly_schedule = 7;
    }

    // Date for the first run of the report.
    google.type.Date start_date = 1;

    // Date for the final run of the report.
    google.type.Date end_date = 2;

    // Frequency to run report.
    Frequency frequency = 3;

    // Indicates start time for schedule to run
    // Will use the time_zone from `ReportDefinition`. Defaults
    // to the publisher's time zone if not specified.
    //
    // For HOURLY, TWO_TIMES_DAILY, THREE_TIMES_DAILY, or FOUR_TIMES_DAILY, this
    // will be the time of day that the first report will run on the first day.
    // For example, if the start time is 2:00 PM, and the frequency is
    // THREE_TIMES_DAILY, the first day will have reports scheduled at 2:00 PM,
    // 10:00 PM. Each subsequent day will have reports scheduled at 6:00 AM,
    // 2:00 PM, 10:00 PM.
    google.type.TimeOfDay start_time = 4;
  }

  // Condition for when to email the scheduled report.
  enum DeliveryCondition {
    // Never deliver report.
    NEVER = 0;

    // Always deliver report.
    ALWAYS = 1;

    // Deliver report when flag's conditions are met.
    WHEN_FLAG_CONDITIONS_MET = 2;
  }

  // Information pertaining to schedule itself.
  Schedule schedule = 1;

  // Option for when to deliver the scheduled report.
  DeliveryCondition delivery_condition = 2;

  // Optional. The flags evaluated when ReportDeliveryOption.WHEN_FLAG_PRESENT
  // is specified.
  repeated ReportDefinition.Flag flags = 3
      [(google.api.field_behavior) = OPTIONAL];
}
