package backend.resource.serialization;

import java.util.List;
import java.util.stream.Collectors;

import backend.UpdateSignature;
import backend.resource.Model;

/**
 * 100% immutable.
 */
public class SerializableModel {
    public final String repoId;
    public final UpdateSignature updateSignature;

    public final List<SerializableIssue> issues;
    public final List<SerializableLabel> labels;
    public final List<SerializableMilestone> milestones;
    public final List<SerializableUser> users;

    public SerializableModel(Model model) {
        this.repoId = model.getRepoId();
        this.updateSignature = model.getUpdateSignature();

        this.issues = model.getIssues().stream()
            .map(SerializableIssue::new).collect(Collectors.toList());
        this.labels = model.getLabels().stream()
            .map(SerializableLabel::new).collect(Collectors.toList());
        this.milestones = model.getMilestones().stream()
            .map(SerializableMilestone::new).collect(Collectors.toList());
        this.users = model.getUsers().stream()
            .map(SerializableUser::new).collect(Collectors.toList());
    }
}



@@ -1143,13 +1143,496 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        String formatter = %22Model: %7B%25n%22%0A                + %22repoId: %25s%25n%22%0A                + %22updateSignature: %25s%25n%22%0A                + %22users:%25n%25s,%25n%22%0A                + %22labels:%25n%25s,%25n%22%0A                + %22milestones:%25n%25s,%25n%22%0A                + %22issues:%25n%25s%25n%22%0A                + %22%7D%22;%0A%0A        return String.format(%0A                formatter,%0A                repoId, updateSignature,%0A                users, labels, milestones, issues);%0A    %7D
 %0A%7D%0A%0A%0A

Implement SerializableModel's toString