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),
"Other_Details" VARCHAR(255),
PRIMARY KEY ("Paragraph_ID"),
FOREIGN KEY ("Document_ID") REFERENCES "Documents"("Document_ID")
);

CREATE TABLE "Templates" (
"Template_ID" INT,
"Template_Type_Code" CHAR(15),
"Template_Details" VARCHAR(255),
PRIMARY KEY ("Template_ID")
);





INSERT INTO "Documents" VALUES ("1", "International Relations");
INSERT INTO "Documents" VALUES ("2", "Asian Studies");
INSERT INTO "Documents" VALUES ("3", "Economic Reports");
INSERT INTO "Documents" VALUES ("4", "Travel Guides");
INSERT INTO "Documents" VALUES ("5", "Cultural Essays");
INSERT INTO "Paragraphs" VALUES ("101", "1", "Korea", "Discusses geopolitical issues in Korea.");
INSERT INTO "Paragraphs" VALUES ("102", "1", "Japan and China relations", "Focus on trade agreements.");
INSERT INTO "Paragraphs" VALUES ("103", "2", "Korea's economic growth", "Analysis of GDP growth rates.");
INSERT INTO "Paragraphs" VALUES ("104", "3", "South Korea technology sector", "Details on tech industry expansion.");
INSERT INTO "Paragraphs" VALUES ("105", "4", "Travel tips for Korea", "Includes visa and cultural advice.");
INSERT INTO "Paragraphs" VALUES ("106", "5", "Korean traditional music", "Explores cultural heritage.");
INSERT INTO "Paragraphs" VALUES ("107", "2", "Southeast Asia overview", "General regional information.");
INSERT INTO "Paragraphs" VALUES ("108", "3", "China's Belt and Road", "Infrastructure projects in Asia.");
INSERT INTO "Paragraphs" VALUES ("109", "4", "Korea cuisine", "Popular dishes and recipes.");
INSERT INTO "Paragraphs" VALUES ("110", "5", "Korean language basics", "Introduction to Hangul.");
INSERT INTO "Templates" VALUES ("201", "GOV_DOC", "Government documents template");
INSERT INTO "Templates" VALUES ("202", "ECON_REP", "Economic report template");
INSERT INTO "Templates" VALUES ("203", "TRAVEL", "Travel guide template");
INSERT INTO "Templates" VALUES ("204", "CULTURE", "Cultural essay template");
INSERT INTO "Templates" VALUES ("205", "ACADEMIC", "Academic paper template");