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 "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", "Customer reviews", "Customer reviews");
INSERT INTO "Documents" VALUES ("2", "Product specs", "Product specifications");
INSERT INTO "Documents" VALUES ("3", "Employee handbook", "Company policies and guidelines");
INSERT INTO "Documents" VALUES ("4", "Customer reviews", "Customer reviews");
INSERT INTO "Documents" VALUES ("5", "Marketing plan", "Marketing strategies and plans");
INSERT INTO "Paragraphs" VALUES ("1", "1", "Customers appreciate the quick response time.");
INSERT INTO "Paragraphs" VALUES ("2", "1", "Many customers mention the friendly staff.");
INSERT INTO "Paragraphs" VALUES ("3", "2", "The product is made of high-quality materials.");
INSERT INTO "Paragraphs" VALUES ("4", "3", "Employees must adhere to the dress code.");
INSERT INTO "Paragraphs" VALUES ("5", "4", "Overall satisfaction rate is above 90%.");
INSERT INTO "Paragraphs" VALUES ("6", "4", "Some customers suggest improvements in delivery.");
INSERT INTO "Paragraphs" VALUES ("7", "5", "Focus on digital marketing channels.");
INSERT INTO "Paragraphs" VALUES ("8", "1", "Return policy is clearly stated and easy to follow.");
INSERT INTO "Paragraphs" VALUES ("9", "4", "Customer reviews are collected monthly.");
INSERT INTO "Paragraphs" VALUES ("10", "3", "Annual leave policy updated recently.");
INSERT INTO "Ref_Template_Types" VALUES ("TT001", "Review Templates");
INSERT INTO "Ref_Template_Types" VALUES ("TT002", "Specification Templates");
INSERT INTO "Ref_Template_Types" VALUES ("TT003", "Policy Templates");
INSERT INTO "Templates" VALUES ("1", "Template for customer feedback collection");
INSERT INTO "Templates" VALUES ("2", "Template for product specification sheet");
INSERT INTO "Templates" VALUES ("3", "Template for employee policy document");