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", "Professional Report Template");
INSERT INTO "Templates" VALUES ("3", "Simple Letter Template");
INSERT INTO "Templates" VALUES ("4", "Creative Portfolio Template");
INSERT INTO "Templates" VALUES ("5", "Robbin Special Template");
INSERT INTO "Documents" VALUES ("101", "1", "Robbin CV", "Curriculum Vitae for Robbin applying to tech jobs");
INSERT INTO "Documents" VALUES ("102", "2", "Annual Report", "Company annual financial report");
INSERT INTO "Documents" VALUES ("103", "3", "Cover Letter", "Letter for job application");
INSERT INTO "Documents" VALUES ("104", "4", "Portfolio", "Creative portfolio for designer");
INSERT INTO "Documents" VALUES ("105", "5", "Robbin CV", "Alternate CV version for Robbin with creative layout");
INSERT INTO "Documents" VALUES ("106", "1", "John CV", "CV for John Doe");
INSERT INTO "Documents" VALUES ("107", "3", "Robbin CV", "Robbin's simple CV version");
INSERT INTO "Paragraphs" VALUES ("201", "Introduction paragraph about Robbin's background");
INSERT INTO "Paragraphs" VALUES ("202", "Skills and experience details");
INSERT INTO "Paragraphs" VALUES ("203", "Education history");
INSERT INTO "Paragraphs" VALUES ("204", "References and contact information");
INSERT INTO "Paragraphs" VALUES ("205", "Summary and objectives");
INSERT INTO "Ref_Template_Types" VALUES ("CV", "Curriculum Vitae templates");
INSERT INTO "Ref_Template_Types" VALUES ("RPT", "Report templates");
INSERT INTO "Ref_Template_Types" VALUES ("LTR", "Letter templates");
INSERT INTO "Ref_Template_Types" VALUES ("PRT", "Portfolio templates");