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,
"Document_ID" INT,
"Paragraph_Text" VARCHAR(255),
PRIMARY KEY ("Paragraph_ID"),
FOREIGN KEY ("Document_ID") REFERENCES "Documents"("Document_ID")
);

CREATE TABLE "Templates" (
"Template_ID" INT,
"Template_Details" VARCHAR(255),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Templates" VALUES ("1", "Standard Business Letter");
INSERT INTO "Templates" VALUES ("2", "Marketing Brochure Template");
INSERT INTO "Templates" VALUES ("3", "Technical Report Template");
INSERT INTO "Templates" VALUES ("4", "Meeting Minutes Template");
INSERT INTO "Templates" VALUES ("5", "Legal Contract Template");
INSERT INTO "Documents" VALUES ("101", "1", "Client Welcome Letter");
INSERT INTO "Documents" VALUES ("102", "2", "Product Launch Brochure");
INSERT INTO "Documents" VALUES ("103", "3", "Q3 Performance Report");
INSERT INTO "Documents" VALUES ("104", "1", "Follow-up Email");
INSERT INTO "Documents" VALUES ("105", "4", "Team Meeting Minutes");
INSERT INTO "Documents" VALUES ("106", "5", "Service Agreement");
INSERT INTO "Documents" VALUES ("107", "2", "Holiday Sale Flyer");
INSERT INTO "Documents" VALUES ("108", "3", "Annual Technical Review");
INSERT INTO "Documents" VALUES ("109", "1", "Invoice Reminder");
INSERT INTO "Documents" VALUES ("110", "4", "Project Kick-off Minutes");
INSERT INTO "Documents" VALUES ("111", "1", "Empty Document Test");
INSERT INTO "Paragraphs" VALUES ("1", "101", "Dear Valued Client,");
INSERT INTO "Paragraphs" VALUES ("2", "101", "Welcome to our services. We are thrilled to have you on board.");
INSERT INTO "Paragraphs" VALUES ("3", "101", "Please find attached important information regarding your new account.");
INSERT INTO "Paragraphs" VALUES ("4", "101", "We look forward to a successful partnership.");
INSERT INTO "Paragraphs" VALUES ("5", "102", "Introducing our revolutionary new product!");
INSERT INTO "Paragraphs" VALUES ("6", "102", "Experience unparalleled performance and features.");
INSERT INTO "Paragraphs" VALUES ("7", "103", "This report summarizes our Q3 performance.");
INSERT INTO "Paragraphs" VALUES ("8", "103", "Key metrics show significant growth in revenue.");
INSERT INTO "Paragraphs" VALUES ("9", "103", "Challenges and opportunities for the next quarter are also discussed.");
INSERT INTO "Paragraphs" VALUES ("10", "104", "Following up on our recent conversation.");
INSERT INTO "Paragraphs" VALUES ("11", "105", "Meeting held on October 26, 2023.");
INSERT INTO "Paragraphs" VALUES ("12", "105", "Attendees: John, Jane, Mike.");
INSERT INTO "Paragraphs" VALUES ("13", "105", "Action items assigned to relevant team members.");
INSERT INTO "Paragraphs" VALUES ("14", "106", "This Service Agreement "Agreement" is entered into...");
INSERT INTO "Paragraphs" VALUES ("15", "106", "Terms and conditions apply.");
INSERT INTO "Paragraphs" VALUES ("16", "107", "Dont miss our amazing holiday sale!");
INSERT INTO "Paragraphs" VALUES ("17", "108", "The annual technical review covers all major projects.");
INSERT INTO "Paragraphs" VALUES ("18", "108", "Detailed analysis of system architecture.");
INSERT INTO "Paragraphs" VALUES ("19", "109", "This is a friendly reminder regarding your outstanding invoice.");
INSERT INTO "Paragraphs" VALUES ("20", "110", "Minutes for the project kick-off meeting.");