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 Letter Template");
INSERT INTO "Templates" VALUES ("2", "Report Template A");
INSERT INTO "Templates" VALUES ("3", "Marketing Brochure Template");
INSERT INTO "Templates" VALUES ("4", "Meeting Minutes Template");
INSERT INTO "Templates" VALUES ("5", "Project Proposal Template");
INSERT INTO "Documents" VALUES ("101", "1", "Summer Show");
INSERT INTO "Documents" VALUES ("102", "2", "Annual Report 2023");
INSERT INTO "Documents" VALUES ("103", "3", "Product Launch Brochure");
INSERT INTO "Documents" VALUES ("104", "1", "Winter Gala Invitation");
INSERT INTO "Documents" VALUES ("105", "4", "Board Meeting Minutes");
INSERT INTO "Documents" VALUES ("106", "1", "Summer Show - Draft");
INSERT INTO "Documents" VALUES ("107", "5", "New Initiative Proposal");
INSERT INTO "Documents" VALUES ("108", "2", "Quarterly Review Q1");
INSERT INTO "Paragraphs" VALUES ("1", "101", "Welcome to the Summer Show!");
INSERT INTO "Paragraphs" VALUES ("2", "101", "This year features exciting new acts.");
INSERT INTO "Paragraphs" VALUES ("3", "101", "Join us for a day of fun and entertainment.");
INSERT INTO "Paragraphs" VALUES ("4", "101", "Tickets are available online.");
INSERT INTO "Paragraphs" VALUES ("5", "102", "Executive Summary of the year.");
INSERT INTO "Paragraphs" VALUES ("6", "102", "Financial performance overview.");
INSERT INTO "Paragraphs" VALUES ("7", "103", "Discover our latest innovation.");
INSERT INTO "Paragraphs" VALUES ("8", "104", "You are cordially invited.");
INSERT INTO "Paragraphs" VALUES ("9", "105", "Meeting commenced at 10:00 AM.");
INSERT INTO "Paragraphs" VALUES ("10", "106", "Draft paragraph 1 for Summer Show.");
INSERT INTO "Paragraphs" VALUES ("11", "106", "Draft paragraph 2 for Summer Show.");
INSERT INTO "Paragraphs" VALUES ("12", "107", "Introduction to the project.");
INSERT INTO "Paragraphs" VALUES ("13", "108", "First quarter results.");