<div id="wallet-endpoints" class="mt-4">
    <h3>Wallet & Withdrawal</h3>

    <div class="endpoint get">
        <span class="method get-method">GET</span>
        <span class="ms-2">/wallet</span>
        <p class="mt-2">Mendapatkan informasi wallet pengguna</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}</code></pre>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "balance": 1000000.00,
        "transactions": [
            {
                "id": 1,
                "type": "credit",
                "amount": 500000.00,
                "description": "Pembayaran booking #TRX-001",
                "status": "success",
                "created_at": "2024-05-03T10:00:00.000000Z",
                "booking": {
                    "id": 1,
                    "transaction_code": "TRX-001",
                    "service_type": "jahit",
                    "category": "baju"
                }
            }
        ]
    },
    "message": "Wallet information retrieved successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Unauthorized access"
    },
    "message": "Error."
}</code></pre>
    </div>

    <div class="endpoint get">
        <span class="method get-method">GET</span>
        <span class="ms-2">/bank-accounts</span>
        <p class="mt-2">Mendapatkan daftar akun bank pengguna</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}</code></pre>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": [
        {
            "id": 1,
            "bank_name": "BCA",
            "account_number": "1234567890",
            "account_holder_name": "John Doe",
            "status": "active",
            "verified_at": "2024-05-03T10:00:00.000000Z",
            "created_at": "2024-05-03T10:00:00.000000Z",
            "updated_at": "2024-05-03T10:00:00.000000Z"
        },
        {
            "id": 2,
            "bank_name": "Mandiri",
            "account_number": "0987654321",
            "account_holder_name": "John Doe",
            "status": "pending",
            "verified_at": null,
            "created_at": "2024-05-03T11:00:00.000000Z",
            "updated_at": "2024-05-03T11:00:00.000000Z"
        }
    ],
    "message": "Bank accounts retrieved successfully"
}</code></pre>
        <h5>Status Akun Bank</h5>
        <ul>
            <li><strong>pending</strong> - Akun bank sedang menunggu verifikasi admin</li>
            <li><strong>active</strong> - Akun bank sudah diverifikasi dan dapat digunakan</li>
            <li><strong>rejected</strong> - Akun bank ditolak oleh admin</li>
        </ul>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Unauthorized access"
    },
    "message": "Error."
}</code></pre>
    </div>

    <div class="endpoint post">
        <span class="method post-method">POST</span>
        <span class="ms-2">/bank-accounts</span>
        <p class="mt-2">Mendaftarkan akun bank baru</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}
Content-Type: application/json</code></pre>
        <h5>Request Body</h5>
        <pre><code>{
    "bank_name": "BCA",
    "account_number": "1234567890",
    "account_holder_name": "John Doe"
}</code></pre>
        <h5>Validasi</h5>
        <ul>
            <li><strong>bank_name</strong> - Wajib diisi, nama bank</li>
            <li><strong>account_number</strong> - Wajib diisi, nomor rekening</li>
            <li><strong>account_holder_name</strong> - Wajib diisi, nama pemilik rekening</li>
        </ul>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "id": 1,
        "bank_name": "BCA",
        "account_number": "1234567890",
        "account_holder_name": "John Doe",
        "status": "pending",
        "created_at": "2024-05-03T10:00:00.000000Z"
    },
    "message": "Bank account registered successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "bank_name": ["The bank name field is required."],
        "account_number": ["The account number field is required."],
        "account_holder_name": ["The account holder name field is required."]
    },
    "message": "Validation Error."
}</code></pre>
    </div>

    <div class="endpoint post">
        <span class="method post-method">POST</span>
        <span class="ms-2">/withdrawals</span>
        <p class="mt-2">Meminta penarikan dana</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}
Content-Type: application/json</code></pre>
        <h5>Request Body</h5>
        <pre><code>{
    "bank_account_id": 1,
    "amount": 500000
}</code></pre>
        <h5>Validasi</h5>
        <ul>
            <li><strong>bank_account_id</strong> - Wajib diisi, ID dari akun bank yang akan digunakan</li>
            <li><strong>amount</strong> - Wajib diisi, jumlah dana yang akan ditarik (minimal 10000)</li>
        </ul>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "id": 1,
        "wallet_id": 1,
        "bank_account_id": 1,
        "amount": 500000.00,
        "status": "pending",
        "created_at": "2024-05-03T10:00:00.000000Z",
        "updated_at": "2024-05-03T10:00:00.000000Z"
    },
    "message": "Withdrawal request submitted successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Insufficient balance."
    },
    "message": "Insufficient balance."
}</code></pre>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Invalid bank account."
    },
    "message": "Invalid bank account."
}</code></pre>
    </div>

    <div class="endpoint get">
        <span class="method get-method">GET</span>
        <span class="ms-2">/withdrawals</span>
        <p class="mt-2">Mendapatkan riwayat penarikan dana</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}</code></pre>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": [
        {
            "id": 1,
            "wallet_id": 1,
            "bank_account_id": 1,
            "amount": 500000.00,
            "status": "completed",
            "rejection_reason": null,
            "proof_of_payment": "proof_1.jpg",
            "processed_at": "2024-05-03T11:00:00.000000Z",
            "created_at": "2024-05-03T10:00:00.000000Z",
            "updated_at": "2024-05-03T11:00:00.000000Z",
            "bank_account": {
                "id": 1,
                "bank_name": "BCA",
                "account_number": "1234567890",
                "account_holder_name": "John Doe",
                "status": "active"
            }
        },
        {
            "id": 2,
            "wallet_id": 1,
            "bank_account_id": 1,
            "amount": 300000.00,
            "status": "pending",
            "rejection_reason": null,
            "proof_of_payment": null,
            "processed_at": null,
            "created_at": "2024-05-04T10:00:00.000000Z",
            "updated_at": "2024-05-04T10:00:00.000000Z",
            "bank_account": {
                "id": 1,
                "bank_name": "BCA",
                "account_number": "1234567890",
                "account_holder_name": "John Doe",
                "status": "active"
            }
        }
    ],
    "message": "Withdrawal history retrieved successfully"
}</code></pre>
        <h5>Status Penarikan</h5>
        <ul>
            <li><strong>pending</strong> - Permintaan penarikan menunggu diproses oleh admin</li>
            <li><strong>processing</strong> - Permintaan penarikan sedang diproses</li>
            <li><strong>completed</strong> - Permintaan penarikan telah selesai</li>
            <li><strong>rejected</strong> - Permintaan penarikan ditolak</li>
        </ul>
    </div>

    <h4 class="mt-4">Admin Endpoints</h4>

    <div class="endpoint get">
        <span class="method get-method">GET</span>
        <span class="ms-2">/admin/withdrawals/pending</span>
        <p class="mt-2">Mendapatkan daftar permintaan penarikan yang pending</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}</code></pre>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": [
        {
            "id": 1,
            "wallet_id": 1,
            "bank_account_id": 1,
            "amount": 500000.00,
            "status": "pending",
            "rejection_reason": null,
            "proof_of_payment": null,
            "processed_at": null,
            "created_at": "2024-05-03T10:00:00.000000Z",
            "updated_at": "2024-05-03T10:00:00.000000Z",
            "wallet": {
                "id": 1,
                "user_id": 2,
                "balance": 1000000.00,
                "user": {
                    "id": 2,
                    "name": "John Doe",
                    "email": "john@example.com",
                    "role": "penjahit"
                }
            },
            "bank_account": {
                "id": 1,
                "bank_name": "BCA",
                "account_number": "1234567890",
                "account_holder_name": "John Doe",
                "status": "active"
            }
        }
    ],
    "message": "Pending withdrawals retrieved successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Unauthorized access"
    },
    "message": "Error."
}</code></pre>
    </div>

    <div class="endpoint post">
        <span class="method post-method">POST</span>
        <span class="ms-2">/admin/withdrawals/{withdrawal}/process</span>
        <p class="mt-2">Memproses permintaan penarikan</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}
Content-Type: multipart/form-data</code></pre>
        <h5>Path Parameters</h5>
        <ul>
            <li><strong>withdrawal</strong> - ID permintaan penarikan</li>
        </ul>
        <h5>Request Body</h5>
        <pre><code>{
    "status": "processing", // atau "rejected"
    "rejection_reason": "", // wajib diisi jika status = "rejected"
    "proof_of_payment": [file] // wajib diupload jika status = "processing"
}</code></pre>
        <h5>Validasi</h5>
        <ul>
            <li><strong>status</strong> - Wajib diisi, nilai yang valid: "processing" atau "rejected"</li>
            <li><strong>rejection_reason</strong> - Wajib diisi jika status = "rejected"</li>
            <li><strong>proof_of_payment</strong> - Wajib diisi jika status = "processing", file bukti pembayaran</li>
        </ul>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "id": 1,
        "wallet_id": 1,
        "bank_account_id": 1,
        "amount": 500000.00,
        "status": "processing",
        "rejection_reason": null,
        "proof_of_payment": "proofs/withdrawal_1_proof.jpg",
        "processed_at": "2024-05-03T10:30:00.000000Z",
        "created_at": "2024-05-03T10:00:00.000000Z",
        "updated_at": "2024-05-03T10:30:00.000000Z"
    },
    "message": "Withdrawal processed successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "status": ["The status field is required."],
        "rejection_reason": ["The rejection reason field is required when status is rejected."],
        "proof_of_payment": ["The proof of payment field is required when status is processing."]
    },
    "message": "Validation Error."
}</code></pre>
    </div>

    <div class="endpoint post">
        <span class="method post-method">POST</span>
        <span class="ms-2">/admin/withdrawals/{withdrawal}/complete</span>
        <p class="mt-2">Menyelesaikan proses penarikan</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}
Content-Type: application/json</code></pre>
        <h5>Path Parameters</h5>
        <ul>
            <li><strong>withdrawal</strong> - ID permintaan penarikan</li>
        </ul>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "id": 1,
        "wallet_id": 1,
        "bank_account_id": 1,
        "amount": 500000.00,
        "status": "completed",
        "rejection_reason": null,
        "proof_of_payment": "proofs/withdrawal_1_proof.jpg",
        "processed_at": "2024-05-03T10:30:00.000000Z",
        "created_at": "2024-05-03T10:00:00.000000Z",
        "updated_at": "2024-05-03T11:00:00.000000Z"
    },
    "message": "Withdrawal completed successfully"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "error": "Invalid status."
    },
    "message": "Invalid status."
}</code></pre>
    </div>

    <div class="endpoint post">
        <span class="method post-method">POST</span>
        <span class="ms-2">/admin/bank-accounts/{bankAccount}/verify</span>
        <p class="mt-2">Memverifikasi akun bank</p>
        <h5>Headers</h5>
        <pre><code>Authorization: Bearer {token}
Content-Type: application/json</code></pre>
        <h5>Path Parameters</h5>
        <ul>
            <li><strong>bankAccount</strong> - ID akun bank</li>
        </ul>
        <h5>Request Body</h5>
        <pre><code>{
    "status": "active", // atau "rejected"
    "rejection_reason": null // wajib diisi jika status = "rejected"
}</code></pre>
        <h5>Validasi</h5>
        <ul>
            <li><strong>status</strong> - Wajib diisi, nilai yang valid: "active" atau "rejected"</li>
            <li><strong>rejection_reason</strong> - Wajib diisi jika status = "rejected"</li>
        </ul>
        <h5>Response</h5>
        <pre><code>{
    "success": true,
    "data": {
        "id": 1,
        "user_id": 2,
        "bank_name": "BCA",
        "account_number": "1234567890",
        "account_holder_name": "John Doe",
        "status": "active",
        "rejection_reason": null,
        "verified_at": "2024-05-03T10:00:00.000000Z",
        "created_at": "2024-05-02T10:00:00.000000Z",
        "updated_at": "2024-05-03T10:00:00.000000Z"
    },
    "message": "Bank account verification completed"
}</code></pre>
        <h5>Error Response</h5>
        <pre><code>{
    "success": false,
    "data": {
        "status": ["The status field must be one of: active, rejected."],
        "rejection_reason": ["The rejection reason field is required when status is rejected."]
    },
    "message": "Validation Error."
}</code></pre>
    </div>
</div> 