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,
"Document_Name" VARCHAR(255),
"Document_Description" VARCHAR(255),
PRIMARY KEY ("Document_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 "Documents" VALUES ("1", "Employee Handbook", "Company policies and procedures");
INSERT INTO "Documents" VALUES ("2", "Project Plan", "Detailed project timeline and milestones");
INSERT INTO "Documents" VALUES ("3", "Marketing Strategy", "Marketing goals and tactics for Q3");
INSERT INTO "Documents" VALUES ("4", "Technical Specification", "System requirements and design");
INSERT INTO "Documents" VALUES ("5", "User Guide", "Instructions for end users");
INSERT INTO "Paragraphs" VALUES ("1", "1", "Introduction to company policies");
INSERT INTO "Paragraphs" VALUES ("2", "1", "Code of conduct");
INSERT INTO "Paragraphs" VALUES ("3", "1", "Leave policies");
INSERT INTO "Paragraphs" VALUES ("4", "1", "Health and safety guidelines");
INSERT INTO "Paragraphs" VALUES ("5", "2", "Project overview");
INSERT INTO "Paragraphs" VALUES ("6", "2", "Timeline and milestones");
INSERT INTO "Paragraphs" VALUES ("7", "2", "Resource allocation");
INSERT INTO "Paragraphs" VALUES ("8", "3", "Market analysis");
INSERT INTO "Paragraphs" VALUES ("9", "3", "Target audience");
INSERT INTO "Paragraphs" VALUES ("10", "3", "Advertising channels");
INSERT INTO "Paragraphs" VALUES ("11", "3", "Budget allocation");
INSERT INTO "Paragraphs" VALUES ("12", "3", "Performance metrics");
INSERT INTO "Paragraphs" VALUES ("13", "4", "System architecture");
INSERT INTO "Paragraphs" VALUES ("14", "4", "Hardware requirements");
INSERT INTO "Paragraphs" VALUES ("15", "5", "Getting started");
INSERT INTO "Paragraphs" VALUES ("16", "5", "Installation instructions");
INSERT INTO "Paragraphs" VALUES ("17", "5", "Troubleshooting tips");
INSERT INTO "Paragraphs" VALUES ("18", "5", "FAQ");
INSERT INTO "Templates" VALUES ("1", "Standard document template");
INSERT INTO "Templates" VALUES ("2", "Technical document template");
INSERT INTO "Templates" VALUES ("3", "Marketing document template");