# Corporate Phase 2 Proposals Audit

Date: 2026-05-08

## Scope

This audit checks whether a reusable corporate proposals/commercial offers module already exists before implementing Phase 2.

## Existing Proposal/Offer Code

Status: Missing for corporate proposals.

Evidence:

- No `CorporateProposal`, `corporate_proposals`, `corporate_proposal_items`, or `corporate_proposal_activities` model/table/view exists.
- The only proposal-like lead lifecycle fields are `proposal_needed` and `proposal_sent` on `App\Models\B2bLead`.
- `docs/corporate_module_audit.md` explicitly states corporate proposals/offers are only planned and must not reuse event offers.

## EventOffer Boundary

Status: Existing, but out of scope.

Evidence:

- Event offer code exists under the event funnel module and is tied to marketing/event registrations.
- It must not be reused for corporate proposals because event offers are scoped to public event conversion flows, not institution-level B2B sales offers.

Decision:

- Build a new `CorporateProposal` module.
- Keep `EventOffer` untouched.

## Admin Routes And Phase 1 Reuse

Existing routes:

- `/admin/b2b/leads`
- `/admin/b2b/leads/{lead}`
- `/b2b`
- `/institutions`
- `/corporate`

Reusable Phase 1 assets:

- `B2bLead` lifecycle and activities.
- `Organization` as canonical corporate tenant.
- `B2bLeadPolicy` and organization tenancy hardening patterns.
- Existing messaging outbox/log tables for non-blocking notifications.
- Existing `PdfGeneratorInterface`/`DomPdfGenerator`.
- Existing `private` filesystem disk.

## What Phase 2 Will Create

New database tables:

- `corporate_proposals`
- `corporate_proposal_items`
- `corporate_proposal_activities`

New application units:

- `CorporateProposal`, `CorporateProposalItem`, `CorporateProposalActivity`
- proposal reference generator
- proposal total calculator
- proposal workflow service
- proposal PDF service
- proposal notification service
- `CorporateProposalPolicy`
- admin Livewire index/form/detail pages
- private PDF download controller
- expired proposals command

## Relationship Rules

Each proposal must link to at least one of:

- `organization_id`
- `b2b_lead_id`

Behavior:

- Proposal created from a converted lead uses `organization_id` and may keep `b2b_lead_id` for traceability.
- Proposal created from an unconverted lead uses `b2b_lead_id` and shows a warning recommending conversion to `Organization`.
- Future Phase 3 agreements must link to `CorporateProposal`/`Organization`, not to legacy `companies`.

## Implementation Notes

- No use of `companies`, `users.company_id`, or `agreement_path`.
- No agreements will be implemented in Phase 2.
- The “convert to agreement” action will be a disabled placeholder only.
