defmodule Microwaveprop.Propagation.RegionTest do
  use ExUnit.Case, async: true

  alias Microwaveprop.Propagation.Region

  describe "for_point/2" do
    test "Dallas TX is in southern_plains" do
      assert Region.for_point(32.8, -96.8) == :southern_plains
    end

    test "Houston TX is in gulf_coast" do
      assert Region.for_point(29.8, -95.4) == :gulf_coast
    end

    test "Des Moines IA is in corn_belt" do
      assert Region.for_point(41.6, -93.6) == :corn_belt
    end

    test "Tucson AZ is in desert_southwest" do
      assert Region.for_point(32.2, -110.9) == :desert_southwest
    end

    test "Seattle WA is in pacific_northwest" do
      assert Region.for_point(47.6, -122.3) == :pacific_northwest
    end

    test "New York NY is in northeast" do
      assert Region.for_point(40.7, -74.0) == :northeast
    end

    test "Atlanta GA is in southeast" do
      assert Region.for_point(33.7, -84.4) == :southeast
    end

    test "Denver CO falls into a region" do
      region = Region.for_point(39.7, -104.9)
      assert is_atom(region)
    end

    test "returns :other for points outside CONUS" do
      assert Region.for_point(19.0, -155.0) == :other
    end
  end

  describe "seasonal_adjustment/2" do
    test "returns a multiplier for known regions and months" do
      adj = Region.seasonal_adjustment(:gulf_coast, 8)
      assert is_float(adj)
      # Gulf coast August should be drier → higher seasonal score than default
      assert adj >= 0.8 and adj <= 1.3
    end

    test "returns 1.0 for unknown regions" do
      assert Region.seasonal_adjustment(:other, 6) == 1.0
    end
  end
end
