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





INSERT INTO "Documents" VALUES ("1", "Employee Handbook", "Guidelines and policies for employees");
INSERT INTO "Documents" VALUES ("2", "Project Plan", "Detailed plan for project execution");
INSERT INTO "Documents" VALUES ("3", "Safety Manual", "Safety procedures and protocols");
INSERT INTO "Documents" VALUES ("4", "Marketing Strategy", "Marketing plans and target analysis");
INSERT INTO "Documents" VALUES ("5", "Financial Report", "Quarterly financial performance report");
INSERT INTO "Documents" VALUES ("6", "Empty Document", "");
INSERT INTO "Documents" VALUES ("7", "Long Description Document", "This document contains a very long description to test the system's ability to handle large text fields in the document description column, including punctuation, numbers 1234567890, and special characters !@#$%^&*");
INSERT INTO "Paragraphs" VALUES ("1", "Introduction to the company policies.");
INSERT INTO "Paragraphs" VALUES ("2", "Step-by-step project milestones.");
INSERT INTO "Paragraphs" VALUES ("3", "Emergency evacuation procedures.");
INSERT INTO "Paragraphs" VALUES ("4", "Target demographics and marketing channels.");
INSERT INTO "Paragraphs" VALUES ("5", "Summary of financial results and forecasts.");
INSERT INTO "Paragraphs" VALUES ("6", "");
INSERT INTO "Paragraphs" VALUES ("7", "Additional notes and disclaimers.");
INSERT INTO "Ref_Template_Types" VALUES ("HR", "Human Resources Templates");
INSERT INTO "Ref_Template_Types" VALUES ("PRJ", "Project Management Templates");
INSERT INTO "Ref_Template_Types" VALUES ("SFT", "Safety and Compliance Templates");
INSERT INTO "Ref_Template_Types" VALUES ("MKT", "Marketing Templates");
INSERT INTO "Ref_Template_Types" VALUES ("FIN", "Financial Templates");
INSERT INTO "Templates" VALUES ("1", "Standard HR Onboarding Template");
INSERT INTO "Templates" VALUES ("2", "Agile Project Plan Template");
INSERT INTO "Templates" VALUES ("3", "Workplace Safety Checklist Template");
INSERT INTO "Templates" VALUES ("4", "Digital Marketing Campaign Template");
INSERT INTO "Templates" VALUES ("5", "Quarterly Financial Summary Template");
INSERT INTO "Templates" VALUES ("6", "Empty Template Details");
INSERT INTO "Templates" VALUES ("7", "Template with very long details field to test text handling in the system including special characters and numbers 9876543210.");