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

CREATE TABLE "Paragraphs" (
"Paragraph_ID" INT,
"Document_ID" INT,
"Paragraph_Text" VARCHAR(255),
PRIMARY KEY ("Paragraph_ID"),
FOREIGN KEY ("Document_ID") REFERENCES "Documents"("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,
"Template_Details" VARCHAR(255),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Documents" VALUES ("1", "Summer Show");
INSERT INTO "Documents" VALUES ("2", "Winter Gala");
INSERT INTO "Documents" VALUES ("3", "Spring Festival");
INSERT INTO "Documents" VALUES ("4", "Autumn Ball");
INSERT INTO "Documents" VALUES ("5", "Holiday Event");
INSERT INTO "Paragraphs" VALUES ("101", "1", "Welcome to the Summer Show event.");
INSERT INTO "Paragraphs" VALUES ("102", "1", "This year's theme is 'Sun and Fun'.");
INSERT INTO "Paragraphs" VALUES ("103", "1", "Schedule includes music, dance, and food stalls.");
INSERT INTO "Paragraphs" VALUES ("104", "1", "Please follow the safety guidelines.");
INSERT INTO "Paragraphs" VALUES ("105", "1", "Thank you for joining us!");
INSERT INTO "Paragraphs" VALUES ("106", "2", "Winter Gala will be held indoors.");
INSERT INTO "Paragraphs" VALUES ("107", "2", "Dress code is formal.");
INSERT INTO "Paragraphs" VALUES ("108", "3", "Spring Festival celebrates new beginnings.");
INSERT INTO "Paragraphs" VALUES ("109", "4", "Autumn Ball features classical music.");
INSERT INTO "Paragraphs" VALUES ("110", "5", "Holiday Event includes gift exchanges.");
INSERT INTO "Ref_Template_Types" VALUES ("TPL001", "Event Invitation");
INSERT INTO "Ref_Template_Types" VALUES ("TPL002", "Event Schedule");
INSERT INTO "Ref_Template_Types" VALUES ("TPL003", "Safety Guidelines");
INSERT INTO "Templates" VALUES ("201", "Invitation template for Summer Show");
INSERT INTO "Templates" VALUES ("202", "Schedule template for Winter Gala");
INSERT INTO "Templates" VALUES ("203", "Guidelines template for all events");