-- Migration: Seed sample rental contract terms (demo / dev)
-- Date: 2026-03-30
-- Run after: rental_contract_terms_sections_and_snapshots.sql (needs extended columns)
-- Idempotent: inserts only if there is no row with is_active = 1.

INSERT INTO rental_terms (
    content_en,
    content_ar,
    damage_policy_en,
    damage_policy_ar,
    liability_en,
    liability_ar,
    late_terms_en,
    late_terms_ar,
    is_active,
    created_by
)
SELECT
    'RENTAL AGREEMENT — GENERAL TERMS (SAMPLE)

1. The renter must return the bicycle/scooter in the same condition as received, subject to normal wear.
2. The renter is responsible for the equipment from handover until return.
3. Helmets and accessories listed at handover must be returned together with the unit.
4. This document is a sample template. Replace with your shop''s final legal text.',
    'عقد إيجار — شروط عامة (نموذج تجريبي)

١. يلتزم المستأجر بإعادة الدراجة/السكوتر بنفس الحالة المعتادة مع الاستخدام العادي.
٢. تكون مسؤولية المعدة على المستأجر من لحظة التسليم حتى الإرجاع.
٣. يجب إرجاع الخوذة والملحقات المذكورة عند التسليم مع المعدة.
٤. هذا نص تجريبي — استبدله بالصيغة القانونية النهائية لمتجرك.',
    'DAMAGE POLICY (SAMPLE)

- Report any damage immediately upon return.
- The customer may be charged for repair or replacement at market rates for damage beyond normal wear, or for loss of parts.',
    'سياسة التلف (نموذج)

- الإبلاغ عن أي تلف فور الإرجاع.
- قد يُحتسب على العميل ثمن الإصلاح أو الاستبدال حسب التكلفة الفعلية للتلف غير الاعتيادي أو فقدان القطع.',
    'CUSTOMER LIABILITY (SAMPLE)

- The customer is liable for theft or loss of the rented unit if due to negligence (e.g. unlocked bicycle).
- Traffic fines and penalties incurred during the rental period are the customer''s responsibility.',
    'مسؤولية العميل (نموذج)

- يتحمل العميل مسؤولية السرقة أو الفقدان الناتج عن الإهمال (مثلاً ترك الدراجة غير مقفلة).
- مخالفات المرور والغرامات خلال فترة الإيجار على مسؤولية العميل.',
    'LATE RETURN & RETURN TERMS (SAMPLE)

- Return must be by the agreed date and time shown on the rental record.
- Late return may incur additional fees per the shop''s hourly/daily rate until the unit is returned.
- Failure to return may be treated as misappropriation and reported as appropriate.',
    'التأخير وشروط الإرجاع (نموذج)

- يجب الإرجاع في التاريخ والوقت المتفق عليهما في سجل الإيجار.
- قد يُطبق رسم تأخير وفق تعرفة المحل بالساعة/اليوم حتى الإرجاع.
- عدم الإرجاع قد يُعامل كامتناع عن التسليم ويُتخذ الإجراء المناسب.',
    1,
    1
WHERE NOT EXISTS (SELECT 1 FROM rental_terms WHERE is_active = 1 LIMIT 1);
