# API plan — POST /api/v1/provider/auth/register   (audience: `provider` · flow: `auth`)

> مكتفٍ بذاته. ابنِ من هذا الملف عبر `docs/build/build-api.md`. لا تجمع خطوات فلو متعدّد في endpoint واحد.

## 1) Identity
- **Endpoint:** `POST /api/v1/provider/auth/register`
- **Audience / platform:** `provider` — `app`
- **Flow / screen:** `auth` — Figma: Account — **screen link:** https://www.figma.com/design/pIFyEHCimnG9rIRh3TMnHC/HR?node-id=17257-692&m=dev — **action:** إنشاء حساب أعمال
- **Auth / guard:** `public`
- **Rate limit:** none
- **Ownership:** none
- **Consumer:** تسجيل الشركة

## 2) How it works — logic
- جدول `providers`. حقول: صورة، جوال، إيميل، `city_id`، `location`، `contact_phone`، `tax_number`، `company_name`، `sector`، `company_size`، `name`، `job_title`. من غير `password` ومن غير `provider_type`.
- `sector` و `company_size` من صفحة «بيانات الشركة» ويصلان في نفس طلب التسجيل. التصميم يعرضهما قائمة منسدلة من غير قيم ثابتة، فيُحفظ النص المختار.
- تجاهل موعد المقابلة على الفورم (خلط mock).
- index لا unique على email/phone + Form Request soft-delete-aware.

## 3) Request
- Path / query: —
- Body: `name` · `phone` · `country_code` · `email` · `company_name` · `sector` · `company_size` · `tax_number` · `job_title` · `contact_phone` · `city_id` · `location` · `image`
- نوع الحساب: `GET /api/v1/provider/auth/provider-types` ثم `PATCH /api/v1/provider/auth/provider-type` بعد الدخول.
- Files: `image` — FILES على Provider
- **Form Request:** `App\Http\Requests\Api\Provider\Auth\RegisterRequest` (extends `BaseApiRequest`).
- [x] no client-only rules
- [x] enum via Rule::enum
- [x] unique/exists soft-delete-aware
- [x] phone country_code+PhoneNormalizer
- [x] messages in validation.php

## 4) Response
- **Success:** 201 ProviderResource + token
- **UI copy:** ar `تم إنشاء حساب الأعمال` · en `Business account created`
- **Shape:** flat `data` · enums `{value,label}` · token داخل Resource إن وُجد.
- **Errors:** 422 · 401 · 403 · 404

## 5) Postman
- **Folder path:** `Auth` / `provider-auth` · **Request name:** `register`
- **URL:** `{{base_url}}provider/auth/register` · **POST**
- **Auth:** none
- **Body:** قيم عربية واقعية (محمد العلي / 0551112233 / الرياض)
- **Examples:** ✅ success · ⚠️ 422 · ❌ 401

## 6) Build checklist
- [ ] route + thin controller + service + Form Request + Resource
- [ ] lang ar+en · tests · Postman من §5
