import { pascalCase } from '@takeshape/util';
import { applyDefaultsToSchema, emptySchema } from "./schema-util.js";
/**
 * Like emptySchema, but for tests.
 */
export function createMockSchema(projectId, schema = {}) {
    return {
        ...emptySchema(projectId),
        ...schema,
        projectId
    };
}
/**
 * Capturing a common pattern used in tests. Creates an empty schema, with defaults.
 */
export function createMockSchemaWithDefaults(projectId, schema = {}, options) {
    return applyDefaultsToSchema({
        ...emptySchema(projectId),
        ...schema,
        projectId
    }, options);
}
export function createMockServiceConfig(serviceKey, serviceConfig) {
    return {
        id: serviceKey,
        title: pascalCase(serviceKey),
        provider: 'graphql',
        serviceType: 'graphql',
        namespace: pascalCase(serviceKey),
        authenticationType: 'bearer',
        authentication: {
            type: 'bearer',
            token: 'abc123'
        },
        options: {
            endpoint: 'https://example.test/graphql'
        },
        ...serviceConfig
    };
}
export function createMockStoredServiceConfig(serviceKey, serviceConfig) {
    return {
        ...createMockServiceConfig(serviceKey),
        authentication: 'encrypted-abc123',
        ...serviceConfig
    };
}
export function addMockIndexingConfig(shape) {
    return {
        ...shape,
        loaders: {
            list: {
                query: `Query.get${shape.name}List`
            }
        },
        cache: { enabled: true }
    };
}
