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", "Invoice Template", "Standard invoice document for billing clients.");
INSERT INTO "Documents" VALUES ("2", "Contract Agreement", "Legal contract for service agreements.");
INSERT INTO "Documents" VALUES ("3", "Meeting Minutes", "Template for recording meeting discussions and decisions.");
INSERT INTO "Documents" VALUES ("4", "Project Proposal", "Template for submitting new project proposals.");
INSERT INTO "Documents" VALUES ("5", "Expense Report", "Form for submitting and tracking business expenses.");
INSERT INTO "Documents" VALUES ("6", "Newsletter Layout", "Design template for company newsletters.");
INSERT INTO "Documents" VALUES ("7", "Employee Handbook", "Document outlining company policies and procedures.");
INSERT INTO "Documents" VALUES ("8", "Purchase Order", "Form for ordering goods or services.");
INSERT INTO "Documents" VALUES ("9", "Performance Review", "Template for employee performance evaluations.");
INSERT INTO "Documents" VALUES ("10", "Marketing Brochure", "Template for creating promotional brochures.");
INSERT INTO "Ref_Template_Types" VALUES ("FIN", "Financial Documents");
INSERT INTO "Ref_Template_Types" VALUES ("LEG", "Legal Documents");
INSERT INTO "Ref_Template_Types" VALUES ("ADM", "Administrative Documents");
INSERT INTO "Ref_Template_Types" VALUES ("PROJ", "Project Management Documents");
INSERT INTO "Ref_Template_Types" VALUES ("HR", "Human Resources Documents");
INSERT INTO "Ref_Template_Types" VALUES ("MKT", "Marketing Documents");
INSERT INTO "Ref_Template_Types" VALUES ("GEN", "General Documents");
INSERT INTO "Templates" VALUES ("101", "FIN");
INSERT INTO "Templates" VALUES ("102", "FIN");
INSERT INTO "Templates" VALUES ("103", "LEG");
INSERT INTO "Templates" VALUES ("104", "ADM");
INSERT INTO "Templates" VALUES ("105", "PROJ");
INSERT INTO "Templates" VALUES ("106", "FIN");
INSERT INTO "Templates" VALUES ("107", "HR");
INSERT INTO "Templates" VALUES ("108", "MKT");
INSERT INTO "Templates" VALUES ("109", "ADM");
INSERT INTO "Templates" VALUES ("110", "PROJ");
INSERT INTO "Templates" VALUES ("111", "LEG");
INSERT INTO "Templates" VALUES ("112", "HR");
INSERT INTO "Templates" VALUES ("113", "GEN");
INSERT INTO "Templates" VALUES ("114", "GEN");
INSERT INTO "Templates" VALUES ("115", "MKT");
INSERT INTO "Templates" VALUES ("116", "FIN");