provider-request:
  post:
    tags: [Account Roles]
    summary: Add a pending provider role request to the current client account
    description: |
      Requires Client token. Creates a pending Provider request for the current
      Client AccountIdentity. The ProviderMeta request is stored under the client's
      existing AccountIdentity. Identity fields are copied from AccountIdentity and cannot
      be supplied by the caller. No Provider or new AccountIdentity is created,
      no password is accepted, and provider mode remains unavailable until approval.
      When an active super administrator exists, the successful request also dispatches
      a dashboard review notification linked to the new ProviderMeta request.

      <div class="figma-links"><span>Switch in Home:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>

      <div class="figma-links"><span>Switch More:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>
    operationId: addProviderRoleRequest
    x-admin-notification:
      onSuccess: true
      recipient: active super administrator
      target: /dashboard/providersMeta/show/{providerRequestId}
    x-figma:
      switchInHome:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9064:3213"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10227:32828"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9967:22765"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10760:85825"
      switchMore:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9449:7875"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10257:112264"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9509:8480"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10762:100498"
    security:
      - SecretKeyAuth: []
        ClientBearerAuth: []
    parameters:
      - $ref: '../openapi.yaml#/components/parameters/LangHeader'
    requestBody:
      required: true
      content:
        multipart/form-data:
          schema:
            $ref: '../openapi.yaml#/components/schemas/ProviderRoleRequest'
          example:
            city: "665f1c2a9b4e1d0012ab34cf"
            nationalId: "1000000000"
            whatsappCountryCode: "+966"
            whatsappNumber: "0551234567"
    responses:
      '200':
        description: Provider request created and linked to the existing identity.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/AccountRoleAddResponse'
            example:
              key: success
              message: "تم إرسال طلب إضافة دور مقدم الخدمة بنجاح"
              status: 200
              data:
                providerRequestId: "665f1c2a9b4e1d0012ab34d1"
                accountMode:
                  activeMode: client
                  roles: [client, provider]
                  availableModes: [client]
                  canSwitchToClient: true
                  canSwitchToProvider: false
                  providerStatus: pending
                  clientId: "665f1c2a9b4e1d0012ab34cd"
                  providerId: null
      '400':
        description: Invalid business fields, duplicate role/request, or identity collision.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/ValidationErrorResponse'
            examples:
              passwordRejected:
                value: { key: fail, message: "لا يلزم إرسال كلمة مرور لإضافة دور جديد", status: 400 }
              pendingRequest:
                value: { key: fail, message: "يوجد طلب مقدم خدمة قيد المراجعة بالفعل", status: 400 }
      '419': { $ref: '#/account-role-unauthorized' }
      '423': { $ref: '#/account-role-blocked' }
      '500': { $ref: '#/account-role-server-error' }

client-role:
  post:
    tags: [Account Roles]
    summary: Add a client role to the current provider account
    description: |
      Requires Provider token. Adds a Client role to the current Provider
      AccountIdentity. Creates a Client profile under the provider's existing
      AccountIdentity. The request has no body and never accepts a password.
      No new AccountIdentity is created. An accepted provider keeps provider mode;
      a pending provider receives client mode only.

      <div class="figma-links"><span>Switch in Home:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>

      <div class="figma-links"><span>Switch More:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>
    operationId: addClientRole
    x-figma:
      switchInHome:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9064:3213"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10227:32828"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9967:22765"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10760:85825"
      switchMore:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9449:7875"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10257:112264"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9509:8480"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10762:100498"
    security:
      - SecretKeyAuth: []
        ProviderBearerAuth: []
    parameters:
      - $ref: '../openapi.yaml#/components/parameters/LangHeader'
    responses:
      '200':
        description: Client role and profile created under the existing identity.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/AccountRoleAddResponse'
            example:
              key: success
              message: "تمت إضافة دور العميل بنجاح"
              status: 200
              data:
                clientId: "665f1c2a9b4e1d0012ab34cd"
                accountMode:
                  activeMode: provider
                  roles: [client, provider]
                  availableModes: [client, provider]
                  canSwitchToClient: true
                  canSwitchToProvider: true
                  providerStatus: accepted
                  clientId: "665f1c2a9b4e1d0012ab34cd"
                  providerId: "665f1c2a9b4e1d0012ab34ce"
      '400':
        description: Client role already exists, request body is non-empty, or identity data conflicts.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/ValidationErrorResponse'
            examples:
              roleExists:
                value: { key: fail, message: "دور العميل مضاف بالفعل إلى الحساب", status: 400 }
              passwordRejected:
                value: { key: fail, message: "لا يلزم إرسال كلمة مرور لإضافة دور جديد", status: 400 }
      '419': { $ref: '#/account-role-unauthorized' }
      '423': { $ref: '#/account-role-blocked' }
      '500': { $ref: '#/account-role-server-error' }

switch-mode:
  post:
    tags: [Account Roles]
    summary: Switch the current AccountIdentity active mode
    description: |
      Requires Client or Provider token. Changes `AccountIdentity.activeMode`
      and issues a fresh access token for the selected active profile. It never
      asks for a password, creates a role/profile/AccountIdentity, or issues a new Provider. Client mode
      requires an active linked Client. Provider mode requires an accepted, active,
      linked Provider. Pending, rejected, disabled, blocked, deleted, or missing
      Provider profiles cannot enter provider mode. A successful response hydrates
      the active safe profile DTO directly in `data`: a Client DTO in client mode
      or a Provider DTO in provider mode. It does not add client/provider wrappers
      and returns the new token as `token` with `tokenType=access`. The caller
      must replace its current session token after a successful switch.

      <div class="figma-links"><span>Switch in Home:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%D8%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%D8%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%D8%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%D8%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>

      <div class="figma-links"><span>Switch More:</span><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%D8%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Client Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Client Web</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1" target="_blank" rel="noopener">Provider Mobile</a><a href="https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038" target="_blank" rel="noopener">Provider Web</a></div>
    operationId: switchAccountMode
    x-figma:
      switchInHome:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9064-3213&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9064:3213"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10227-32828&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10227:32828"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9967-22765&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9967:22765"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10760-85825&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10760:85825"
      switchMore:
        clientMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9449-7875&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        clientMobileNodeId: "9449:7875"
        clientWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10257-112264&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        clientWebNodeId: "10257:112264"
        providerMobile: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?node-id=9509-8480&viewport=176%2C570%2C0.02&t=c4yTtQLlUc9FQir5-1&scaling=scale-down&content-scaling=fixed&starting-point-node-id=9064%3A6087&page-id=0%3A1"
        providerMobileNodeId: "9509:8480"
        providerWeb: "https://www.figma.com/proto/mTRILiWaS8pzLcNnmAUr2k/%D9%83%D9%85-%D8%AA%B3%D9%88%D9%8A?page-id=10227%3A31854&node-id=10762-100498&viewport=-948%2C0%2C0.12&t=PNIRCKFxGV24peHK-1&scaling=min-zoom&content-scaling=fixed&starting-point-node-id=10449%3A65038"
        providerWebNodeId: "10762:100498"
    security:
      - SecretKeyAuth: []
        ClientBearerAuth: []
      - SecretKeyAuth: []
        ProviderBearerAuth: []
    parameters:
      - $ref: '../openapi.yaml#/components/parameters/LangHeader'
    requestBody:
      required: true
      content:
        multipart/form-data:
          schema:
            $ref: '../openapi.yaml#/components/schemas/SwitchModeRequest'
          examples:
            client:
              value: { mode: client }
            provider:
              value: { mode: provider }
    responses:
      '200':
        description: Active mode changed and the matching safe active profile was returned.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/SwitchModeResponse'
            examples:
              provider:
                summary: Switch to the accepted Provider profile
                value:
                  key: success
                  message: "تم تغيير وضع الحساب بنجاح"
                  status: 200
                  data:
                    currentRole: provider
                    id: "665f1c2a9b4e1d0012ab34ce"
                    name: "متجر كامتسوى"
                    avatar: "https://example.test/assets/provider.png"
                    countryCode: "+966"
                    phone: "0512345678"
                    fullPhone: "+9660512345678"
                    userType: provider
                    status: active
                    statusText: "نشط"
                    active: true
                    token: "<provider-account-access-token>"
                    tokenType: access
                    accountMode:
                      activeMode: provider
                      roles: [client, provider]
                      availableModes: [client, provider]
                      canSwitchToClient: true
                      canSwitchToProvider: true
                      providerStatus: accepted
                      clientId: "665f1c2a9b4e1d0012ab34cd"
                      providerId: "665f1c2a9b4e1d0012ab34ce"
              client:
                summary: Switch to the Client profile
                value:
                  key: success
                  message: "تم تغيير وضع الحساب بنجاح"
                  status: 200
                  data:
                    currentRole: client
                    id: "665f1c2a9b4e1d0012ab34cd"
                    name: "عميل كامتسوى"
                    avatar: "https://example.test/assets/client.png"
                    countryCode: "+966"
                    phone: "0512345678"
                    fullPhone: "+9660512345678"
                    userType: client
                    status: active
                    statusText: "نشط"
                    active: true
                    token: "<client-account-access-token>"
                    tokenType: access
                    accountMode:
                      activeMode: client
                      roles: [client, provider]
                      availableModes: [client, provider]
                      canSwitchToClient: true
                      canSwitchToProvider: true
                      providerStatus: accepted
                      clientId: "665f1c2a9b4e1d0012ab34cd"
                      providerId: "665f1c2a9b4e1d0012ab34ce"
      '400':
        description: Missing/invalid mode or the requested linked profile is unavailable.
        content:
          application/json:
            schema:
              $ref: '../openapi.yaml#/components/schemas/ValidationErrorResponse'
            examples:
              invalidMode:
                value: { key: fail, message: "وضع الحساب يجب أن يكون عميلاً أو مقدم خدمة", status: 400 }
              providerPendingApproval:
                value: { key: fail, message: "طلب التحول إلى حساب الأعمال قيد مراجعة الإدارة. ستتمكن من الانتقال بعد الموافقة على طلبك", status: 400 }
              providerUnavailable:
                value: { key: fail, message: "وضع مقدم الخدمة غير متاح لهذا الحساب", status: 400 }
              passwordRejected:
                value: { key: fail, message: "لا يلزم إرسال كلمة مرور لإضافة دور جديد", status: 400 }
      '419': { $ref: '#/account-role-unauthorized' }
      '423': { $ref: '#/account-role-blocked' }
      '500': { $ref: '#/account-role-server-error' }

account-role-unauthorized:
  description: Bearer authentication or an AccountIdentity-backed session is missing.
  content:
    application/json:
      schema:
        $ref: '../openapi.yaml#/components/schemas/ErrorResponse'
      example: { key: unauthorized, message: "يرجى تحديث الجلسة أو تسجيل الدخول مرة أخرى", status: 419 }

account-role-blocked:
  description: The account is blocked.
  content:
    application/json:
      schema:
        $ref: '../openapi.yaml#/components/schemas/ErrorResponse'
      example: { key: blocked, message: "حسابك موقوف حالياً", status: 423 }

account-role-server-error:
  description: Unexpected server error without sensitive details.
  content:
    application/json:
      schema:
        $ref: '../openapi.yaml#/components/schemas/ErrorResponse'
      example: { key: exception, message: "حدث خطأ، برجاء التواصل مع الدعم", status: 500 }
