import { z } from 'zod';
export const GitFileStatusSchema = z.enum([
    'added',
    'modified',
    'deleted',
    'renamed',
    'copied',
    'type-changed',
    'unmerged',
    'unknown',
]);
export const GitChangedFileSchema = z.object({
    status: GitFileStatusSchema,
    path: z.string(),
    oldPath: z.string().optional(),
    similarity: z.number().optional(),
    binary: z.boolean().optional(),
});
export const GitNumstatSchema = z.object({
    path: z.string(),
    oldPath: z.string().optional(),
    added: z.number().nullable(),
    deleted: z.number().nullable(),
    binary: z.boolean().optional(),
});
export const GitRangeKindSchema = z.enum(['three-dot', 'two-dot', 'working-tree', 'staged', 'commit']);
/**
 * How two explicit endpoints are compared.
 *
 * `merge-base` answers "what did head add since it diverged from base", which is
 * the review-shaped question and stays the default. `exact` answers "what
 * differs between exactly these two revisions" — the two are not the same, and
 * silently giving the first to a caller who asked for the second drops every
 * change unique to `base`.
 */
export const GitRangeModeSchema = z.enum(['merge-base', 'exact']);
export const GitRangeSchema = z.object({
    base: z.string().optional(),
    head: z.string().optional(),
    kind: GitRangeKindSchema,
    mergeBase: z.string().optional(),
    resolvedBase: z.string().optional(),
    resolvedHead: z.string().optional(),
    describe: z.string(),
});
export const GitDiffSummarySchema = z.object({
    range: GitRangeSchema,
    files: z.array(GitChangedFileSchema),
    numstat: z.array(GitNumstatSchema),
    totalAdded: z.number(),
    totalDeleted: z.number(),
    filesChanged: z.number(),
    binaryFiles: z.number(),
});
export const GitDiffPatchSchema = z.object({
    range: GitRangeSchema,
    patch: z.string(),
    truncated: z.boolean(),
    tokensUsed: z.number(),
    tokenBudget: z.number().optional(),
    filesIncluded: z.number(),
    filesOmitted: z.number(),
});
export const GitDiffHunkSchema = z.object({
    path: z.string(),
    oldPath: z.string().optional(),
    oldStart: z.number(),
    oldLines: z.number(),
    newStart: z.number(),
    newLines: z.number(),
    newEnd: z.number(),
    header: z.string(),
    addedLines: z.array(z.number()),
    deletedLines: z.array(z.number()),
    deletedLineTexts: z
        .array(z.object({
        line: z.number(),
        text: z.string(),
    }))
        .optional(),
});
export const GitFileHunksSchema = z.object({
    path: z.string(),
    oldPath: z.string().optional(),
    binary: z.boolean(),
    hunks: z.array(GitDiffHunkSchema),
});
export const GitDiffHunksSchema = z.object({
    range: GitRangeSchema,
    files: z.array(GitFileHunksSchema),
});
export const GitCommitSchema = z.object({
    hash: z.string(),
    shortHash: z.string(),
    authorName: z.string(),
    authorEmail: z.string(),
    authorDate: z.string(),
    committerDate: z.string(),
    subject: z.string(),
    body: z.string().optional(),
});
export const GitCommitHistorySchema = z.object({
    range: GitRangeSchema.optional(),
    commits: z.array(GitCommitSchema),
    total: z.number(),
    truncated: z.boolean(),
    pathFilter: z.string().optional(),
});
export const GitFileHistoryEntrySchema = GitCommitSchema.extend({
    added: z.number().nullable(),
    deleted: z.number().nullable(),
});
export const GitFileHistorySchema = z.object({
    path: z.string(),
    lineRange: z.object({ start: z.number(), end: z.number() }).optional(),
    entries: z.array(GitFileHistoryEntrySchema),
    total: z.number(),
    truncated: z.boolean(),
});
export const GitChurnEntrySchema = z.object({
    path: z.string(),
    commits: z.number(),
    added: z.number(),
    deleted: z.number(),
    net: z.number(),
    churn: z.number(),
    lastTouched: z.string(),
});
export const GitChurnSortSchema = z.enum(['churn', 'commits', 'added', 'deleted', 'net']);
export const GitChurnSummarySchema = z.object({
    range: GitRangeSchema,
    entries: z.array(GitChurnEntrySchema),
    totalCommits: z.number(),
    sortedBy: GitChurnSortSchema,
});
export const GitCochangePairSchema = z.object({
    fileA: z.string(),
    fileB: z.string(),
    count: z.number(),
    lift: z.number(),
    lastCochangedAt: z.string(),
});
export const GitCochangeAggregationOptionsSchema = z.object({
    target: z.string().optional(),
    limit: z.number().int().positive().optional(),
    maxCommitFiles: z.number().int().positive().optional(),
});
export const GitCochangeSummarySchema = z.object({
    range: GitRangeSchema,
    pairs: z.array(GitCochangePairSchema),
    totalCommits: z.number(),
    consideredCommits: z.number(),
    skippedCommits: z.number(),
    maxCommitFiles: z.number(),
    target: z.string().optional(),
});
/**
 * A single path changed by one commit, carrying the blob object ids on both
 * sides. The blob id is what makes historical entity extraction affordable:
 * it addresses the exact bytes of that file at that revision, so parsed
 * results can be cached content-addressably and are never recomputed for
 * content that has been seen before — including after a rebase, which changes
 * commit ids but not blob ids.
 *
 * `oldBlobSha` is absent for an addition and `newBlobSha` for a deletion; git's
 * all-zero placeholder is normalized away rather than surfaced.
 */
export const GitCommitFileChangeSchema = z.object({
    status: GitFileStatusSchema,
    path: z.string(),
    oldPath: z.string().optional(),
    similarity: z.number().optional(),
    oldBlobSha: z.string().optional(),
    newBlobSha: z.string().optional(),
    oldMode: z.string().optional(),
    newMode: z.string().optional(),
});
export const GitCommitFileChangesSchema = z.object({
    commit: z.string(),
    /**
     * True when the commit has more than one parent. `diff-tree` reports no
     * changes for a merge without `-m`/`-c`, so merges legitimately carry an
     * empty `files` array; the flag distinguishes that from a genuinely empty
     * commit.
     */
    isMerge: z.boolean(),
    files: z.array(GitCommitFileChangeSchema),
});
export const GitTreeEntrySchema = z.object({
    path: z.string(),
    blobSha: z.string(),
    mode: z.string(),
});
export const GitRepoInfoSchema = z.object({
    repoRoot: z.string(),
    defaultBranch: z.string().optional(),
    head: z.string().optional(),
    isDirty: z.boolean(),
    currentBranch: z.string().optional(),
    shallow: z.boolean(),
    detached: z.boolean(),
    gitVersion: z.string().optional(),
});
//# sourceMappingURL=types.js.map