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





INSERT INTO "Ref_Template_Types" VALUES ("INV", "Invoice Template");
INSERT INTO "Ref_Template_Types" VALUES ("ORD", "Order Confirmation Template");
INSERT INTO "Ref_Template_Types" VALUES ("REP", "Report Template");
INSERT INTO "Ref_Template_Types" VALUES ("MEM", "Memo Template");
INSERT INTO "Ref_Template_Types" VALUES ("AGR", "Agreement Template");
INSERT INTO "Templates" VALUES ("1", "Standard Invoice Template for Goods");
INSERT INTO "Templates" VALUES ("2", "Detailed Order Confirmation for Services");
INSERT INTO "Templates" VALUES ("3", "Monthly Sales Report Template");
INSERT INTO "Templates" VALUES ("4", "Internal Memo Template");
INSERT INTO "Templates" VALUES ("5", "Service Level Agreement Template");
INSERT INTO "Templates" VALUES ("6", "Weekly Progress Report Template");
INSERT INTO "Templates" VALUES ("7", "Customer Welcome Letter Template");
INSERT INTO "Documents" VALUES ("101", "1", "Invoice_2023_001", "Invoice for hardware components, with payment terms.");
INSERT INTO "Documents" VALUES ("102", "2", "Order_Confirm_Svc_005", "Confirmation of web development services, awaiting client approval.");
INSERT INTO "Documents" VALUES ("103", "3", "Sales_Report_Q1_2023", "Quarterly sales performance overview, showing growth.");
INSERT INTO "Documents" VALUES ("104", "4", "Memo_Project_Update", "Internal memo regarding the new project workflow.");
INSERT INTO "Documents" VALUES ("105", "5", "SLA_Client_X", "Service Level Agreement with Client X, covering software support.");
INSERT INTO "Documents" VALUES ("106", "1", "Invoice_2023_002", "Invoice for software licenses, with a warning about late payment.");
INSERT INTO "Documents" VALUES ("107", "6", "Progress_Report_Week_10", "Weekly progress report for the new software development, showing good work.");
INSERT INTO "Documents" VALUES ("108", "7", "Welcome_Letter_New_Customer", "Welcome letter for our newest customer, with important information.");
INSERT INTO "Documents" VALUES ("109", "3", "Annual_Report_2022", "Annual financial report, with a comprehensive overview.");
INSERT INTO "Documents" VALUES ("110", "2", "Order_Confirm_Prod_001", "Order confirmation for product delivery, awaiting shipment.");
INSERT INTO "Paragraphs" VALUES ("1001", "This is the first paragraph of the document.");
INSERT INTO "Paragraphs" VALUES ("1002", "The second paragraph contains important details.");
INSERT INTO "Paragraphs" VALUES ("1003", "A concluding paragraph summarizes the content.");
INSERT INTO "Paragraphs" VALUES ("1004", "This paragraph discusses the new workflow process.");
INSERT INTO "Paragraphs" VALUES ("1005", "Details about the service level agreement are provided here.");
INSERT INTO "Paragraphs" VALUES ("1006", "Further information regarding the invoice is available.");
INSERT INTO "Paragraphs" VALUES ("1007", "The progress of the project is outlined in this section.");
INSERT INTO "Paragraphs" VALUES ("1008", "Welcome message for new users.");