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





INSERT INTO "Documents" VALUES ("1", "101", "Report_A", "This document provides an overview of the project, with key findings.");
INSERT INTO "Documents" VALUES ("2", "102", "Memo_B", "A quick memo regarding the new policy, which will be implemented soon.");
INSERT INTO "Documents" VALUES ("3", "103", "Contract_C", "Legal agreement outlining terms and conditions, with a withdrawal clause.");
INSERT INTO "Documents" VALUES ("4", "101", "Proposal_D", "A detailed proposal for the upcoming software development, with a workflow.");
INSERT INTO "Documents" VALUES ("5", "104", "Invoice_E", "Invoice for services rendered, with payment details and a warning.");
INSERT INTO "Documents" VALUES ("6", "105", "Manual_F", "User manual for the new system, with step-by-step instructions and warnings.");
INSERT INTO "Documents" VALUES ("7", "101", "Summary_G", "Brief summary of the weekly meeting, with action points.");
INSERT INTO "Documents" VALUES ("8", "102", "Notice_H", "Important notice about the network maintenance window.");
INSERT INTO "Documents" VALUES ("9", "103", "Agreement_I", "Mutual agreement between two parties, with a warranty.");
INSERT INTO "Documents" VALUES ("10", "104", "Form_J", "Application form with required fields and a waiver.");
INSERT INTO "Paragraphs" VALUES ("1", "This is the first paragraph of the document.");
INSERT INTO "Paragraphs" VALUES ("2", "The second paragraph contains important information.");
INSERT INTO "Paragraphs" VALUES ("3", "A third paragraph for additional details.");
INSERT INTO "Paragraphs" VALUES ("4", "This paragraph discusses the new workflow.");
INSERT INTO "Paragraphs" VALUES ("5", "Another paragraph with some warnings.");
INSERT INTO "Paragraphs" VALUES ("6", "Final paragraph for conclusions.");
INSERT INTO "Ref_Template_Types" VALUES ("RPT", "Report Template");
INSERT INTO "Ref_Template_Types" VALUES ("MEM", "Memo Template");
INSERT INTO "Ref_Template_Types" VALUES ("CON", "Contract Template");
INSERT INTO "Ref_Template_Types" VALUES ("PRP", "Proposal Template");
INSERT INTO "Ref_Template_Types" VALUES ("INV", "Invoice Template");
INSERT INTO "Ref_Template_Types" VALUES ("MAN", "Manual Template");
INSERT INTO "Templates" VALUES ("101", "Standard report template with sections for introduction, analysis, and conclusion.");
INSERT INTO "Templates" VALUES ("102", "Simple memo template for internal communications.");
INSERT INTO "Templates" VALUES ("103", "Comprehensive contract template with legal clauses.");
INSERT INTO "Templates" VALUES ("104", "Basic invoice template for billing purposes.");
INSERT INTO "Templates" VALUES ("105", "Detailed user manual template with step-by-step guides.");