export type TSyncStatus = 'active' | 'paused' | 'error';

export interface ISyncConfig {
  id: string;
  name: string;
  sourceConnectionId: string;
  targetConnectionId: string;
  targetGroupOffset?: string;    // Path prefix for target repos (e.g. "mirror/gitlab")
  intervalMinutes: number;      // Default 5
  status: TSyncStatus;
  lastSyncAt: number;
  lastSyncError?: string;
  lastSyncDurationMs?: number;
  reposSynced: number;
  enforceDelete: boolean;         // When true, stale target repos are moved to obsolete
  enforceGroupDelete: boolean;    // When true, stale target groups/orgs are moved to obsolete
  addMirrorHint?: boolean;        // When true, target descriptions get "(This is a mirror of ...)" appended
  useGroupAvatarsForProjects?: boolean; // When true, projects without avatars inherit the group avatar
  createdAt: number;
}

export interface ISyncRepoStatus {
  id: string;
  syncConfigId: string;
  sourceFullPath: string;       // e.g. "push.rocks/smartstate"
  targetFullPath: string;       // e.g. "foss.global/push.rocks/smartstate"
  lastSyncAt: number;
  lastSyncError?: string;
  status: 'synced' | 'error' | 'pending';
}

export interface ISyncLogEntry {
  timestamp: number;
  level: 'info' | 'warn' | 'error' | 'success' | 'debug';
  message: string;
  source?: string;   // e.g. 'preview', 'sync', 'git', 'api'
}
