/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * 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 = "proto2";

option java_package = "com.android.timezone.location.tools.proto";
option java_multiple_files = false;

package com.android.timezone.location.tools.proto;

// The format need to write a TZ S2 data file.
message TimeZones {
    // All the time zone ID sets referenced by index from the ranges.
    repeated TimeZoneIdSet timeZoneIdSets = 1;

    // S2 cell ranges with the same time zone IDs. Must be ordered by (unsigned)
    // S2 start cell ID, no overlaps, gaps permitted.
    repeated S2Range ranges = 2;
}

// Sets of time zone IDs.
message TimeZoneIdSet {

    // A set of IANA TZDB time zone IDs, e.g. {"Europe/London", "Europe/Paris"}
    repeated string timeZoneIds = 1;
}

// An S2 cell range with the same time zone ID(s).
message S2Range {

    // The start S2 cell ID (inclusive).
    required uint64 startCellId = 1;

    // The end S2 cell ID (exclusive).
    required uint64 endCellId = 2;

    // The index of the TimeZoneIdSet (TimeZones.timeZoneIdSets) associated with
    // the range.
    required uint32 timeZoneIdSetIndex = 3;
}
