-- pg_orrery 0.14.0 -> 0.15.0 migration
--
-- Adds: constellation_full_name (1 function),
--        rise/set status diagnostics (3 functions).

-- ============================================================
-- Constellation full name lookup
-- ============================================================

CREATE FUNCTION constellation_full_name(abbr text) RETURNS text
    AS 'MODULE_PATHNAME', 'constellation_full_name_from_abbr'
    LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION constellation_full_name(text) IS
    'Full IAU constellation name from 3-letter abbreviation. Returns NULL for invalid abbreviation.';

-- ============================================================
-- Rise/set status diagnostics
-- ============================================================

CREATE FUNCTION sun_rise_set_status(obs observer, t timestamptz) RETURNS text
    AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sun_rise_set_status(observer, timestamptz) IS
    'Classify Sun visibility: rises_and_sets, circumpolar, or never_rises.';

CREATE FUNCTION moon_rise_set_status(obs observer, t timestamptz) RETURNS text
    AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION moon_rise_set_status(observer, timestamptz) IS
    'Classify Moon visibility: rises_and_sets, circumpolar, or never_rises.';

CREATE FUNCTION planet_rise_set_status(body_id int4, obs observer, t timestamptz) RETURNS text
    AS 'MODULE_PATHNAME' LANGUAGE C STABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION planet_rise_set_status(int4, observer, timestamptz) IS
    'Classify planet visibility: rises_and_sets, circumpolar, or never_rises. Body IDs 1-8 (Mercury-Neptune).';
