package com.qqchen.deploy.backend.deploy.entity;

import com.qqchen.deploy.backend.framework.annotation.LogicDelete;
import com.qqchen.deploy.backend.framework.domain.Entity;
import jakarta.persistence.Column;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "deploy_repo_branch")
@LogicDelete
public class RepositoryBranch extends Entity<Long> {

    @Column(nullable = false)
    private String name;

    @Column(name = "last_commit_id")
    private String lastCommitId;

    @Column(name = "commit_message", columnDefinition = "TEXT")
    private String commitMessage;

    @Column(name = "commit_author")
    private String commitAuthor;

    @Column(name = "commit_date")
    private LocalDateTime commitDate;

    @Column(name = "last_update_time")
    private LocalDateTime lastUpdateTime;

    @Column(name = "last_commit_time")
    private LocalDateTime lastCommitTime;

    @Column(name = "developers_can_push")
    private Boolean developersCanPush = true;

    @Column(name = "developers_can_merge")
    private Boolean developersCanMerge = true;

    @Column(name = "can_push")
    private Boolean canPush = true;

    @Column(name = "is_default_branch")
    private Boolean isDefaultBranch = false;

    @Column(name = "web_url")
    private String webUrl;

    @Column(name = "project_id", nullable = false)
    private Long projectId;  // 我们数据库的project表的ID

    @Column(name = "repo_project_id", nullable = false)
    private Long repoProjectId;  // GitLab的真实project_id

    @Column(name = "external_system_id", nullable = false)
    private Long externalSystemId;
}