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) UNIQUE,
"Template_Type_Description" VARCHAR(255),
PRIMARY KEY ("Template_Type_Code")
);

CREATE TABLE "Templates" (
"Template_ID" INT,
"Template_Type_Code" CHAR(15),
"Template_Details" VARCHAR(255),
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", "Meeting Minutes");
INSERT INTO "Documents" VALUES ("5", "Annual Report");
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 ("MEET_MIN", "Meeting Minutes Template");
INSERT INTO "Ref_Template_Types" VALUES ("FIN_REP", "Financial Report Template");
INSERT INTO "Ref_Template_Types" VALUES ("LEGAL", "Legal Document Template");
INSERT INTO "Ref_Template_Types" VALUES ("MKTG", "Marketing Document Template");
INSERT INTO "Templates" VALUES ("101", "HR_DOC", "Employee onboarding and policy details");
INSERT INTO "Templates" VALUES ("102", "SAFETY", "Workplace safety procedures and checklists");
INSERT INTO "Templates" VALUES ("103", "PROJ_PLAN", "Project timeline and milestone tracking");
INSERT INTO "Templates" VALUES ("104", "MEET_MIN", "Standard meeting minutes format");
INSERT INTO "Templates" VALUES ("105", "FIN_REP", "Quarterly financial summary and analysis");
INSERT INTO "Templates" VALUES ("106", "LEGAL", "Contract and agreement templates");
INSERT INTO "Templates" VALUES ("107", "MKTG", "Marketing campaign and strategy outline");
INSERT INTO "Templates" VALUES ("108", "HR_DOC", "Performance review form");
INSERT INTO "Templates" VALUES ("109", "SAFETY", "Incident report form");
INSERT INTO "Templates" VALUES ("110", "PROJ_PLAN", "Risk assessment template");