package com.google.graphgeckos.dashboard.fetchers;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Map;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CommitData {

  // Git commit hash
  @JsonProperty("after")
  private final String commitHash;

  @JsonProperty("ref")
  private final String branch;

  private String timestamp;

  private String repositoryName;

  @JsonProperty("repository")
  private void unpackRepositoryData(Map<String, Object> repository) {
    timestamp = repository.get("updated-at").toString();
    repositoryName = repository.get("name").toString();
  }

  CommitData(String commitHash, String branch) {
    this.commitHash = commitHash;
    this.branch = branch;
  }

  public String getBranch() {
    return branch;
  }

  public String getCommitHash() {
    return commitHash;
  }

  public String getTimestamp() {
    return timestamp;
  }

  public String getRepositoryName() {
    return repositoryName;
  }
}

@@ -449,20 +449,20 @@
 pository
-Name
+Link
 ;%0A%0A  @Js
@@ -627,20 +627,20 @@
 pository
-Name
+Link
  = repos
@@ -654,12 +654,16 @@
 et(%22
-name
+html_url
 %22).t

change repositoryName field to repositoryLink