"""Shared call / rubric / application primitives for SME-Hub subprocesses.

PRD requirement: SP4 Innovation Showcasing (FRSME-ISD002, FRSME-ISD008) and
SP5 Investment & Funding Access (FRSME-INV004, FRSME-INV006) both mandate
that they reuse the SP2 incubation call management infrastructure. The audit
flagged that the existing SP4 ``ChallengeScoringRubric`` /
``ChallengeRubricSection`` and SP5 ``FundingCall`` / ``FundingApplication``
were structural duplicates of SP2 models, not actual reuse.

This package gives the three SPs a common surface they can converge on
without breaking SP2's existing schema:

* ``ApplicationStatus`` — canonical FSM enum (DRAFT → SUBMITTED → UNDER_REVIEW
  → RETURNED_FOR_INFO / ACCEPTED / REJECTED / WITHDRAWN / NOT_SUBMITTED).
* ``BaseScoringRubric`` / ``BaseRubricSection`` — abstract Django models that
  any SP-specific rubric (incubation, challenge, funding) can inherit. SP2's
  existing concrete ``ScoringRubric`` / ``RubricSection`` stay byte-identical
  to the schema they ship with today; only *new* models added in SP4/SP5
  remediation will inherit from these bases.
* ``compute_weighted_average`` — pure function that aggregates scores into a
  0–100 percentage. Crucially it accepts a ``require_all_sections`` flag so
  SP2's INC020 gap (silent partial-submission ranking, audit finding) can be
  closed in Phase 3 without changing the helper's default behaviour.
* ``generate_application_id`` — opaque public-facing ID minter that takes a
  prefix; reused by all three SPs.
* ``judge_reminder_candidates`` / ``expired_draft_candidates`` — querysets
  that the actual Celery tasks consume; pulled out so the rules live in one
  place.

Importing ``from apps.smehub._shared.calls import …`` is the public API.
Anything inside subpackages is implementation detail.
"""
from apps.smehub._shared.calls.ids import generate_application_id, generate_call_id
from apps.smehub._shared.calls.rubrics import BaseRubricSection, BaseScoringRubric
from apps.smehub._shared.calls.scoring import compute_weighted_average
from apps.smehub._shared.calls.status import ApplicationStatus
from apps.smehub._shared.calls.workflow import (
    expired_draft_candidates,
    judge_reminder_candidates,
)

__all__ = [
    "ApplicationStatus",
    "BaseRubricSection",
    "BaseScoringRubric",
    "compute_weighted_average",
    "expired_draft_candidates",
    "generate_application_id",
    "generate_call_id",
    "judge_reminder_candidates",
]
