package com.salpa.subject.domain.data;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.salpa.subject.domain.MonitorTableColumnDocument;
import com.salpa.subject.domain.diff.DiffAble;
import com.salpa.subject.domain.diff.data.DiffType;
import lombok.Data;

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

@Data
public class DatabaseDocumentSimpleResponse {

    private Integer id;

    private String projectName;

    private String databaseName;

    private String schemaName;

    private String productName;

    private String productVersion;

    private Long documentVersion;

    private List<TableData> tables = new ArrayList<>();

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT +8")
    private LocalDateTime createAt;

    private DiffType diffType;

    @Data
    public static class TableData implements DiffAble<TableData> {

        private Integer id;

        private String name;

        private String type;

        private String comment;

        private List<MonitorTableColumnDocument> columns = new ArrayList<>();

        private Integer discussionCount;

        private String description;

        private DiffType diffType;

        private TableData original;

    }
}
