package dxcc

// The DELETED DXCC entities, and why a lookup table needs to know about them.
//
// cty.dat answers one question: what entity is this callsign in TODAY. That is
// the right answer for a spot and the wrong one for a log. R1MVI was Malyj
// Vysotskij Island, entity 151, until the ARRL deleted it in February 2012;
// today the same callsign resolves to European Russia, 54. A 2004 contact
// re-stamped from cty.dat therefore loses the entity it was made with — and
// with it a DXCC credit that cannot be worked again, because the place no
// longer counts.
//
// Reported by an operator importing a Logger32 export: his ADIF said
// <DXCC:3>151 and OpsLog stored 54.
//
// So this list exists to be able to say "that number belongs to something that
// no longer exists, leave it alone". It is the ADIF specification's own
// enumeration of deleted entities, and it does not change except when the ARRL
// deletes another one.
var deletedEntities = map[int]string{
	2:   "Abu Ail Is.",
	8:   "Aldabra",
	19:  "Bajo Nuevo",
	23:  "Blenheim Reef",
	25:  "British North Borneo",
	26:  "British Somaliland",
	28:  "Canal Zone",
	30:  "Celebe & Molucca Is.",
	39:  "Comoros",
	42:  "Damao, Diu",
	44:  "Desroches",
	55:  "Farquhar",
	57:  "French Equatorial Africa",
	58:  "French Indo-China",
	59:  "French West Africa",
	67:  "French India",
	68:  "Kuwait/Saudi Arabia Neutral Zone",
	81:  "Germany",
	85:  "Bonaire, Curacao",
	93:  "Geyser Reef",
	101: "Goa",
	102: "Gold Coast, Togoland",
	113: "Ifni",
	115: "Italian Somaliland",
	119: "Java",
	127: "Kamaran Is.",
	128: "Karelo-Finnish Republic",
	134: "Kingman Reef",
	139: "Kuria Muria I.",
	151: "Malyj Vysotskij I.",
	154: "Yemen Arab Republic",
	155: "Malaya",
	164: "Manchuria",
	178: "Minerva Reef",
	183: "Netherlands Borneo",
	184: "Netherlands New Guinea",
	186: "Newfoundland, Labrador",
	193: "Okinawa (Ryukyu Is.)",
	194: "Okino Tori-shima",
	196: "Palestine",
	200: "Portuguese Timor",
	208: "Ruanda-Urundi",
	210: "Saar",
	218: "Czechoslovakia",
	220: "Sarawak",
	226: "Saudi Arabia/Iraq Neutral Zone",
	228: "Serrana Bank & Roncador Cay",
	229: "German Democratic Republic",
	231: "Sikkim",
	243: "People's Democratic Rep. of Yemen",
	244: "Southern Sudan",
	255: "St. Maarten, Saba, St. Eustatius",
	258: "Sumatra",
	261: "Swan Is.",
	264: "Tangier",
	267: "Territory of New Guinea",
	268: "Tibet",
	271: "Trieste",
	307: "Zanzibar",
	488: "Walvis Bay",
	493: "Penguin Is.",
}

// IsDeleted reports whether a DXCC entity number names an entity the ARRL has
// deleted.
//
// The one thing every caller does with a true answer is the same: stop. A
// deleted entity cannot be looked up from a callsign, cannot be worked again,
// and cannot be corrected by anything that only knows about today.
func IsDeleted(n int) bool {
	_, ok := deletedEntities[n]
	return ok
}

// DeletedName is what entity n was called, or "" if it is not a deleted entity.
// Used to say WHICH entity was preserved rather than only that one was.
func DeletedName(n int) string { return deletedEntities[n] }
