package ASCache;
option optimize_for = LITE_RUNTIME;

/**
 * Urls:
 * A list of urls, origin XML described at:
 * http://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-url
 */
message Urls {
  enum UrlType {
    UNKNOWN = 0;
    HOMEPAGE = 1;
    BUGTRACKER = 2;
    FAQ = 3;
    HELP = 4;
    DONATION = 5;
  }

  message Url {
    required UrlType type = 1 [default = UNKNOWN];
    required string url = 2;
  }

  repeated Url url = 1;
}

/**
 * Bundles:
 * A list of bundles, origin XML described at:
 * http://www.freedesktop.org/software/appstream/docs/chap-DistroData.html#tag-distro-bundle
 */
message Bundles {
  enum BundleType {
    UNKNOWN = 0;
    LIMBA = 1;
    XDG_APP = 2;
  }

  message Bundle {
    required BundleType type = 1 [default = UNKNOWN];
    required string id = 2;
  }

  repeated Bundle bundle = 1;
}

/**
 * Icons:
 * A list of preprocessed, absolute icon urls.
 * The definition of icons can be found at:
 * http://www.freedesktop.org/software/appstream/docs/chap-DistroData.html#tag-distro-icon
 * (we only care about the url-types here)
 */
message Icons {
  enum IconType {
    UNKNOWN = 0;
    CACHED = 1;
    REMOTE = 2;
  }

  message Icon {
    required IconType type = 1 [default = UNKNOWN];
    required int32 width = 2;
    required int32 height = 3;
    required string url = 4;
  }

  repeated Icon icon = 1;
}

/**
 * Screenshots:
 * A list of screenshot definitions, origin XML described at:
 * http://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-screenshots
 */
message Screenshots {
  message Image {
    required bool source = 1 [default = false];
    required int32 width  = 2;
    required int32 height = 3;
    required string url = 4;
  }

  message Screenshot {
    required bool primary = 1 [default = false];
    optional string caption = 2;
    repeated Image image = 3;
  }

  repeated Screenshot screenshot = 1;
}

/**
 * ProvidedItems:
 * A list of provided items. We use the semicolon-separated provided-type
 * serialization here.
 * The definition of provided-items can be found at:
 * http://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-provides
 */
message ProvidedItems {
  // Keep ItemType aligned with AsProvidedKind
  enum ItemType {
    UNKNOWN  = 0;
    LIBRARY  = 1;
    BINARY   = 2;
    MIMETYPE = 3;
    FONT     = 4;
    MODALIAS = 5;
    PYTHON_2 = 6;
    PYTHON   = 7;
    DBUS_SYSTEM = 8;
    DBUS_USER   = 9;
    FIRMWARE_RUNTIME = 10;
    FIRMWARE_FLASHED = 11;
  }

  message Provided {
    required ItemType type = 1 [default = UNKNOWN];
    repeated string item = 2;
  }

  repeated Provided provided = 1;
}

/**
 * Languages:
 * A list of localization information, origin XML described at:
 * http://www.freedesktop.org/software/appstream/docs/chap-DistroData.html#tag-distro-languages
 */
message Languages {
  message Language {
    required string locale = 1;
    required int32 percentage = 2 [default = 0];
  }

  repeated Language language = 1;
}

/**
 * Releases:
 * A list of information about releases, origin XML described at:
 * http://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-releases
 */
message Releases {
  enum UrgencyType {
    NOTSET = 0; // can't be UNKNOWN, since we can only have this valud once in this scope
    LOW = 1;
    MEDIUM = 2;
    HIGH = 3;
    CRITICAL = 4;
  }

  enum ChecksumType {
    NONE = 0;
    SHA1 = 1;
    SHA256 = 2;
  }

  enum SizeType {
    UNKNOWN = 0;
    DOWNLOAD = 1;
    INSTALLED = 2;
  }

  message Checksum {
    required ChecksumType type = 1 [default = NONE];
    required string value = 2;
  }

  message Size {
    required SizeType type = 1 [default = UNKNOWN];
    required int64 value = 2;
  }

  message Release {
    required string version = 1;
    required int64 unix_timestamp = 2;
    optional UrgencyType urgency = 3;
    optional string description = 4;
    repeated Checksum checksum = 5;
    repeated string location = 6;
    repeated Size size = 7;
  }

  repeated Release release = 1;
}
