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),
PRIMARY KEY ("Document_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 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", "Employee Handbook");
INSERT INTO "Documents" VALUES ("2", "Safety Guidelines");
INSERT INTO "Documents" VALUES ("3", "Project Plan");
INSERT INTO "Documents" VALUES ("4", "Annual Report");
INSERT INTO "Documents" VALUES ("5", "Marketing Strategy");
INSERT INTO "Ref_Template_Types" VALUES ("HR_DOC", "Human Resources Document");
INSERT INTO "Ref_Template_Types" VALUES ("SAFETY", "Safety and Compliance Document");
INSERT INTO "Ref_Template_Types" VALUES ("PROJ_PLAN", "Project Planning Document");
INSERT INTO "Ref_Template_Types" VALUES ("FIN_REP", "Financial Report Document");
INSERT INTO "Ref_Template_Types" VALUES ("MKT_STRAT", "Marketing Strategy Document");
INSERT INTO "Ref_Template_Types" VALUES ("LEGAL", "Legal Document");
INSERT INTO "Ref_Template_Types" VALUES ("TECH_SPEC", "Technical Specification Document");
INSERT INTO "Templates" VALUES ("101", "HR_DOC");
INSERT INTO "Templates" VALUES ("102", "HR_DOC");
INSERT INTO "Templates" VALUES ("103", "SAFETY");
INSERT INTO "Templates" VALUES ("104", "PROJ_PLAN");
INSERT INTO "Templates" VALUES ("105", "FIN_REP");
INSERT INTO "Templates" VALUES ("106", "MKT_STRAT");
INSERT INTO "Templates" VALUES ("107", "LEGAL");
INSERT INTO "Templates" VALUES ("108", "TECH_SPEC");
INSERT INTO "Templates" VALUES ("109", "TECH_SPEC");
INSERT INTO "Templates" VALUES ("110", "SAFETY");