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.EnumType;
import jakarta.persistence.Enumerated;
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_sync_history")
@LogicDelete
public class RepositorySyncHistory extends Entity<Long> {
    
    @Column(name = "repository_id", nullable = false)
    private Long repositoryId;
    
    @Column(name = "sync_type", nullable = false)
    @Enumerated(EnumType.STRING)
    private SyncType syncType;
    
    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    private SyncStatus status;
    
    @Column(name = "error_message", columnDefinition = "TEXT")
    private String errorMessage;
    
    @Column(name = "start_time", nullable = false)
    private LocalDateTime startTime;
    
    @Column(name = "end_time")
    private LocalDateTime endTime;
    
    public enum SyncType {
        GROUP, PROJECT, BRANCH
    }
    
    public enum SyncStatus {
        SUCCESS, FAILED, RUNNING
    }
} 