"""Single source of truth for the Automatic-review defaults.

The dock (`ai_segmentation_dockwidget.py`) sets the review spin/slider start
values from these; the plugin controller (`ai_segmentation_plugin.py`) uses the
same numbers as fallbacks when it reads the review settings back. Both used to
carry private copies with "kept in sync" comments; the copies drifted risk is
gone now that they import from here (core layer, so both UI files can). Grep-
proof: each constant is defined exactly once, right here.
"""

from __future__ import annotations

# Cloud-model detection-confidence: the UI's default cutoff, AND the value the plugin
# uses as the recall-leaning starting point for the post-run review slider. 0.30
# is the transformers-library default and recall-leaning for aerial imagery
# (users prefer deleting a few false positives over re-running). The much lower
# recall FLOOR actually sent to the server (`_RECALL_FLOOR`) is plugin-private:
# every plausible mask comes back so the slider re-filters client-side, free.
AUTO_DEFAULT_CONFIDENCE = 0.30

# The review's "px" unit is DYNAMIC: 1 px = one pixel of the run's returned
# masks (worker-observed, `_auto_refine_pixel_size`), NOT a fixed ground size
# and NOT the source raster's native pixel. So the same default is gentle on a
# close-up single-tile run (tiny ground tolerance, detail kept) and strong
# enough on a coarse wide run (tolerance grows with the staircase step).

# Simplify (px): a gentle 0.4 so detections keep their TRUE detail out of the
# box; the user opts into more smoothing by raising the visible Simplify spinbox.
# Sub-pixel default, so its spinbox must be a QDoubleSpinBox.
AUTO_REVIEW_SIMPLIFY_DEFAULT = 0.4

# Clean edges (morphological opening, px): 0.5 by default so detections come out
# clean; lower to 0 for faithful raw outlines, raise to strip thicker attached
# fringe the cloud model leaves around objects. Acts on the object's OWN outline (unlike Min
# size, which drops separate small features). 0 = off, adjustable live.
AUTO_REVIEW_CLEAN_DEFAULT = 0.5

# Round corners (QgsGeometry.smooth): off by default (faithful angular outlines).
AUTO_REVIEW_SMOOTH_DEFAULT = False

# Right angles (QgsGeometry.orthogonalize): off by default (faithful outlines).
# Opt-in regularizer for man-made shapes (buildings, pools, panels): snaps every
# edge to 90 degrees so footprints read as hand-digitized. Deliberately
# opinionated (it moves geometry toward what the shape "should" be), hence
# never on by default; the user checks it when the objects warrant it.
AUTO_REVIEW_ORTHO_DEFAULT = False

# Expand/shrink (px): 0 by default (no buffer).
AUTO_REVIEW_EXPAND_DEFAULT = 0

# Fill interior holes: ON by default. Now that instances come back cleanly
# separated (per-tile NMS + select-duplicates merging), an interior hole in a
# single detection is almost always mask noise, not information, so filling
# reads as "clean" for the general case (Yvann 2026-07-03, reversing the
# earlier opt-in). The classes where holes ARE real keep it off explicitly in
# review_presets: natural_area (clearings, islands) and linear (road medians).
AUTO_REVIEW_FILL_HOLES_DEFAULT = True
