<?php if (isset($component)) { $__componentOriginal166a02a7c5ef5a9331faf66fa665c256 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal166a02a7c5ef5a9331faf66fa665c256 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'filament-panels::components.page.index','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('filament-panels::page'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>

    
    <div class="bg-white dark:bg-gray-900 rounded-xl shadow p-6 border border-gray-200 dark:border-gray-700">
        <h2 class="text-xl font-bold mb-4">مفتاح الربط (API Access Token)</h2>
        <p class="text-gray-500 mb-4 text-sm">استخدم هذا المفتاح للربط مع أنظمتك الخارجية. حافظ على سريته.</p>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($token): ?>
            <div class="bg-green-50 border border-green-200 text-green-800 p-4 rounded-lg mb-4 flex justify-between items-center" dir="ltr">
                <code class="font-mono font-bold text-lg break-all select-all"><?php echo e($token); ?></code>
                <span class="text-xs bg-green-200 px-2 py-1 rounded mx-2">New</span>
            </div>
            <p class="text-red-500 text-xs mb-4">⚠ انسخ هذا المفتاح الآن! سيختفي بمجرد تحديث الصفحة.</p>
        <?php else: ?>
            <div class="bg-gray-100 dark:bg-gray-800 p-4 rounded-lg mb-4 text-center">
                <p class="text-gray-500 tracking-widest">****************************************</p>
            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        <?php if (isset($component)) { $__componentOriginal6330f08526bbb3ce2a0da37da512a11f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal6330f08526bbb3ce2a0da37da512a11f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'filament::components.button.index','data' => ['wire:click' => 'generateToken','icon' => 'heroicon-m-key','color' => 'primary']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('filament::button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['wire:click' => 'generateToken','icon' => 'heroicon-m-key','color' => 'primary']); ?>
            توليد مفتاح API جديد
         <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal6330f08526bbb3ce2a0da37da512a11f)): ?>
<?php $attributes = $__attributesOriginal6330f08526bbb3ce2a0da37da512a11f; ?>
<?php unset($__attributesOriginal6330f08526bbb3ce2a0da37da512a11f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal6330f08526bbb3ce2a0da37da512a11f)): ?>
<?php $component = $__componentOriginal6330f08526bbb3ce2a0da37da512a11f; ?>
<?php unset($__componentOriginal6330f08526bbb3ce2a0da37da512a11f); ?>
<?php endif; ?>
    </div>

    
    <div class="mt-6" wire:ignore>
        <h3 class="text-lg font-bold mb-4">أمثلة الربط البرمجي (Integration Examples)</h3>
        <p class="text-sm text-gray-500 mb-4">يدعم النظام نوعين من الرسائل: نصية (Text) وقوالب (Template).</p>
        
        <div x-data="{ tab: 'curl_template' }" class="rounded-xl shadow border border-gray-200 dark:border-gray-700 overflow-hidden bg-gray-50 dark:bg-gray-800">
            
            
            <div class="flex flex-wrap border-b border-gray-200 dark:border-gray-700">
                
                <button 
                    @click="tab = 'curl_template'" 
                    :class="tab === 'curl_template' ? 'bg-[#1e1e2e] !text-white border-t-4 border-blue-500' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'"
                    class="px-4 py-3 text-sm font-bold transition flex-1 sm:flex-none"
                >
                    cURL (Template)
                </button>

                <button 
                    @click="tab = 'php_template'" 
                    :class="tab === 'php_template' ? 'bg-[#1e1e2e] !text-white border-t-4 border-blue-500' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'"
                    class="px-4 py-3 text-sm font-bold transition flex-1 sm:flex-none"
                >
                    PHP (Template)
                </button>

                 <button 
                    @click="tab = 'curl_text'" 
                    :class="tab === 'curl_text' ? 'bg-[#1e1e2e] !text-white border-t-4 border-green-500' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'"
                    class="px-4 py-3 text-sm font-bold transition flex-1 sm:flex-none"
                >
                    cURL (Text)
                </button>

            </div>

            
            <div style="background-color: #1e1e2e; color: #d4d4d4;" class="p-6 overflow-x-auto text-sm font-mono leading-relaxed" dir="ltr">
                
                
                <div x-show="tab === 'curl_template'">
                    <div class="mb-2 text-gray-500">// Example: Sending OTP (Template with 1 variable)</div>
<pre>
<span style="color: #c586c0;">curl</span> -X POST <span style="color: #ce9178;">"<?php echo e(url('/api/v1/send-message')); ?>"</span> \
-H <span style="color: #ce9178;">"Authorization: Bearer <span style="color: #f1fa8c; font-weight: bold;">YOUR_API_KEY</span>"</span> \
-H <span style="color: #ce9178;">"Content-Type: application/json"</span> \
-d '{
    <span style="color: #9cdcfe;">"to"</span>: <span style="color: #ce9178;">"966500000000"</span>, <span style="color: #6a9955;">// رقم المستلم</span>
    <span style="color: #9cdcfe;">"template_name"</span>: <span style="color: #ce9178;">"otp_code"</span>,
    <span style="color: #9cdcfe;">"language_code"</span>: <span style="color: #ce9178;">"en"</span>,
    <span style="color: #9cdcfe;">"components"</span>: [
        {
            <span style="color: #9cdcfe;">"type"</span>: <span style="color: #ce9178;">"body"</span>,
            <span style="color: #9cdcfe;">"parameters"</span>: [
                {
                    <span style="color: #9cdcfe;">"type"</span>: <span style="color: #ce9178;">"text"</span>, 
                    <span style="color: #9cdcfe;">"text"</span>: <span style="color: #ce9178;">"59302"</span> <span style="color: #6a9955;">// قيمة المتغير الأول <?php echo e(1); ?></span>
                }
            ]
        }
    ]
}'
</pre>
                </div>

                
                <div x-show="tab === 'php_template'">
                    <div class="mb-2 text-gray-500">// Example: Sending Order Update (Template with 2 variables)</div>
<pre>
<span style="color: #569cd6;">$client</span> = <span style="color: #c586c0;">new</span> \GuzzleHttp\Client();
<span style="color: #569cd6;">$response</span> = <span style="color: #569cd6;">$client</span>-><span style="color: #dcdcaa;">post</span>(<span style="color: #ce9178;">'<?php echo e(url('/api/v1/send-message')); ?>'</span>, [
    <span style="color: #ce9178;">'headers'</span> => [
        <span style="color: #ce9178;">'Authorization'</span> => <span style="color: #ce9178;">'Bearer <span style="color: #f1fa8c; font-weight: bold;">YOUR_API_KEY</span>'</span>,
        <span style="color: #ce9178;">'Accept'</span>        => <span style="color: #ce9178;">'application/json'</span>,
    ],
    <span style="color: #ce9178;">'json'</span> => [
        <span style="color: #ce9178;">'to'</span> => <span style="color: #ce9178;">'966500000000'</span>, <span style="color: #6a9955;">// رقم المستلم</span>
        <span style="color: #ce9178;">'template_name'</span> => <span style="color: #ce9178;">'order_update'</span>,
        <span style="color: #ce9178;">'language_code'</span> => <span style="color: #ce9178;">'ar'</span>,
        <span style="color: #ce9178;">'components'</span> => [
            [
                <span style="color: #ce9178;">"type"</span> => <span style="color: #ce9178;">"body"</span>,
                <span style="color: #ce9178;">"parameters"</span> => [
                    [<span style="color: #ce9178;">"type"</span> => <span style="color: #ce9178;">"text"</span>, <span style="color: #ce9178;">"text"</span> => <span style="color: #ce9178;">"Ahmed"</span>],      <span style="color: #6a9955;">// <?php echo e(1); ?> Customer Name</span>
                    [<span style="color: #ce9178;">"type"</span> => <span style="color: #ce9178;">"text"</span>, <span style="color: #ce9178;">"text"</span> => <span style="color: #ce9178;">"Shipped"</span>]     <span style="color: #6a9955;">// <?php echo e(2); ?> Order Status</span>
                ]
            ]
        ]
    ]
]);
</pre>
                </div>

                
                <div x-show="tab === 'curl_text'">
                    <div class="mb-2 text-gray-500">// Example: Sending a simple Text Message (Standard)</div>
<pre>
<span style="color: #c586c0;">curl</span> -X POST <span style="color: #ce9178;">"<?php echo e(url('/api/v1/send-message')); ?>"</span> \
-H <span style="color: #ce9178;">"Authorization: Bearer <span style="color: #f1fa8c; font-weight: bold;">YOUR_API_KEY</span>"</span> \
-H <span style="color: #ce9178;">"Content-Type: application/json"</span> \
-d '{
    <span style="color: #9cdcfe;">"to"</span>: <span style="color: #ce9178;">"966500000000"</span>,
    <span style="color: #9cdcfe;">"text_message"</span>: <span style="color: #ce9178;">"Hello world from WhatsMark!"</span> <span style="color: #6a9955;">// محتوى الرسالة النصية</span>
}'
</pre>
                </div>

            </div>
        </div>
    </div>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal166a02a7c5ef5a9331faf66fa665c256)): ?>
<?php $attributes = $__attributesOriginal166a02a7c5ef5a9331faf66fa665c256; ?>
<?php unset($__attributesOriginal166a02a7c5ef5a9331faf66fa665c256); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal166a02a7c5ef5a9331faf66fa665c256)): ?>
<?php $component = $__componentOriginal166a02a7c5ef5a9331faf66fa665c256; ?>
<?php unset($__componentOriginal166a02a7c5ef5a9331faf66fa665c256); ?>
<?php endif; ?><?php /**PATH D:\WhatsMark\WhatsMark\resources\views/filament/pages/developer-api.blade.php ENDPATH**/ ?>