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 strategies for Q3");
INSERT INTO "Documents" VALUES ("5", "Financial Report", "Quarterly financial performance report");
INSERT INTO "Documents" VALUES ("6", "Empty Document", "");
INSERT INTO "Documents" VALUES ("7", "Single Word", "Description");
INSERT INTO "Documents" VALUES ("8", "Long Description Document", "This document contains a very long description to test the system's ability to handle large text fields without truncation or errors");
INSERT INTO "Paragraphs" VALUES ("1", "Welcome to the company. This handbook will guide you through our policies.");
INSERT INTO "Paragraphs" VALUES ("2", "The project will be divided into phases with specific milestones.");
INSERT INTO "Paragraphs" VALUES ("3", "Always wear protective gear in designated areas.");
INSERT INTO "Paragraphs" VALUES ("4", "Our marketing strategy focuses on digital channels.");
INSERT INTO "Paragraphs" VALUES ("5", "The financial report shows a 10% increase in revenue.");
INSERT INTO "Paragraphs" VALUES ("6", "This paragraph is intentionally left blank.");
INSERT INTO "Paragraphs" VALUES ("7", "Edge case paragraph with special characters !@#$%^&*");
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 ("SAF", "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", "Employee Handbook Template");
INSERT INTO "Templates" VALUES ("2", "Project Plan Template");
INSERT INTO "Templates" VALUES ("3", "Safety Manual Template");
INSERT INTO "Templates" VALUES ("4", "Marketing Strategy Template");
INSERT INTO "Templates" VALUES ("5", "Financial Report Template");
INSERT INTO "Templates" VALUES ("6", "Empty Template");