import { AutoBeDatabaseSchemaDefinition } from "../histories/contents/AutoBeDatabaseSchemaDefinition"; import { AutoBeAcquisitionEventBase } from "./base/AutoBeAcquisitionEventBase"; import { AutoBeAggregateEventBase } from "./base/AutoBeAggregateEventBase"; import { AutoBeEventBase } from "./base/AutoBeEventBase"; import { AutoBeProgressEventBase } from "./base/AutoBeProgressEventBase"; /** * Event fired when the Database agent generates a single database model for a * target table during the database design process. * * Each AI call produces exactly one target table model. If the agent determines * that additional child tables are needed (e.g. for 1NF decomposition), it * declares them as lightweight designs in * {@link AutoBeDatabaseSchemaDefinition.newDesigns} so they can be generated by * their own dedicated pipeline calls. * * Each event represents the completion of one target table within a namespace. * Multiple events are emitted per namespace, one per target table, enabling * fine-grained progress tracking and parallel generation. * * @author Samchon */ export interface AutoBeDatabaseSchemaEvent extends AutoBeEventBase<"databaseSchema">, AutoBeProgressEventBase, AutoBeAggregateEventBase, AutoBeAcquisitionEventBase<"analysisSections" | "previousAnalysisSections" | "previousDatabaseSchemas"> { /** * Strategic database design analysis and planning phase for the target table. * * Contains the AI agent's analysis of the target table being designed, * including its structure, relationships with other tables, normalization * requirements, and performance considerations. */ plan: string; /** * Business domain namespace where this database table belongs. * * Identifies the logical business domain or functional area that this * database table is part of. The namespace follows domain-driven design * principles, grouping related tables together to maintain coherent schema * organization and clear separation of concerns across different business * areas. * * The namespace determines which Prisma schema file this table will be * written to, enabling systematic development and maintainable database * architecture. Each namespace typically corresponds to a major business * domain such as "Actors", "Sales", or "Systematic". */ namespace: string; /** * Schema definition containing the single target table model and any newly * discovered table designs. * * Carries exactly one model (the target table) produced by a single schema * generation call so that the AI output stays within the LLM's maximum output * token limit. Additional child tables needed for normalization are declared * in {@link AutoBeDatabaseSchemaDefinition.newDesigns} as lightweight name + * description pairs and are generated by subsequent pipeline calls. */ definition: AutoBeDatabaseSchemaDefinition; /** * Iteration number of the requirements analysis this schema was generated * for. * * Tracks which version of the business requirements this database schema * reflects, ensuring alignment between the evolving requirements and the * generated data models. As requirements change through iterations, this step * number helps maintain traceability and version consistency across the * database architecture development process. */ step: number; }