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 "Templates" VALUES ("1", "Standard CV Template");
INSERT INTO "Templates" VALUES ("2", "Creative Portfolio Template");
INSERT INTO "Templates" VALUES ("3", "Professional Resume Template");
INSERT INTO "Templates" VALUES ("4", "Simple Cover Letter Template");
INSERT INTO "Templates" VALUES ("5", "Detailed Project Report Template");
INSERT INTO "Documents" VALUES ("101", "1", "Robbin CV", "Curriculum Vitae of Robbin Smith");
INSERT INTO "Documents" VALUES ("102", "2", "Alice Portfolio", "Portfolio of Alice Johnson");
INSERT INTO "Documents" VALUES ("103", "3", "Mark Resume", "Resume of Mark Lee");
INSERT INTO "Documents" VALUES ("104", "1", "Robbin Cover Letter", "Cover letter for Robbin Smith");
INSERT INTO "Documents" VALUES ("105", "5", "Project Report", "Annual project report 2023");
INSERT INTO "Paragraphs" VALUES ("201", "This document outlines the professional experience and education of Robbin Smith.");
INSERT INTO "Paragraphs" VALUES ("202", "Alice Johnson's portfolio showcases her design projects and achievements.");
INSERT INTO "Paragraphs" VALUES ("203", "Mark Lee's resume highlights his skills in software development.");
INSERT INTO "Paragraphs" VALUES ("204", "Cover letter for Robbin Smith applying for the marketing position.");
INSERT INTO "Paragraphs" VALUES ("205", "Detailed report on the progress and outcomes of the 2023 projects.");
INSERT INTO "Ref_Template_Types" VALUES ("CV", "Curriculum Vitae Template");
INSERT INTO "Ref_Template_Types" VALUES ("PORTF", "Portfolio Template");
INSERT INTO "Ref_Template_Types" VALUES ("RES", "Resume Template");
INSERT INTO "Ref_Template_Types" VALUES ("COVER", "Cover Letter Template");
INSERT INTO "Ref_Template_Types" VALUES ("REPORT", "Project Report Template");