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,
"Template_ID" INT,
"Document_Name" 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_Type_Code" CHAR(15),
PRIMARY KEY ("Template_ID"),
FOREIGN KEY ("Template_Type_Code") REFERENCES "Ref_Template_Types"("Template_Type_Code")
);





INSERT INTO "Ref_Template_Types" VALUES ("TYPE_A", "Legal Document");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_B", "Financial Report");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_C", "Technical Manual");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_D", "Marketing Brochure");
INSERT INTO "Ref_Template_Types" VALUES ("TYPE_E", "HR Policy");
INSERT INTO "Templates" VALUES ("1", "TYPE_A");
INSERT INTO "Templates" VALUES ("2", "TYPE_B");
INSERT INTO "Templates" VALUES ("3", "TYPE_C");
INSERT INTO "Templates" VALUES ("4", "TYPE_D");
INSERT INTO "Templates" VALUES ("5", "TYPE_E");
INSERT INTO "Templates" VALUES ("6", "TYPE_A");
INSERT INTO "Templates" VALUES ("7", "TYPE_A");
INSERT INTO "Templates" VALUES ("8", "TYPE_B");
INSERT INTO "Templates" VALUES ("9", "TYPE_C");
INSERT INTO "Templates" VALUES ("10", "TYPE_D");
INSERT INTO "Documents" VALUES ("101", "1", "Contract Agreement");
INSERT INTO "Documents" VALUES ("102", "2", "Annual Financial Summary");
INSERT INTO "Documents" VALUES ("103", "1", "NDA Document");
INSERT INTO "Documents" VALUES ("104", "3", "User Guide");
INSERT INTO "Documents" VALUES ("105", "4", "Product Flyer");
INSERT INTO "Documents" VALUES ("106", "1", "Service Terms");
INSERT INTO "Documents" VALUES ("107", "5", "Employee Handbook");
INSERT INTO "Documents" VALUES ("108", "6", "Lease Agreement");
INSERT INTO "Documents" VALUES ("109", "7", "Partnership Contract");
INSERT INTO "Documents" VALUES ("110", "8", "Quarterly Report");
INSERT INTO "Documents" VALUES ("111", "9", "Installation Manual");
INSERT INTO "Documents" VALUES ("112", "10", "Campaign Overview");
INSERT INTO "Documents" VALUES ("113", "1", "Privacy Policy");
INSERT INTO "Documents" VALUES ("114", "2", "Budget Report");
INSERT INTO "Documents" VALUES ("115", "3", "Maintenance Guide");
INSERT INTO "Paragraphs" VALUES ("201", "This document outlines the terms and conditions.");
INSERT INTO "Paragraphs" VALUES ("202", "Financial data is presented for the fiscal year.");
INSERT INTO "Paragraphs" VALUES ("203", "Instructions for installation and setup.");
INSERT INTO "Paragraphs" VALUES ("204", "Marketing strategies and target audience.");
INSERT INTO "Paragraphs" VALUES ("205", "Company policies and employee responsibilities.");
INSERT INTO "Paragraphs" VALUES ("206", "Confidentiality agreement details.");
INSERT INTO "Paragraphs" VALUES ("207", "Summary of partnership obligations.");
INSERT INTO "Paragraphs" VALUES ("208", "Product features and benefits.");
INSERT INTO "Paragraphs" VALUES ("209", "Safety precautions and warnings.");
INSERT INTO "Paragraphs" VALUES ("210", "Budget allocation and expenditure.");