package com.microservices.cms.doc.domain.gitlink;

import lombok.Data;

/**
 * @author otto
 */
@Data
public class EntryDto implements Comparable<EntryDto> {
    private String name;
    private String path;
    private String sha;
    private String type;
    private Long size;
    private Boolean is_readme_file;
    private String content;
    private String target;
    private CommitDto commit;

    @Override
    public int compareTo(EntryDto entryDto) {
        // 重写Comparable接口的compareTo方法，根据年龄升序排列，降序修改相减顺序即可
        return Math.toIntExact(entryDto.getCommit().getCreated_at_unix() - this.commit.getCreated_at_unix());
    }
}
