/**
 * Minimal global `product_feedback` schema so generic `submit_entity` can store rows
 * without a separate one-shot seed script.
 */
import { SchemaRegistryService } from "../schema_registry.js";
export const PRODUCT_FEEDBACK_ENTITY_TYPE = "product_feedback";
export async function ensureProductFeedbackSchemaForSubmission(options) {
    const registry = options?.registry ?? new SchemaRegistryService();
    const existing = await registry.loadGlobalSchema(PRODUCT_FEEDBACK_ENTITY_TYPE);
    if (existing)
        return existing;
    const schema_definition = {
        fields: {
            schema_version: { type: "string", required: true },
            title: { type: "string", required: true, description: "Short summary" },
            body: { type: "string", description: "Detail in markdown" },
            created_at: { type: "date", required: true, description: "ISO creation time" },
            source: { type: "string", description: "Optional provenance label" },
        },
        canonical_name_fields: ["title", "created_at"],
    };
    return await registry.register({
        entity_type: PRODUCT_FEEDBACK_ENTITY_TYPE,
        schema_version: "1.0",
        schema_definition,
        reducer_config: {
            merge_policies: {
                schema_version: { strategy: "last_write" },
                title: { strategy: "last_write" },
                body: { strategy: "last_write" },
                created_at: { strategy: "last_write" },
                source: { strategy: "last_write" },
            },
        },
        user_specific: false,
        activate: true,
        metadata: {
            label: "Product feedback",
            description: "Structured feedback submissions (generic entity submission).",
            category: "productivity",
            guest_access_policy: "submit_only",
        },
    });
}
//# sourceMappingURL=seed_product_feedback_schema.js.map