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 "Templates" (
"Template_ID" INT UNIQUE,
"Template_Details" VARCHAR(255),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Templates" VALUES ("1", "Standard Letter Template");
INSERT INTO "Templates" VALUES ("2", "Invoice Template");
INSERT INTO "Templates" VALUES ("3", "Report Template");
INSERT INTO "Templates" VALUES ("4", "Contract Template");
INSERT INTO "Templates" VALUES ("5", "Memo Template");
INSERT INTO "Templates" VALUES ("6", "Unused Template A");
INSERT INTO "Templates" VALUES ("7", "Unused Template B");
INSERT INTO "Documents" VALUES ("101", "1", "Letter to Client A");
INSERT INTO "Documents" VALUES ("102", "2", "Invoice #2023-001");
INSERT INTO "Documents" VALUES ("103", "1", "Letter to Supplier B");
INSERT INTO "Documents" VALUES ("104", "3", "Quarterly Sales Report");
INSERT INTO "Documents" VALUES ("105", "4", "Service Agreement v1.0");
INSERT INTO "Documents" VALUES ("106", "2", "Invoice #2023-002");
INSERT INTO "Documents" VALUES ("107", "5", "Internal Memo Q3");
INSERT INTO "Paragraphs" VALUES ("1001", "This is the first paragraph of a document.");
INSERT INTO "Paragraphs" VALUES ("1002", "This paragraph contains important details.");
INSERT INTO "Paragraphs" VALUES ("1003", "Concluding remarks for the document.");
INSERT INTO "Paragraphs" VALUES ("1004", "Another paragraph for a different document.");
INSERT INTO "Paragraphs" VALUES ("1005", "A short paragraph.");