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.");
INSERT INTO "Documents" VALUES ("2", "Contract Agreement", "Legal contract for services.");
INSERT INTO "Documents" VALUES ("3", "Meeting Minutes", "Record of meeting discussions.");
INSERT INTO "Documents" VALUES ("4", "Project Proposal", "Proposal for new project initiatives.");
INSERT INTO "Documents" VALUES ("5", "Expense Report", "Report for employee expenses.");
INSERT INTO "Documents" VALUES ("6", "Purchase Order", "Document for ordering goods.");
INSERT INTO "Documents" VALUES ("7", "Marketing Brochure", "Brochure for marketing campaigns.");
INSERT INTO "Documents" VALUES ("8", "Employee Handbook", "Handbook for company policies.");
INSERT INTO "Documents" VALUES ("9", "Client Feedback Form", "Form for collecting client feedback.");
INSERT INTO "Documents" VALUES ("10", "Training Manual", "Manual for employee training.");
INSERT INTO "Ref_Template_Types" VALUES ("INV", "Invoice Templates");
INSERT INTO "Ref_Template_Types" VALUES ("CON", "Contract Templates");
INSERT INTO "Ref_Template_Types" VALUES ("REP", "Report Templates");
INSERT INTO "Ref_Template_Types" VALUES ("PRO", "Proposal Templates");
INSERT INTO "Ref_Template_Types" VALUES ("FORM", "Form Templates");
INSERT INTO "Ref_Template_Types" VALUES ("MAN", "Manual Templates");
INSERT INTO "Ref_Template_Types" VALUES ("OTH", "Other Document Types");
INSERT INTO "Templates" VALUES ("101", "INV");
INSERT INTO "Templates" VALUES ("102", "INV");
INSERT INTO "Templates" VALUES ("103", "INV");
INSERT INTO "Templates" VALUES ("104", "CON");
INSERT INTO "Templates" VALUES ("105", "CON");
INSERT INTO "Templates" VALUES ("106", "REP");
INSERT INTO "Templates" VALUES ("107", "REP");
INSERT INTO "Templates" VALUES ("108", "PRO");
INSERT INTO "Templates" VALUES ("109", "FORM");
INSERT INTO "Templates" VALUES ("110", "FORM");
INSERT INTO "Templates" VALUES ("111", "FORM");
INSERT INTO "Templates" VALUES ("112", "MAN");
INSERT INTO "Templates" VALUES ("113", "OTH");
INSERT INTO "Templates" VALUES ("114", "INV");
INSERT INTO "Templates" VALUES ("115", "REP");
INSERT INTO "Templates" VALUES ("116", "FORM");
INSERT INTO "Templates" VALUES ("117", "CON");
INSERT INTO "Templates" VALUES ("118", "INV");
INSERT INTO "Templates" VALUES ("119", "REP");
INSERT INTO "Templates" VALUES ("120", "FORM");