/**
 * GitFlow Types — All interfaces for config, commands, and results.
 * Self-contained: no external imports.
 */

// --- Platform & Environment ---

export type Platform = 'wsl' | 'windows' | 'macos' | 'linux' | 'unknown';
export type Shell = 'bash' | 'zsh' | 'gitbash' | 'powershell' | 'unknown';
export type GitProvider = 'github' | 'azuredevops' | 'unknown';
export type BranchType = 'feature' | 'release' | 'hotfix' | 'main' | 'develop' | 'other';
export type WorktreeMode = 'organized' | 'simple' | 'disabled';

export interface PlatformInfo {
  platform: Platform;
  shell: Shell;
}

// --- GitFlow Config (v2.1.0) ---

export interface GitFlowConfig {
  version: string;
  platform: {
    detected: Platform;
    shell: Shell;
    detectedAt: string;
  };
  workspace: {
    path: string;
    name: string;
  };
  repository: {
    name: string;
    rootFolder: string;
    nameVariants: NameVariants;
    defaultBranch: string;
    remoteUrl: string;
  };
  git: {
    provider: GitProvider;
    branches: {
      main: string;
      develop: string;
    };
    prefixes: {
      feature: string;
      release: string;
      hotfix: string;
    };
  };
  worktrees: {
    enabled: boolean;
    mode: WorktreeMode;
    structure: {
      main: string;
      develop: string;
      features: string;
      releases: string;
      hotfixes: string;
    };
  };
  versioning: {
    strategy: string;
    current: string;
    tagPrefix: string;
    sources: string[];
  };
  efcore: {
    enabled: boolean;
    validateOnCommit: boolean;
    blockDestructive: boolean;
  };
  workflow: {
    push: { afterCommit: string };
    pr: { autoLabels: boolean; requireReview: boolean };
  };
  language: {
    code: string;
  };
}

export interface NameVariants {
  pascalCaseDot: string;
  pascalCase: string;
  kebabCase: string;
  snakeCase: string;
  displayName: string;
}

// --- Git State ---

export interface BranchInfo {
  name: string;
  type: BranchType;
  isLocal: boolean;
  isRemote: boolean;
  aheadRemote: number;
  behindRemote: number;
  lastCommit: { hash: string; date: string; message: string };
  worktreePath?: string;
}

export interface WorktreeInfo {
  path: string;
  branch: string;
  head: string;
  isBare: boolean;
  isPrunable: boolean;
}

export interface TagInfo {
  name: string;
  date: string;
  message: string;
}

export interface GitStatus {
  staged: string[];
  modified: string[];
  untracked: string[];
  dirty: boolean;
}

export interface AheadBehind {
  ahead: number;
  behind: number;
}

// --- Azure DevOps ---

export interface AzureDevOpsInfo {
  org: string;
  project: string;
  repo: string;
}

// --- PR ---

export interface PRInfo {
  number: number;
  url: string;
  title: string;
  state: string;
  source: string;
  target: string;
}

export interface PROptions {
  title: string;
  body: string;
  source: string;
  target: string;
  draft: boolean;
  provider: GitProvider;
  azure?: AzureDevOpsInfo;
}

// --- EF Core ---

export interface MigrationInfo {
  name: string;
  mainFile: string;
  designerFile?: string;
  snapshotFile?: string;
}

export interface EfCoreValidation {
  detected: boolean;
  valid: boolean;
  destructive: boolean;
  migrations: string[];
  missing: string[];
  destructiveOps: string[];
}

// --- Version ---

export interface VersionInfo {
  current: string;
  source: string;
  file?: string;
}

// --- Command Results ---

export interface BaseResult {
  success: boolean;
  error?: string;
}
