
syntax = "proto3";

package com.onthegomap.planetiler.proto;

message Entry {
  oneof entry {
    TileEntry tile = 1;
    InitializationEntry initialization = 2;
    FinishEntry finish = 3;
  }
}

message TileEntry {
  int32 x = 1;
  int32 y = 2;
  int32 z = 3;
  bytes encoded_data = 4;
}

message InitializationEntry {
  Metadata metadata = 1;
}

message FinishEntry {
  Metadata metadata = 1;
}

message Metadata {

  string name = 1;
  string description = 2;
  string attribution = 3;
  string version = 4;
  string type = 5;
  string format = 6;
  Envelope bounds = 7;
  CoordinateXY center = 8;
  double zoom = 9;
  int32 min_zoom = 10;
  int32 max_zoom = 11;
  repeated VectorLayer vector_layers = 12;
  map<string, string> others = 13;
  TileCompression tile_compression = 14;
}

message Envelope {
  double min_x = 1;
  double max_x = 2;
  double min_y = 3;
  double max_y = 4;
}

message CoordinateXY {
  double x = 1;
  double y = 2;
}

message VectorLayer {
  string id = 1;
  map<string, FieldType> fields = 2;
  string description = 3;
  int32 min_zoom = 4;
  int32 max_zoom = 5;

  enum FieldType {
    FIELD_TYPE_UNSPECIFIED = 0;
    FIELD_TYPE_NUMBER = 1;
    FIELD_TYPE_BOOLEAN = 3;
    FIELD_TYPE_STRING = 4;
  }
}

enum TileCompression {
  TILE_COMPRESSION_UNSPECIFIED = 0;
  TILE_COMPRESSION_GZIP = 1;
  TILE_COMPRESSION_NONE = 2;
}

