class CreateIndexServiceImpl extends ComponentSupport implements CreateIndexService {

  @Nullable
  public Content buildIndexYaml(final Repository repository) {
    HelmContentFacet helmFacet = repository.facet(HelmContentFacet.class);

    ChartIndex index = new ChartIndex();

    for (Asset asset : helmFacet.browseAssets()) {
      if (AssetKind.HELM_PACKAGE.toString().equals(asset.kind())) {
        parseAssetIntoChartEntry(index, asset);
      }
    }

    index.setApiVersion(API_VERSION);
    index.setGenerated(new DateTime());

    return new Content(new StringPayload(yamlParser.getYamlContent(index), INDEX_YAML_CONTENT_TYPE));
  }

  @Inject public  CreateIndexServiceImpl(final YamlParser yamlParser);

}