PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Documents" (
"Document_ID" INT UNIQUE,
"Template_ID" INT,
"Document_Name" VARCHAR(255),
PRIMARY KEY ("Document_ID"),
FOREIGN KEY ("Template_ID") REFERENCES "Templates"("Template_ID")
);

CREATE TABLE "Paragraphs" (
"Paragraph_ID" INT,
"Paragraph_Text" VARCHAR(255),
PRIMARY KEY ("Paragraph_ID")
);

CREATE TABLE "Ref_Template_Types" (
"Template_Type_Code" CHAR(15) UNIQUE,
"Template_Type_Description" VARCHAR(255),
PRIMARY KEY ("Template_Type_Code")
);

CREATE TABLE "Templates" (
"Template_ID" INT UNIQUE,
"Template_Type_Code" CHAR(15),
PRIMARY KEY ("Template_ID"),
FOREIGN KEY ("Template_Type_Code") REFERENCES "Ref_Template_Types"("Template_Type_Code")
);





INSERT INTO "Ref_Template_Types" VALUES ("DOC", "Document Template");
INSERT INTO "Ref_Template_Types" VALUES ("PPT", "Presentation Template");
INSERT INTO "Ref_Template_Types" VALUES ("XLS", "Spreadsheet Template");
INSERT INTO "Ref_Template_Types" VALUES ("PDF", "Portable Document Format");
INSERT INTO "Ref_Template_Types" VALUES ("TXT", "Text File Template");
INSERT INTO "Templates" VALUES ("1", "DOC");
INSERT INTO "Templates" VALUES ("2", "PPT");
INSERT INTO "Templates" VALUES ("3", "XLS");
INSERT INTO "Templates" VALUES ("4", "DOC");
INSERT INTO "Templates" VALUES ("5", "PPT");
INSERT INTO "Templates" VALUES ("6", "PPT");
INSERT INTO "Templates" VALUES ("7", "XLS");
INSERT INTO "Templates" VALUES ("8", "PDF");
INSERT INTO "Templates" VALUES ("9", "TXT");
INSERT INTO "Templates" VALUES ("10", "PPT");
INSERT INTO "Documents" VALUES ("101", "1", "Report_Q1_2023");
INSERT INTO "Documents" VALUES ("102", "2", "Sales_Presentation_Q2");
INSERT INTO "Documents" VALUES ("103", "3", "Budget_Analysis_2023");
INSERT INTO "Documents" VALUES ("104", "4", "Meeting_Minutes_20230515");
INSERT INTO "Documents" VALUES ("105", "5", "Project_Proposal_Presentation");
INSERT INTO "Documents" VALUES ("106", "6", "Marketing_Strategy_Deck");
INSERT INTO "Documents" VALUES ("107", "1", "Annual_Review_2022");
INSERT INTO "Documents" VALUES ("108", "2", "Investor_Briefing_Slides");
INSERT INTO "Documents" VALUES ("109", "7", "Financial_Forecast_2024");
INSERT INTO "Documents" VALUES ("110", "8", "User_Manual_V1.0");
INSERT INTO "Documents" VALUES ("111", "9", "Readme_First");
INSERT INTO "Documents" VALUES ("112", "10", "Training_Module_Presentation");
INSERT INTO "Documents" VALUES ("113", "2", "Product_Launch_Presentation");
INSERT INTO "Documents" VALUES ("114", "1", "Policy_Document_Update");
INSERT INTO "Documents" VALUES ("115", "5", "Team_Meeting_Slides");
INSERT INTO "Paragraphs" VALUES ("1", "This is the first paragraph of a document.");
INSERT INTO "Paragraphs" VALUES ("2", "This paragraph contains important data.");
INSERT INTO "Paragraphs" VALUES ("3", "A concluding statement for the report.");
INSERT INTO "Paragraphs" VALUES ("4", "Introduction slide content.");
INSERT INTO "Paragraphs" VALUES ("5", "Key findings and recommendations.");
INSERT INTO "Paragraphs" VALUES ("6", "Detailed budget breakdown.");
INSERT INTO "Paragraphs" VALUES ("7", "Action items from the meeting.");
INSERT INTO "Paragraphs" VALUES ("8", "Project overview and objectives.");
INSERT INTO "Paragraphs" VALUES ("9", "Market analysis and competitive landscape.");
INSERT INTO "Paragraphs" VALUES ("10", "Summary of annual performance.");