import { z } from 'zod';
import { SccLanguageSchema } from '../scc.js';
import { SkippedEntrySchema } from '../types.js';
import { StructureNodeSchema } from '../structure/types.js';
export const WorkspaceScopeSchema = z.enum(['code', 'document', 'structure', 'reference']);
export const WorkspaceErrorSchema = z.object({
    scope: WorkspaceScopeSchema,
    path: z.string().optional(),
    message: z.string(),
});
export const WorkspaceDocumentAggregateEntrySchema = z.object({
    type: z.string(),
    count: z.number(),
    words: z.number(),
    pages: z.number(),
    paragraphs: z.number(),
    sheets: z.number(),
    rows: z.number(),
    cells: z.number(),
    slides: z.number(),
    size: z.number(),
});
export const WorkspaceDocumentTotalsSchema = z.object({
    files: z.number(),
    words: z.number(),
    pages: z.number(),
    paragraphs: z.number(),
    sheets: z.number(),
    rows: z.number(),
    cells: z.number(),
    slides: z.number(),
    size: z.number(),
});
export const WorkspaceDocumentAggregatesSchema = z.object({
    files: z.array(WorkspaceDocumentAggregateEntrySchema),
    totals: WorkspaceDocumentTotalsSchema,
});
export const WorkspaceCodeTotalsSchema = z.object({
    totalFiles: z.number(),
    totalLines: z.number(),
    totalCode: z.number(),
    totalComment: z.number(),
    totalBlank: z.number(),
});
export const WorkspaceCodeAnalysisSchema = z.object({
    languages: z.array(SccLanguageSchema),
    totals: WorkspaceCodeTotalsSchema,
});
export const WorkspaceStructureEntrySchema = z.object({
    file: z.string(),
    totalNodes: z.number(),
    maxDepth: z.number(),
    nodes: z.array(StructureNodeSchema),
});
export const WorkspaceAnalysisSummarySchema = z.object({
    elapsedMs: z.number(),
    code: WorkspaceCodeTotalsSchema.nullable(),
    documents: WorkspaceDocumentTotalsSchema.nullable(),
    structures: z.number(),
});
export const WorkspaceAnalysisSchema = z.object({
    schemaVersion: z.literal(1),
    rootDir: z.string(),
    summary: WorkspaceAnalysisSummarySchema,
    code: WorkspaceCodeAnalysisSchema.nullable(),
    documents: z
        .object({
        aggregates: WorkspaceDocumentAggregatesSchema,
    })
        .nullable(),
    structures: z.array(WorkspaceStructureEntrySchema),
    skipped: z.array(SkippedEntrySchema),
    errors: z.array(WorkspaceErrorSchema),
});
export const WorkspaceDocumentSummarySchema = z.object({
    filePath: z.string(),
    relativePath: z.string(),
    format: z.string(),
    title: z.string().optional(),
    words: z.number(),
    pages: z.number(),
    tokenEstimate: z.number(),
    headingCount: z.number(),
    topLevelSections: z.array(z.string()),
    markdownContent: z.string().optional(),
});
export const WorkspaceCrossReferenceSchema = z.object({
    sourceFile: z.string(),
    targetFile: z.string(),
    referenceType: z.enum(['filename-mention', 'hyperlink', 'citation']),
    context: z.string(),
    line: z.number().optional(),
});
export const WorkspaceUnresolvedMentionSchema = z.object({
    sourceFile: z.string(),
    mention: z.string(),
    context: z.string(),
});
export const WorkspaceDocumentSetSchema = z.object({
    schemaVersion: z.literal(1),
    rootDir: z.string(),
    documents: z.array(WorkspaceDocumentSummarySchema),
    crossReferences: z.array(WorkspaceCrossReferenceSchema),
    unresolvedMentions: z.array(WorkspaceUnresolvedMentionSchema),
    skipped: z.array(SkippedEntrySchema),
    errors: z.array(z.object({
        path: z.string().optional(),
        message: z.string(),
    })),
});
export const WorkspaceDescriptionPrimaryTypeSchema = z.enum([
    'coding-project',
    'office-project',
    'documentation-project',
    'data-project',
    'mixed-project',
    'empty-directory',
    'general-folder',
]);
export const WorkspaceDescriptionConfidenceSchema = z.enum(['high', 'medium', 'low']);
export const WorkspaceFileCategorySchema = z.enum([
    'code',
    'office',
    'prose',
    'data',
    'config',
    'image',
    'binary',
    'other',
]);
export const WorkspaceCategoryBreakdownSchema = z.object({
    files: z.number(),
    bytes: z.number(),
    pct: z.number(),
});
export const WorkspaceDescriptionMarkerSchema = z.object({
    path: z.string(),
    kind: z.string(),
    label: z.string(),
});
export const WorkspaceDescriptionProjectSchema = z.object({
    path: z.string(),
    kinds: z.array(z.string()),
    markers: z.array(z.string()),
    frameworks: z.array(z.string()),
    packageManager: z.string().optional(),
    entryPoints: z.array(z.string()).optional(),
    scripts: z.array(z.string()).optional(),
    buildSystem: z.string().optional(),
    testFramework: z.string().optional(),
    platforms: z.array(z.string()).optional(),
    confidence: WorkspaceDescriptionConfidenceSchema,
});
export const WorkspaceRecommendedCallSchema = z.object({
    namespace: z.enum(['workspace', 'code', 'doc', 'sheet', 'slide']),
    method: z.string(),
    args: z.record(z.string(), z.unknown()),
});
export const WorkspaceDescriptionSchema = z.object({
    schemaVersion: z.literal(1),
    rootDir: z.string(),
    classification: z.object({
        primaryType: WorkspaceDescriptionPrimaryTypeSchema,
        confidence: WorkspaceDescriptionConfidenceSchema,
        summary: z.string(),
        labels: z.array(z.string()),
    }),
    composition: z.object({
        totals: z.object({
            files: z.number(),
            bytes: z.number(),
        }),
        byCategory: z.record(WorkspaceFileCategorySchema, WorkspaceCategoryBreakdownSchema),
        byExtension: z.record(z.string(), z.number()),
        dominantExtensions: z.array(z.object({
            ext: z.string(),
            files: z.number(),
        })),
    }),
    signals: z.object({
        manifests: z.array(WorkspaceDescriptionMarkerSchema),
        markers: z.array(WorkspaceDescriptionMarkerSchema),
        frameworks: z.array(z.string()),
        packageManager: z.string().optional(),
        hasCode: z.boolean(),
        hasDocuments: z.boolean(),
        hasOfficeDocuments: z.boolean(),
        hasTables: z.boolean(),
        hasNotebooks: z.boolean(),
    }),
    projects: z.array(WorkspaceDescriptionProjectSchema),
    projectSummary: z.object({
        total: z.number(),
        shown: z.number(),
        truncated: z.boolean(),
    }),
    recommendedCommands: z.array(z.string()),
    recommendedCalls: z.array(WorkspaceRecommendedCallSchema),
});
//# sourceMappingURL=types.js.map