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 "Ref_Template_Types" VALUES ("CV", "Curriculum Vitae");
INSERT INTO "Ref_Template_Types" VALUES ("INV", "Invoice");
INSERT INTO "Ref_Template_Types" VALUES ("LTR", "Letter");
INSERT INTO "Ref_Template_Types" VALUES ("RPT", "Report");
INSERT INTO "Ref_Template_Types" VALUES ("MEMO", "Memorandum");
INSERT INTO "Templates" VALUES ("101", "Standard CV Template");
INSERT INTO "Templates" VALUES ("102", "Professional Invoice Template");
INSERT INTO "Templates" VALUES ("103", "Formal Letter Template");
INSERT INTO "Templates" VALUES ("104", "Project Report Template");
INSERT INTO "Templates" VALUES ("105", "Internal Memo Template");
INSERT INTO "Templates" VALUES ("106", "Basic CV Template");
INSERT INTO "Templates" VALUES ("107", "Detailed Report Template");
INSERT INTO "Documents" VALUES ("1", "101", "Robbin CV", "Curriculum Vitae for Robbin Williams");
INSERT INTO "Documents" VALUES ("2", "102", "Invoice 2023-001", "Invoice for services rendered in January 2023");
INSERT INTO "Documents" VALUES ("3", "103", "Letter to John Doe", "Formal letter regarding contract terms");
INSERT INTO "Documents" VALUES ("4", "104", "Q1 Sales Report", "Quarterly sales performance report");
INSERT INTO "Documents" VALUES ("5", "105", "Meeting Minutes 2023-03-15", "Minutes from the team meeting on March 15, 2023");
INSERT INTO "Documents" VALUES ("6", "101", "Jane Doe CV", "Curriculum Vitae for Jane Doe");
INSERT INTO "Documents" VALUES ("7", "106", "Robbin CV Draft", "Draft version of Robbin Williams CV");
INSERT INTO "Documents" VALUES ("8", "104", "Annual Financial Report", "Comprehensive annual financial report");
INSERT INTO "Documents" VALUES ("9", "103", "Recommendation Letter", "Letter of recommendation for a former employee");
INSERT INTO "Documents" VALUES ("10", "101", "Another Robbin CV", "Another version of Robbin Williams CV");
INSERT INTO "Paragraphs" VALUES ("1", "This is the first paragraph of a document.");
INSERT INTO "Paragraphs" VALUES ("2", "This paragraph contains important details.");
INSERT INTO "Paragraphs" VALUES ("3", "A concluding paragraph for the document.");
INSERT INTO "Paragraphs" VALUES ("4", "Introduction to the report.");
INSERT INTO "Paragraphs" VALUES ("5", "Key findings and analysis.");
INSERT INTO "Paragraphs" VALUES ("6", "Recommendations based on the data.");
INSERT INTO "Paragraphs" VALUES ("7", "Contact information for the sender.");
INSERT INTO "Paragraphs" VALUES ("8", "Summary of qualifications.");
INSERT INTO "Paragraphs" VALUES ("9", "Work experience details.");
INSERT INTO "Paragraphs" VALUES ("10", "Educational background.");