-- Admin booking.js + API: "Select a boarding point to load seats."
-- Run once on production after deploy (adjust localize_id if your language row ids differ).

INSERT INTO langstrings (name, created_at, updated_at, deleted_at)
SELECT 'key_select_boarding_point_to_load_seats', NOW(), NOW(), NULL
FROM DUAL
WHERE NOT EXISTS (
    SELECT 1 FROM langstrings WHERE name = 'key_select_boarding_point_to_load_seats' AND deleted_at IS NULL
);

SET @string_id = (SELECT id FROM langstrings WHERE name = 'key_select_boarding_point_to_load_seats' AND deleted_at IS NULL LIMIT 1);

INSERT INTO lngstngvalues (string_id, localize_id, value, created_at, updated_at, deleted_at)
SELECT @string_id, l.id, 'Select a boarding point to load seats.', NOW(), NOW(), NULL
FROM localizes l
WHERE l.language_code = 'en' AND l.deleted_at IS NULL
  AND NOT EXISTS (
    SELECT 1 FROM lngstngvalues v
    WHERE v.string_id = @string_id AND v.localize_id = l.id AND v.deleted_at IS NULL
  );

INSERT INTO lngstngvalues (string_id, localize_id, value, created_at, updated_at, deleted_at)
SELECT @string_id, l.id, 'الرجاء اختيار محطة الركوب اولا لاظهار المقاعد المتاحة', NOW(), NOW(), NULL
FROM localizes l
WHERE l.language_code = 'ar' AND l.deleted_at IS NULL
  AND NOT EXISTS (
    SELECT 1 FROM lngstngvalues v
    WHERE v.string_id = @string_id AND v.localize_id = l.id AND v.deleted_at IS NULL
  );
