"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.orchestratePrismaComponents = orchestratePrismaComponents;
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const typia_1 = __importDefault(require("typia"));
const uuid_1 = require("uuid");
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
const transformPrismaComponentsHistories_1 = require("./histories/transformPrismaComponentsHistories");
function orchestratePrismaComponents(ctx_1, instruction_1) {
    return __awaiter(this, arguments, void 0, function* (ctx, instruction, message = "Design database from the given requirement analysis documents.") {
        var _a, _b, _c, _d;
        const start = new Date();
        const pointer = {
            value: null,
        };
        const prefix = (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _b !== void 0 ? _b : null;
        const { tokenUsage } = yield ctx.conversate({
            source: "prismaComponents",
            histories: (0, transformPrismaComponentsHistories_1.transformPrismaComponentsHistories)(ctx.state(), {
                prefix,
                instruction,
            }),
            controller: createController({
                model: ctx.model,
                build: (next) => {
                    pointer.value = next;
                },
            }),
            enforceFunctionCall: true,
            message,
        });
        if (pointer.value === null)
            throw new Error("Failed to extract files and tables."); // unreachable
        return {
            type: "prismaComponents",
            id: (0, uuid_1.v7)(),
            created_at: start.toISOString(),
            thinking: pointer.value.thinking,
            review: pointer.value.review,
            decision: pointer.value.decision,
            components: pointer.value.components,
            tokenUsage,
            step: (_d = (_c = ctx.state().analyze) === null || _c === void 0 ? void 0 : _c.step) !== null && _d !== void 0 ? _d : 0,
        };
    });
}
function createController(props) {
    (0, assertSchemaModel_1.assertSchemaModel)(props.model);
    const application = collection[props.model];
    return {
        protocol: "class",
        name: "Prisma Extract Files and Tables",
        application,
        execute: {
            extractComponents: (next) => {
                props.build(next);
            },
        },
    };
}
const claude = {
    model: "claude",
    options: {
        reference: true,
        separate: null
    },
    functions: [
        {
            name: "extractComponents",
            parameters: {
                description: "Current Type: {@link IAutoBePrismaComponentApplication.IProps}",
                type: "object",
                properties: {
                    thinking: {
                        description: "Initial thoughts on namespace classification criteria.\n\nContains the AI agent's initial analysis and reasoning about how to\norganize tables into different business domains/namespaces.\n\n**Example:**\n\n    \"Based on the business requirements, I identify several key domains:\n    - User-related entities should be grouped under 'Actors' namespace\n    - Product and sales information under 'Sales' namespace\n    - System configuration under 'Systematic' namespace\"",
                        type: "string"
                    },
                    review: {
                        description: "Review and refinement of the namespace classification.\n\nContains the AI agent's review process, considering relationships between\ntables and potential improvements to the initial classification.\n\n**Example:**\n\n    \"Upon review, I noticed that 'shopping_channel_categories' has strong\n    relationships with both channels and sales. However, since it primarily\n    defines the channel structure, it should remain in 'Systematic' namespace.\"",
                        type: "string"
                    },
                    decision: {
                        description: "Final decision on namespace classification.\n\nContains the AI agent's final reasoning and rationale for the chosen\nnamespace organization, explaining why this structure best serves the\nbusiness requirements.\n\n**Example:**\n\n    \"Final decision: Organize tables into 3 main namespaces:\n    1. Systematic - for channel and system configuration\n    2. Actors - for all user types (customers, citizens, administrators)\n    3. Sales - for product sales and related transactional data\n    This structure provides clear separation of concerns and follows DDD principles.\"",
                        type: "string"
                    },
                    components: {
                        description: "Array of domain components that group related database tables.\n\nEach component represents a business domain and becomes one Prisma schema\nfile. Common domains include: Actors (users), Sales (products), Orders,\nCarts, etc.\n\n**Example:**\n\n```typescript\n{\n  \"components\": [\n    {\n      \"filename\": \"schema-02-systematic.prisma\",\n      \"namespace\": \"Systematic\",\n      \"thinking\": \"These tables all relate to system configuration and channel management. They form the foundation of the platform.\",\n      \"review\": \"Considering the relationships, shopping_channel_categories connects channels and sales, but it fundamentally defines channel structure.\",\n      \"rationale\": \"Grouping all system configuration tables together provides a clear foundation layer that other domains can reference.\",\n      \"tables\": [\n        \"shopping_channels\",\n        \"shopping_sections\",\n        \"shopping_channel_categories\"\n      ]\n    },\n    {\n      \"filename\": \"schema-03-actors.prisma\",\n      \"namespace\": \"Actors\",\n      \"thinking\": \"All user-related entities should be grouped together as they share authentication and identity patterns.\",\n      \"review\": \"While customers interact with sales, the customer entity itself is about identity, not transactions.\",\n      \"rationale\": \"This component groups all actor-related tables to maintain separation between identity management and business transactions.\",\n      \"tables\": [\n        \"shopping_customers\",\n        \"shopping_citizens\",\n        \"shopping_administrators\"\n      ]\n    },\n    {\n      \"filename\": \"schema-04-sales.prisma\",\n      \"namespace\": \"Sales\",\n      \"thinking\": \"Product catalog and sales-related tables belong together as they form the core commerce functionality.\",\n      \"review\": \"Sales snapshots are integral to the sales domain for tracking product history and price changes.\",\n      \"rationale\": \"Consolidating all sales-related tables enables coherent management of the entire product lifecycle.\",\n      \"tables\": [\n        \"shopping_sales\",\n        \"shopping_sale_snapshots\",\n        \"shopping_sale_units\",\n        \"shopping_sale_unit_options\"\n      ]\n    }\n  ]\n}\n```\n\n**Notes:**\n\n- Table names must follow snake_case convention with domain prefix (e.g.,\n  `shopping_customers`)\n- Each component becomes one `.prisma` file containing related models\n- Filename numbering indicates dependency order for schema generation\n- Namespace is used for documentation organization and domain grouping",
                        type: "array",
                        items: {
                            $ref: "#/$defs/AutoBePrisma.IComponent"
                        },
                        minItems: 1
                    }
                },
                required: [
                    "thinking",
                    "review",
                    "decision",
                    "components"
                ],
                additionalProperties: false,
                $defs: {
                    "AutoBePrisma.IComponent": {
                        description: "Interface representing a logical grouping of database tables organized by\nbusiness domain for schema file generation.\n\nComponents provide a systematic way to organize database tables into\ncoherent groups following domain-driven design principles. Each component\nrepresents a specific business domain or functional area that will be\ngenerated as a separate Prisma schema file, ensuring maintainable and\nlogically structured database architecture.\n\nThis interface is primarily used during the database design phase when the\nPrisma agent analyzes requirements and determines the complete scope of\ntables needed, then organizes them into logical groups based on business\nrelationships and functional dependencies.\n\n## Usage in Schema Generation Process\n\nComponents serve as the blueprint for generating multiple Prisma schema\nfiles:\n\n1. **Requirements Analysis**: AI agent identifies all required tables from\n   business requirements\n2. **Domain Grouping**: Tables are organized into components based on business\n   domains and functional relationships\n3. **File Generation**: Each component becomes a separate .prisma file\n   containing related models\n4. **Dependency Management**: Components are ordered to handle cross-domain\n   relationships properly\n\n## Domain Organization Examples\n\nBased on typical business applications, components commonly include:\n\n- **Systematic**: Core system tables (channels, sections, configurations)\n- **Actors**: User management (customers, citizens, administrators)\n- **Sales**: Product catalog and sales entities\n- **Carts**: Shopping cart and item management\n- **Orders**: Order processing and fulfillment\n- **Coupons**: Discount and promotion systems\n- **Coins**: Digital currency and mileage systems\n- **Inquiries**: Customer support and FAQ systems\n- **Favorites**: User preference and wishlist management\n- **Articles**: Content management and BBS systems\n\n## Relationship to {@link AutoBePrisma.IFile}\n\nEach IComponent serves as a blueprint for generating one IFile during the\nschema generation process. The component's metadata (filename, namespace,\ntables) is used to structure the actual Prisma schema file with proper\nmodels, relationships, and indexes.",
                        type: "object",
                        properties: {
                            filename: {
                                description: "Target filename for the Prisma schema file containing this component's\ntables.\n\nFollows the naming convention `schema-{number}-{domain}.prisma` where the\nnumber indicates dependency order and domain represents the business\narea.",
                                type: "string",
                                pattern: "^[a-zA-Z0-9._-]+\\.prisma$"
                            },
                            namespace: {
                                description: "Business domain namespace that groups related models.\n\nUsed in Prisma documentation comments as \"@\\namespace directive\".\nExamples from uploaded schemas: \"Systematic\", \"Actors\", \"Sales\", \"Carts\",\n\"Orders\", \"Coupons\", \"Coins\", \"Inquiries\", \"Favorites\", \"Articles\"",
                                type: "string"
                            },
                            thinking: {
                                description: "Initial thoughts on why these tables belong together.\n\n**Example:**\n\n    \"These tables all relate to user management and authentication.\n    They share common patterns like user identification and access control.\"",
                                type: "string"
                            },
                            review: {
                                description: "Review considerations for this component grouping.\n\n**Example:**\n\n    \"Reviewed relationships with other domains. While customers create orders,\n    the customer entity itself is fundamentally about user identity, not sales.\"",
                                type: "string"
                            },
                            rationale: {
                                description: "Final rationale for this component's composition.\n\n**Example:**\n\n    \"This component groups all actor-related tables to maintain a clear\n    separation between identity management and business transactions.\"",
                                type: "string"
                            },
                            tables: {
                                description: "Array of table names that will be included in this component's schema\nfile.\n\nContains all database table names that belong to this business domain,\nensuring logical grouping and proper organization of related data\nstructures.",
                                type: "array",
                                items: {
                                    type: "string",
                                    pattern: "^[a-z][a-z0-9_]*$"
                                },
                                minItems: 1
                            }
                        },
                        required: [
                            "filename",
                            "namespace",
                            "thinking",
                            "review",
                            "rationale",
                            "tables"
                        ]
                    }
                }
            },
            description: "Organizes database tables into domain-based components for Prisma schema\ngeneration.\n\nTakes business requirements and groups related tables into logical domains,\nwith each component becoming a separate .prisma file.",
            validate: (() => { const _io0 = input => "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.decision && (Array.isArray(input.components) && (1 <= input.components.length && input.components.every(elem => "object" === typeof elem && null !== elem && _io1(elem)))); const _io1 = input => "string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) && "string" === typeof input.namespace && "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.rationale && (Array.isArray(input.tables) && (1 <= input.tables.length && input.tables.every(elem => "string" === typeof elem && RegExp("^[a-z][a-z0-9_]*$").test(elem)))); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
                    path: _path + ".thinking",
                    expected: "string",
                    value: input.thinking
                }), "string" === typeof input.review || _report(_exceptionable, {
                    path: _path + ".review",
                    expected: "string",
                    value: input.review
                }), "string" === typeof input.decision || _report(_exceptionable, {
                    path: _path + ".decision",
                    expected: "string",
                    value: input.decision
                }), (Array.isArray(input.components) || _report(_exceptionable, {
                    path: _path + ".components",
                    expected: "(Array<AutoBePrisma.IComponent> & MinItems<1>)",
                    value: input.components
                })) && ((1 <= input.components.length || _report(_exceptionable, {
                    path: _path + ".components",
                    expected: "Array<> & MinItems<1>",
                    value: input.components
                })) && input.components.map((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
                    path: _path + ".components[" + _index3 + "]",
                    expected: "AutoBePrisma.IComponent",
                    value: elem
                })) && _vo1(elem, _path + ".components[" + _index3 + "]", true && _exceptionable) || _report(_exceptionable, {
                    path: _path + ".components[" + _index3 + "]",
                    expected: "AutoBePrisma.IComponent",
                    value: elem
                })).every(flag => flag)) || _report(_exceptionable, {
                    path: _path + ".components",
                    expected: "(Array<AutoBePrisma.IComponent> & MinItems<1>)",
                    value: input.components
                })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, {
                    path: _path + ".filename",
                    expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">",
                    value: input.filename
                })) || _report(_exceptionable, {
                    path: _path + ".filename",
                    expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)",
                    value: input.filename
                }), "string" === typeof input.namespace || _report(_exceptionable, {
                    path: _path + ".namespace",
                    expected: "string",
                    value: input.namespace
                }), "string" === typeof input.thinking || _report(_exceptionable, {
                    path: _path + ".thinking",
                    expected: "string",
                    value: input.thinking
                }), "string" === typeof input.review || _report(_exceptionable, {
                    path: _path + ".review",
                    expected: "string",
                    value: input.review
                }), "string" === typeof input.rationale || _report(_exceptionable, {
                    path: _path + ".rationale",
                    expected: "string",
                    value: input.rationale
                }), (Array.isArray(input.tables) || _report(_exceptionable, {
                    path: _path + ".tables",
                    expected: "(Array<string & SnakePattern> & MinItems<1>)",
                    value: input.tables
                })) && ((1 <= input.tables.length || _report(_exceptionable, {
                    path: _path + ".tables",
                    expected: "Array<> & MinItems<1>",
                    value: input.tables
                })) && input.tables.map((elem, _index4) => "string" === typeof elem && (RegExp("^[a-z][a-z0-9_]*$").test(elem) || _report(_exceptionable, {
                    path: _path + ".tables[" + _index4 + "]",
                    expected: "string & SnakePattern",
                    value: elem
                })) || _report(_exceptionable, {
                    path: _path + ".tables[" + _index4 + "]",
                    expected: "(string & SnakePattern)",
                    value: elem
                })).every(flag => flag)) || _report(_exceptionable, {
                    path: _path + ".tables",
                    expected: "(Array<string & SnakePattern> & MinItems<1>)",
                    value: input.tables
                })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                if (false === __is(input)) {
                    errors = [];
                    _report = __typia_transform__validateReport._validateReport(errors);
                    ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                        path: _path + "",
                        expected: "IAutoBePrismaComponentApplication.IProps",
                        value: input
                    })) && _vo0(input, _path + "", true) || _report(true, {
                        path: _path + "",
                        expected: "IAutoBePrismaComponentApplication.IProps",
                        value: input
                    }))(input, "$input", true);
                    const success = 0 === errors.length;
                    return success ? {
                        success,
                        data: input
                    } : {
                        success,
                        errors,
                        data: input
                    };
                }
                return {
                    success: true,
                    data: input
                };
            }; })()
        }
    ]
};
const collection = {
    chatgpt: {
        model: "chatgpt",
        options: {
            reference: true,
            strict: false,
            separate: null
        },
        functions: [
            {
                name: "extractComponents",
                parameters: {
                    description: "Current Type: {@link IAutoBePrismaComponentApplication.IProps}",
                    type: "object",
                    properties: {
                        thinking: {
                            description: "Initial thoughts on namespace classification criteria.\n\nContains the AI agent's initial analysis and reasoning about how to\norganize tables into different business domains/namespaces.\n\n**Example:**\n\n    \"Based on the business requirements, I identify several key domains:\n    - User-related entities should be grouped under 'Actors' namespace\n    - Product and sales information under 'Sales' namespace\n    - System configuration under 'Systematic' namespace\"",
                            type: "string"
                        },
                        review: {
                            description: "Review and refinement of the namespace classification.\n\nContains the AI agent's review process, considering relationships between\ntables and potential improvements to the initial classification.\n\n**Example:**\n\n    \"Upon review, I noticed that 'shopping_channel_categories' has strong\n    relationships with both channels and sales. However, since it primarily\n    defines the channel structure, it should remain in 'Systematic' namespace.\"",
                            type: "string"
                        },
                        decision: {
                            description: "Final decision on namespace classification.\n\nContains the AI agent's final reasoning and rationale for the chosen\nnamespace organization, explaining why this structure best serves the\nbusiness requirements.\n\n**Example:**\n\n    \"Final decision: Organize tables into 3 main namespaces:\n    1. Systematic - for channel and system configuration\n    2. Actors - for all user types (customers, citizens, administrators)\n    3. Sales - for product sales and related transactional data\n    This structure provides clear separation of concerns and follows DDD principles.\"",
                            type: "string"
                        },
                        components: {
                            description: "Array of domain components that group related database tables.\n\nEach component represents a business domain and becomes one Prisma schema\nfile. Common domains include: Actors (users), Sales (products), Orders,\nCarts, etc.\n\n**Example:**\n\n```typescript\n{\n  \"components\": [\n    {\n      \"filename\": \"schema-02-systematic.prisma\",\n      \"namespace\": \"Systematic\",\n      \"thinking\": \"These tables all relate to system configuration and channel management. They form the foundation of the platform.\",\n      \"review\": \"Considering the relationships, shopping_channel_categories connects channels and sales, but it fundamentally defines channel structure.\",\n      \"rationale\": \"Grouping all system configuration tables together provides a clear foundation layer that other domains can reference.\",\n      \"tables\": [\n        \"shopping_channels\",\n        \"shopping_sections\",\n        \"shopping_channel_categories\"\n      ]\n    },\n    {\n      \"filename\": \"schema-03-actors.prisma\",\n      \"namespace\": \"Actors\",\n      \"thinking\": \"All user-related entities should be grouped together as they share authentication and identity patterns.\",\n      \"review\": \"While customers interact with sales, the customer entity itself is about identity, not transactions.\",\n      \"rationale\": \"This component groups all actor-related tables to maintain separation between identity management and business transactions.\",\n      \"tables\": [\n        \"shopping_customers\",\n        \"shopping_citizens\",\n        \"shopping_administrators\"\n      ]\n    },\n    {\n      \"filename\": \"schema-04-sales.prisma\",\n      \"namespace\": \"Sales\",\n      \"thinking\": \"Product catalog and sales-related tables belong together as they form the core commerce functionality.\",\n      \"review\": \"Sales snapshots are integral to the sales domain for tracking product history and price changes.\",\n      \"rationale\": \"Consolidating all sales-related tables enables coherent management of the entire product lifecycle.\",\n      \"tables\": [\n        \"shopping_sales\",\n        \"shopping_sale_snapshots\",\n        \"shopping_sale_units\",\n        \"shopping_sale_unit_options\"\n      ]\n    }\n  ]\n}\n```\n\n**Notes:**\n\n- Table names must follow snake_case convention with domain prefix (e.g.,\n  `shopping_customers`)\n- Each component becomes one `.prisma` file containing related models\n- Filename numbering indicates dependency order for schema generation\n- Namespace is used for documentation organization and domain grouping\n\n\n@minItems 1",
                            type: "array",
                            items: {
                                $ref: "#/$defs/AutoBePrisma.IComponent"
                            }
                        }
                    },
                    required: [
                        "thinking",
                        "review",
                        "decision",
                        "components"
                    ],
                    additionalProperties: false,
                    $defs: {
                        "AutoBePrisma.IComponent": {
                            description: "Interface representing a logical grouping of database tables organized by\nbusiness domain for schema file generation.\n\nComponents provide a systematic way to organize database tables into\ncoherent groups following domain-driven design principles. Each component\nrepresents a specific business domain or functional area that will be\ngenerated as a separate Prisma schema file, ensuring maintainable and\nlogically structured database architecture.\n\nThis interface is primarily used during the database design phase when the\nPrisma agent analyzes requirements and determines the complete scope of\ntables needed, then organizes them into logical groups based on business\nrelationships and functional dependencies.\n\n## Usage in Schema Generation Process\n\nComponents serve as the blueprint for generating multiple Prisma schema\nfiles:\n\n1. **Requirements Analysis**: AI agent identifies all required tables from\n   business requirements\n2. **Domain Grouping**: Tables are organized into components based on business\n   domains and functional relationships\n3. **File Generation**: Each component becomes a separate .prisma file\n   containing related models\n4. **Dependency Management**: Components are ordered to handle cross-domain\n   relationships properly\n\n## Domain Organization Examples\n\nBased on typical business applications, components commonly include:\n\n- **Systematic**: Core system tables (channels, sections, configurations)\n- **Actors**: User management (customers, citizens, administrators)\n- **Sales**: Product catalog and sales entities\n- **Carts**: Shopping cart and item management\n- **Orders**: Order processing and fulfillment\n- **Coupons**: Discount and promotion systems\n- **Coins**: Digital currency and mileage systems\n- **Inquiries**: Customer support and FAQ systems\n- **Favorites**: User preference and wishlist management\n- **Articles**: Content management and BBS systems\n\n## Relationship to {@link AutoBePrisma.IFile}\n\nEach IComponent serves as a blueprint for generating one IFile during the\nschema generation process. The component's metadata (filename, namespace,\ntables) is used to structure the actual Prisma schema file with proper\nmodels, relationships, and indexes.",
                            type: "object",
                            properties: {
                                filename: {
                                    description: "Target filename for the Prisma schema file containing this component's\ntables.\n\nFollows the naming convention `schema-{number}-{domain}.prisma` where the\nnumber indicates dependency order and domain represents the business\narea.\n\n\n@pattern ^[a-zA-Z0-9._-]+\\.prisma$",
                                    type: "string"
                                },
                                namespace: {
                                    description: "Business domain namespace that groups related models.\n\nUsed in Prisma documentation comments as \"@\\namespace directive\".\nExamples from uploaded schemas: \"Systematic\", \"Actors\", \"Sales\", \"Carts\",\n\"Orders\", \"Coupons\", \"Coins\", \"Inquiries\", \"Favorites\", \"Articles\"",
                                    type: "string"
                                },
                                thinking: {
                                    description: "Initial thoughts on why these tables belong together.\n\n**Example:**\n\n    \"These tables all relate to user management and authentication.\n    They share common patterns like user identification and access control.\"",
                                    type: "string"
                                },
                                review: {
                                    description: "Review considerations for this component grouping.\n\n**Example:**\n\n    \"Reviewed relationships with other domains. While customers create orders,\n    the customer entity itself is fundamentally about user identity, not sales.\"",
                                    type: "string"
                                },
                                rationale: {
                                    description: "Final rationale for this component's composition.\n\n**Example:**\n\n    \"This component groups all actor-related tables to maintain a clear\n    separation between identity management and business transactions.\"",
                                    type: "string"
                                },
                                tables: {
                                    description: "Array of table names that will be included in this component's schema\nfile.\n\nContains all database table names that belong to this business domain,\nensuring logical grouping and proper organization of related data\nstructures.\n\n\n@minItems 1",
                                    type: "array",
                                    items: {
                                        description: "@pattern ^[a-z][a-z0-9_]*$",
                                        type: "string"
                                    }
                                }
                            },
                            required: [
                                "filename",
                                "namespace",
                                "thinking",
                                "review",
                                "rationale",
                                "tables"
                            ]
                        }
                    }
                },
                description: "Organizes database tables into domain-based components for Prisma schema\ngeneration.\n\nTakes business requirements and groups related tables into logical domains,\nwith each component becoming a separate .prisma file.",
                validate: (() => { const _io0 = input => "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.decision && (Array.isArray(input.components) && (1 <= input.components.length && input.components.every(elem => "object" === typeof elem && null !== elem && _io1(elem)))); const _io1 = input => "string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) && "string" === typeof input.namespace && "string" === typeof input.thinking && "string" === typeof input.review && "string" === typeof input.rationale && (Array.isArray(input.tables) && (1 <= input.tables.length && input.tables.every(elem => "string" === typeof elem && RegExp("^[a-z][a-z0-9_]*$").test(elem)))); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
                        path: _path + ".thinking",
                        expected: "string",
                        value: input.thinking
                    }), "string" === typeof input.review || _report(_exceptionable, {
                        path: _path + ".review",
                        expected: "string",
                        value: input.review
                    }), "string" === typeof input.decision || _report(_exceptionable, {
                        path: _path + ".decision",
                        expected: "string",
                        value: input.decision
                    }), (Array.isArray(input.components) || _report(_exceptionable, {
                        path: _path + ".components",
                        expected: "(Array<AutoBePrisma.IComponent> & MinItems<1>)",
                        value: input.components
                    })) && ((1 <= input.components.length || _report(_exceptionable, {
                        path: _path + ".components",
                        expected: "Array<> & MinItems<1>",
                        value: input.components
                    })) && input.components.map((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
                        path: _path + ".components[" + _index3 + "]",
                        expected: "AutoBePrisma.IComponent",
                        value: elem
                    })) && _vo1(elem, _path + ".components[" + _index3 + "]", true && _exceptionable) || _report(_exceptionable, {
                        path: _path + ".components[" + _index3 + "]",
                        expected: "AutoBePrisma.IComponent",
                        value: elem
                    })).every(flag => flag)) || _report(_exceptionable, {
                        path: _path + ".components",
                        expected: "(Array<AutoBePrisma.IComponent> & MinItems<1>)",
                        value: input.components
                    })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, {
                        path: _path + ".filename",
                        expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">",
                        value: input.filename
                    })) || _report(_exceptionable, {
                        path: _path + ".filename",
                        expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)",
                        value: input.filename
                    }), "string" === typeof input.namespace || _report(_exceptionable, {
                        path: _path + ".namespace",
                        expected: "string",
                        value: input.namespace
                    }), "string" === typeof input.thinking || _report(_exceptionable, {
                        path: _path + ".thinking",
                        expected: "string",
                        value: input.thinking
                    }), "string" === typeof input.review || _report(_exceptionable, {
                        path: _path + ".review",
                        expected: "string",
                        value: input.review
                    }), "string" === typeof input.rationale || _report(_exceptionable, {
                        path: _path + ".rationale",
                        expected: "string",
                        value: input.rationale
                    }), (Array.isArray(input.tables) || _report(_exceptionable, {
                        path: _path + ".tables",
                        expected: "(Array<string & SnakePattern> & MinItems<1>)",
                        value: input.tables
                    })) && ((1 <= input.tables.length || _report(_exceptionable, {
                        path: _path + ".tables",
                        expected: "Array<> & MinItems<1>",
                        value: input.tables
                    })) && input.tables.map((elem, _index4) => "string" === typeof elem && (RegExp("^[a-z][a-z0-9_]*$").test(elem) || _report(_exceptionable, {
                        path: _path + ".tables[" + _index4 + "]",
                        expected: "string & SnakePattern",
                        value: elem
                    })) || _report(_exceptionable, {
                        path: _path + ".tables[" + _index4 + "]",
                        expected: "(string & SnakePattern)",
                        value: elem
                    })).every(flag => flag)) || _report(_exceptionable, {
                        path: _path + ".tables",
                        expected: "(Array<string & SnakePattern> & MinItems<1>)",
                        value: input.tables
                    })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
                    if (false === __is(input)) {
                        errors = [];
                        _report = __typia_transform__validateReport._validateReport(errors);
                        ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
                            path: _path + "",
                            expected: "IAutoBePrismaComponentApplication.IProps",
                            value: input
                        })) && _vo0(input, _path + "", true) || _report(true, {
                            path: _path + "",
                            expected: "IAutoBePrismaComponentApplication.IProps",
                            value: input
                        }))(input, "$input", true);
                        const success = 0 === errors.length;
                        return success ? {
                            success,
                            data: input
                        } : {
                            success,
                            errors,
                            data: input
                        };
                    }
                    return {
                        success: true,
                        data: input
                    };
                }; })()
            }
        ]
    },
    claude,
    llama: claude,
    deepseek: claude,
    "3.1": claude,
};
//# sourceMappingURL=orchestratePrismaComponent.js.map