package backend.resource.serialization;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import backend.resource.TurboIssue;

public class SerializableIssue {
    private int id = 0;
    private String title = "";
    private String creator = "";
    private LocalDateTime createdAt = LocalDateTime.now();
    private boolean isPullRequest = false;
    private String description = "";
    private LocalDateTime updatedAt = LocalDateTime.now();
    private int commentCount = 0;
    private boolean isOpen = true;
    private Optional<String> assignee = Optional.empty();
    private List<String> labels = new ArrayList<>();
    private Optional<Integer> milestone = Optional.empty();

    public SerializableIssue(TurboIssue issue) {
        this.id = issue.getId();
        this.title = issue.getTitle();
        this.creator = issue.getCreator();
        this.createdAt = issue.getCreatedAt();
        this.isPullRequest = issue.isPullRequest();
        this.description = issue.getDescription();
        this.updatedAt = issue.getUpdatedAt();
        this.commentCount = issue.getCommentCount();
        this.isOpen = issue.isOpen();
        this.assignee = issue.getAssignee();
        this.labels = issue.getLabels();
        this.milestone = issue.getMilestone();
    }

    public int getId() {
        return id;
    }
    public String getTitle() {
        return title;
    }
    public String getCreator() {
        return creator;
    }
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }
    public boolean isPullRequest() {
        return isPullRequest;
    }
    public String getDescription() {
        return description;
    }
    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }
    public int getCommentCount() {
        return commentCount;
    }
    public boolean isOpen() {
        return isOpen;
    }
    public Optional<String> getAssignee() {
        return assignee;
    }
    public List<String> getLabels() {
        return labels;
    }
    public Optional<Integer> getMilestone() {
        return milestone;
    }
}

@@ -2146,11 +2146,1003 @@
 e;%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        String formatter = %22Issue: %7B%25n%22%0A                + %22  id: %25d,%25n%22%0A                + %22  title: %25s,%25n%22%0A                + %22  creator: %25s,%25n%22%0A                + %22  createdAt: %25s,%25n%22%0A                + %22  isPullRequest: %25b,%25n%22%0A                + %22  description: %25s,%25n%22%0A                + %22  updatedAt: %25s,%25n%22%0A                + %22  commentCount: %25s,%25n%22%0A                + %22  isOpen: %25s,%25n%22%0A                + %22  assignee: %25s,%25n%22%0A                + %22  labels: %25s,%25n%22%0A                + %22  milestone: %25s,%25n%22%0A                + %22%7D%22;%0A%0A        return String.format(%0A                formatter,%0A                getId(), getTitle(), getCreator(), getCreatedAt(),%0A                isPullRequest(), getDescription(), getUpdatedAt(),%0A                getCommentCount(), isOpen(),%0A                getAssignee().isPresent() ? getAssignee().get() : %22%22,%0A                getLabels(),%0A                getMilestone().isPresent() ? getMilestone().get().toString() : %22%22);%0A    %7D
 %0A%7D%0A

Implement SerializableIssue's toString