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,
"Template_ID" INT,
"Document_Name" VARCHAR(255),
"Document_Description" 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),
"Template_Type_Description" VARCHAR(255),
PRIMARY KEY ("Template_Type_Code")
);

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





INSERT INTO "Documents" VALUES ("1", "101", "Project Plan", "This document outlines the workflow and milestones");
INSERT INTO "Documents" VALUES ("2", "102", "Meeting Notes", "Summary of weekly team meetings and action items");
INSERT INTO "Documents" VALUES ("3", "103", "Budget Report", "Annual financial overview without workflow details");
INSERT INTO "Documents" VALUES ("4", "104", "User Guide", "Step-by-step instructions for software usage");
INSERT INTO "Documents" VALUES ("5", "105", "Warranty Terms", "Details about product warranty and service");
INSERT INTO "Documents" VALUES ("6", "106", "Release Notes", "Information about the latest software release");
INSERT INTO "Documents" VALUES ("7", "107", "Strategy Document", "Company strategy with workflow improvements");
INSERT INTO "Documents" VALUES ("8", "108", "Technical Specs", "Technical specifications without the letter");
INSERT INTO "Documents" VALUES ("9", "109", "Welcome Letter", "A letter to welcome new employees");
INSERT INTO "Documents" VALUES ("10", "110", "Policy Document", "Workplace policies and guidelines");
INSERT INTO "Paragraphs" VALUES ("1", "Introduction to the document");
INSERT INTO "Paragraphs" VALUES ("2", "Workflow description and details");
INSERT INTO "Paragraphs" VALUES ("3", "Summary of key points");
INSERT INTO "Paragraphs" VALUES ("4", "Technical details and specifications");
INSERT INTO "Paragraphs" VALUES ("5", "Conclusion and next steps");
INSERT INTO "Ref_Template_Types" VALUES ("TPL001", "Workflow Template");
INSERT INTO "Ref_Template_Types" VALUES ("TPL002", "Meeting Template");
INSERT INTO "Ref_Template_Types" VALUES ("TPL003", "Financial Template");
INSERT INTO "Ref_Template_Types" VALUES ("TPL004", "User Documentation");
INSERT INTO "Ref_Template_Types" VALUES ("TPL005", "Warranty Template");
INSERT INTO "Templates" VALUES ("101", "Workflow planning template");
INSERT INTO "Templates" VALUES ("102", "Weekly meeting notes template");
INSERT INTO "Templates" VALUES ("103", "Annual budget report template");
INSERT INTO "Templates" VALUES ("104", "User guide template");
INSERT INTO "Templates" VALUES ("105", "Warranty terms template");
INSERT INTO "Templates" VALUES ("106", "Release notes template");
INSERT INTO "Templates" VALUES ("107", "Strategy and workflow template");
INSERT INTO "Templates" VALUES ("108", "Technical specification template");
INSERT INTO "Templates" VALUES ("109", "Welcome letter template");
INSERT INTO "Templates" VALUES ("110", "Workplace policy template");