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,
"Document_Name" VARCHAR(255),
"Document_Description" VARCHAR(255),
PRIMARY KEY ("Document_ID")
);

CREATE TABLE "Ref_Template_Types" (
"Template_Type_Code" CHAR(15) UNIQUE,
"Template_Type_Description" VARCHAR(255),
PRIMARY KEY ("Template_Type_Code")
);

CREATE TABLE "Templates" (
"Template_ID" INT UNIQUE,
"Template_Type_Code" CHAR(15),
PRIMARY KEY ("Template_ID"),
FOREIGN KEY ("Template_Type_Code") REFERENCES "Ref_Template_Types"("Template_Type_Code")
);





INSERT INTO "Documents" VALUES ("1", "Project Proposal", "Detailed plan for a new project.");
INSERT INTO "Documents" VALUES ("2", "Presentation Slides", "Visual aids for a presentation.");
INSERT INTO "Documents" VALUES ("3", "Meeting Minutes", "Record of discussions and decisions in a meeting.");
INSERT INTO "Documents" VALUES ("4", "Financial Report", "Summary of financial performance.");
INSERT INTO "Documents" VALUES ("5", "Contract Agreement", "Legal document outlining terms and conditions.");
INSERT INTO "Documents" VALUES ("6", "Research Paper", "Academic document presenting research findings.");
INSERT INTO "Ref_Template_Types" VALUES ("PP", "Project Proposal");
INSERT INTO "Ref_Template_Types" VALUES ("PPT", "PowerPoint Presentation");
INSERT INTO "Ref_Template_Types" VALUES ("MM", "Meeting Minutes");
INSERT INTO "Ref_Template_Types" VALUES ("FR", "Financial Report");
INSERT INTO "Ref_Template_Types" VALUES ("CA", "Contract Agreement");
INSERT INTO "Ref_Template_Types" VALUES ("RP", "Research Paper");
INSERT INTO "Ref_Template_Types" VALUES ("REP", "General Report");
INSERT INTO "Ref_Template_Types" VALUES ("DOC", "General Document");
INSERT INTO "Templates" VALUES ("101", "PP");
INSERT INTO "Templates" VALUES ("102", "PPT");
INSERT INTO "Templates" VALUES ("103", "MM");
INSERT INTO "Templates" VALUES ("104", "FR");
INSERT INTO "Templates" VALUES ("105", "PP");
INSERT INTO "Templates" VALUES ("106", "CA");
INSERT INTO "Templates" VALUES ("107", "PPT");
INSERT INTO "Templates" VALUES ("108", "RP");
INSERT INTO "Templates" VALUES ("109", "REP");
INSERT INTO "Templates" VALUES ("110", "DOC");
INSERT INTO "Templates" VALUES ("111", "PP");
INSERT INTO "Templates" VALUES ("112", "PPT");