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 "Templates" VALUES ("1", "Standard contract template");
INSERT INTO "Templates" VALUES ("2", "Employee onboarding template");
INSERT INTO "Templates" VALUES ("3", "Project proposal template");
INSERT INTO "Templates" VALUES ("4", "Warranty claim template");
INSERT INTO "Templates" VALUES ("5", "Weekly report template");
INSERT INTO "Documents" VALUES ("101", "1", "Contract A", "This contract covers all terms");
INSERT INTO "Documents" VALUES ("102", "2", "Onboarding Doc", "Welcome to the company");
INSERT INTO "Documents" VALUES ("103", "3", "Proposal X", "Detailed project proposal");
INSERT INTO "Documents" VALUES ("104", "4", "Warranty Form", "Warranty claim for product");
INSERT INTO "Documents" VALUES ("105", "5", "Weekly Summary", "Summary of weekly activities");
INSERT INTO "Documents" VALUES ("106", "1", "Contract B", "Contract without warranty clause");
INSERT INTO "Documents" VALUES ("107", "3", "Proposal Y", "Proposal with new workflow");
INSERT INTO "Documents" VALUES ("108", "2", "Onboarding Doc 2", "Introduction and welcome package");
INSERT INTO "Documents" VALUES ("109", "5", "Weekly Report", "Weekly report with updates");
INSERT INTO "Documents" VALUES ("110", "4", "Warranty Extension", "Extension of warranty period");
INSERT INTO "Paragraphs" VALUES ("201", "This document outlines the terms and conditions.");
INSERT INTO "Paragraphs" VALUES ("202", "Welcome to the team, we are glad to have you.");
INSERT INTO "Paragraphs" VALUES ("203", "The warranty covers defects for one year.");
INSERT INTO "Paragraphs" VALUES ("204", "Please review the weekly report carefully.");
INSERT INTO "Paragraphs" VALUES ("205", "Project proposal includes budget and timeline.");
INSERT INTO "Ref_Template_Types" VALUES ("STD", "Standard Template");
INSERT INTO "Ref_Template_Types" VALUES ("EMP", "Employee Related Template");
INSERT INTO "Ref_Template_Types" VALUES ("PRO", "Project Related Template");
INSERT INTO "Ref_Template_Types" VALUES ("WAR", "Warranty Related Template");
INSERT INTO "Ref_Template_Types" VALUES ("WKL", "Weekly Report Template");