{"openapi":"3.0.3","info":{"title":"QHR Open API","version":"v1","description":"The QHR Open API lets your systems, partners' apps and Claude work with your company's HR data:\nemployees, attendance, leave, requests and payroll. It runs the same rules as the QHR web app —\na token can never see or do more than the person who created it.\n\n**Authentication.** Create a token in QHR › Settings › API \u0026 Integrations and send it on every\nrequest as `Authorization: Bearer qhr_…`. A token works in one company only (the one active when it\nwas created). A *read* token can call operations marked `x-access: read`; anything else needs a\ntoken created with \"Allow changes\".\n\n**Errors.** Every error body is `{ \"error\": \"\u003cmessage\u003e\", \"code\": \"\u003cstable_code\u003e\" }`. Branch on\n`code`; `error` is human text in the requested language and may be reworded. Each operation lists\nthe codes it can return with their meaning and how to fix them.\n\n**Errors every operation can return.** Besides the ones listed on each operation:\n`402`/`412`/`425` `entitlement_blocked` when the company cannot use the feature, `429` `rate_limited`\nabove 120 requests a minute per token, and `500` `internal_error`. They are listed once, by status,\nunder the top-level `x-global-responses`, in the same shape as an operation's responses.\n\n**Language.** Send `Accept-Language: ar` or `en` for messages and translated labels.\n\n**Pagination.** List operations take `page` and `per_page` and answer\n`{ \"records\": [...], \"pagination\": { \"current_page\", \"per_page\", \"total_entries\", \"pages\" } }`.","x-description-ar":"تتيح واجهة QHR المفتوحة لأنظمتك وتطبيقات شركائك ولـ Claude التعامل مع بيانات الموارد البشرية في شركتك:\nالموظفين والحضور والإجازات والطلبات والرواتب. تُطبَّق عليها قواعد تطبيق QHR نفسها — فلا يرى رمز الواجهة\nالبرمجية (التوكن) ولا يفعل أكثر مما يستطيعه الشخص الذي أنشأه.\n\n**المصادقة.** أنشئ رمزاً من QHR › الإعدادات › الواجهة البرمجية والتكاملات وأرسله مع كل طلب بالشكل\n`Authorization: Bearer qhr_…`. يعمل الرمز في شركة واحدة فقط (الشركة النشطة وقت إنشائه). الرمز المخصص\nللقراءة يستدعي العمليات المعلَّمة `x-access: read` فقط، وما عداها يحتاج رمزاً مفعّلاً عليه «السماح بالتعديل».\n\n**الأخطاء.** جسم كل خطأ بالشكل `{ \"error\": \"\u003cرسالة\u003e\", \"code\": \"\u003cرمز ثابت\u003e\" }`. اعتمد على `code` في\nمنطقك؛ أما `error` فنص للقارئ بلغة الطلب وقد تتغير صياغته. تذكر كل عملية الرموز التي قد تعيدها ومعناها\nوطريقة حلها.\n\n**أخطاء قد تعيدها أي عملية.** إضافة إلى المذكور في كل عملية: `402`/`412`/`425` بالرمز\n`entitlement_blocked` عندما لا تستطيع الشركة استخدام الميزة، و`429` بالرمز `rate_limited` عند تجاوز ١٢٠ طلباً\nفي الدقيقة للرمز الواحد، و`500` بالرمز `internal_error`. وهي مذكورة مرة واحدة حسب الحالة تحت المفتاح العلوي\n`x-global-responses` بشكل استجابات العمليات نفسه.\n\n**اللغة.** أرسل `Accept-Language: ar` أو `en` لتصلك الرسائل والتسميات باللغة المطلوبة.\n\n**الصفحات.** عمليات القوائم تقبل `page` و`per_page` وتعيد\n`{ \"records\": [...], \"pagination\": { \"current_page\", \"per_page\", \"total_entries\", \"pages\" } }`."},"servers":[{"url":"https://qhr-api.qdev.it/open/v1","description":"QHR","x-description-ar":"QHR"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Token","x-name-ar":"الرمز","description":"Who the token acts as, in which company, and what it can reach. Call it first to check a token works.","x-description-ar":"باسم من يعمل الرمز، وفي أي شركة، وما الذي يستطيع الوصول إليه. استدعِه أولاً للتأكد من أن الرمز يعمل."},{"name":"Audit log","x-name-ar":"سجل التدقيق","description":"Who changed what and when: every record created, updated or deleted in the company, with the fields that changed and their old and new values.","x-description-ar":"من غيّر ماذا ومتى: كل سجل أُنشئ أو عُدّل أو حُذف في الشركة، مع الحقول التي تغيّرت وقيمها القديمة والجديدة."},{"name":"Dashboard","x-name-ar":"لوحة المعلومات","description":"The home-page widgets of QHR: company headcount figures, the leave requests waiting for your decision and the ones already decided, who is away, upcoming public holidays and team news such as new joiners and work anniversaries.","x-description-ar":"عناصر الصفحة الرئيسية في QHR: أرقام الموظفين في الشركة، وطلبات الإجازة التي تنتظر قرارك وتلك التي بُتّ فيها، ومن هو في إجازة، والعطل الرسمية القادمة، وأخبار الفريق مثل المنضمين الجدد وذكرى سنوات العمل."},{"name":"Departments","x-name-ar":"الأقسام","description":"The company's departments (Finance, Sales…), which employees belong to and which handle request types.","x-description-ar":"أقسام الشركة (المالية، المبيعات…) التي ينتمي إليها الموظفون وتتولى أنواع الطلبات."},{"name":"Documents","x-name-ar":"المستندات","description":"Employees' files kept in QHR — ID and residency copies, passports, contracts, certificates — filed in folders on each employee's profile. A document can carry an expiry date: QHR flags it as expiring soon or expired, reminds the employee by email, keeps every renewed copy as a version, and records whether HR has verified it.","x-description-ar":"ملفات الموظفين المحفوظة في QHR — صور الهوية والإقامة وجوازات السفر والعقود والشهادات — مرتبة في مجلدات داخل ملف كل موظف. يمكن أن يحمل المستند تاريخ انتهاء، فينبّه QHR إلى قرب انتهائه أو انتهائه، ويذكّر الموظف بالبريد، ويحتفظ بكل نسخة مجددة كإصدار، ويسجل ما إذا كانت الموارد البشرية قد تحققت منه."},{"name":"Employee imports \u0026 bulk updates","x-name-ar":"استيراد الموظفين والتعديل الجماعي","description":"Spreadsheet work on many employees at once: adding up to 500 new employees from the import template, and editing existing employees through a sheet that is previewed before anything changes.","x-description-ar":"العمل على عدد كبير من الموظفين دفعة واحدة عبر جداول البيانات: إضافة حتى ٥٠٠ موظف جديد من قالب الاستيراد، وتعديل الموظفين الحاليين بملف تُعرض معاينته قبل أن يتغير أي شيء."},{"name":"Employee invitations","x-name-ar":"دعوات الموظفين","description":"Who can sign in to QHR: each employee's login status, sending an employee an email invitation to sign in, and withdrawing an invitation that was not accepted yet.","x-description-ar":"من يستطيع الدخول إلى QHR: حالة دخول كل موظف، وإرسال دعوة بالبريد لموظف ليدخل إلى النظام، وسحب دعوة لم تُقبل بعد."},{"name":"Employees","x-name-ar":"الموظفون","description":"The company's people: who works here, their personal, job and contract data, who reports to whom, and whose profile still needs completing.","x-description-ar":"موظفو الشركة: من يعمل فيها، وبياناتهم الشخصية والوظيفية وبيانات العقد، ومن يتبع لمن، ومن لا يزال ملفه بحاجة إلى استكمال."},{"name":"Notifications","x-name-ar":"الإشعارات","description":"The token owner's in-app notifications (the bell in QHR): requests assigned to them, approvals they are asked for, decisions on their own requests, comments and due dates.","x-description-ar":"إشعارات صاحب الرمز داخل التطبيق (الجرس في QHR): الطلبات المسندة إليه، والموافقات المطلوبة منه، والقرارات على طلباته، والتعليقات ومواعيد الاستحقاق."},{"name":"Roles \u0026 permissions","x-name-ar":"الأدوار والصلاحيات","description":"Roles decide what each user may see and do in QHR. A role is a named bundle of permissions (view, create, edit, delete… per module) given to users. This tag covers the company's roles and the catalogue of permissions a role can grant.","x-description-ar":"تحدد الأدوار ما يستطيع كل مستخدم رؤيته والقيام به في QHR. الدور مجموعة مسمّاة من الصلاحيات (عرض، إنشاء، تعديل، حذف… لكل وحدة) تُمنح للمستخدمين. يشمل هذا القسم أدوار الشركة ودليل الصلاحيات التي يمكن أن يمنحها الدور."},{"name":"Users","x-name-ar":"المستخدمون","description":"The people who can sign in to the company's QHR, each with a role that decides what they may see and do. A user is not the same as an employee: an employee is an HR record (job, salary, leave), and a user is a login. An employee becomes a user when invited to QHR; a user with no employee record (the owner, an outside accountant) is a \"system user\" and takes one of the plan's user seats.","x-description-ar":"الأشخاص الذين يستطيعون تسجيل الدخول إلى QHR في الشركة، ولكل منهم دور يحدد ما يستطيع رؤيته والقيام به. المستخدم ليس هو الموظف: الموظف سجل في الموارد البشرية (وظيفة وراتب وإجازات)، والمستخدم حساب دخول. يصبح الموظف مستخدماً عند دعوته إلى QHR، أما المستخدم الذي ليس له سجل وظيفي (مالك الشركة، أو محاسب من خارجها) فهو «مستخدم نظام» ويشغل أحد مقاعد المستخدمين في الباقة."},{"name":"Attendance","x-name-ar":"الحضور","description":"The working day itself: checking in and out from an app, pausing for breaks, an employee's own attendance history and schedule, and a manager correcting a team member's day.","x-description-ar":"يوم العمل نفسه: تسجيل الحضور والانصراف من تطبيق، والاستراحات، وسجل حضور الموظف وجدول عمله، وتصحيح المدير ليوم أحد أعضاء فريقه."},{"name":"Attendance calendar","x-name-ar":"تقويم الحضور","description":"The company-wide calendar settings: which weekdays are the weekend and which timezone the company's working days, check-ins and reports are counted in.","x-description-ar":"إعدادات التقويم على مستوى الشركة: أيام عطلة نهاية الأسبوع، والمنطقة الزمنية التي تُحتسب بها أيام العمل وتسجيلات الحضور والتقارير."},{"name":"Attendance device support","x-name-ar":"دعم أجهزة الحضور","description":"Requests to the QHR team to support a device model that is not in the catalogue yet, or one that will not connect, and the replies the team has sent.","x-description-ar":"طلبات إلى فريق QHR لدعم طراز جهاز غير موجود في القائمة بعد أو جهاز لا يتصل بالنظام، والردود التي أرسلها الفريق."},{"name":"Attendance devices","x-name-ar":"أجهزة الحضور","description":"Fingerprint, card and face readers that record attendance at a location: registering a device and connecting it, linking each number on the device to an employee, and the raw log of every scan the devices send.","x-description-ar":"أجهزة البصمة والبطاقة والتعرّف على الوجه التي تسجّل الحضور في موقع عمل: تسجيل الجهاز وربطه بالنظام، وربط كل رقم على الجهاز بموظف، والسجل الخام لكل بصمة ترسلها الأجهزة."},{"name":"Attendance log","x-name-ar":"سجل الحضور","description":"The detailed attendance log: one row per employee per working day with the check-in and check-out times, where and how each was punched, minutes late or left early, and the day's status — plus status counts per day and punctuality insights.","x-description-ar":"سجل الحضور التفصيلي: صف لكل موظف في كل يوم عمل فيه وقت تسجيل الدخول والخروج، ومكان كل تسجيل وطريقته، ودقائق التأخير أو الخروج المبكر، وحالة اليوم — مع أعداد الحالات لكل يوم ومؤشرات الانضباط في المواعيد."},{"name":"Attendance profiles","x-name-ar":"ملفات الحضور","description":"Working-time rules: each profile sets the working hours, days off, day shifts, grace period, correction and permission requests. Every employee is on one profile at a time; this tag also covers the weekly schedule grid and moving employees between profiles from a future date.","x-description-ar":"قواعد وقت العمل: يحدد كل ملف ساعات العمل وأيام الراحة وورديات الأيام وفترة السماح وطلبات التصحيح والاستئذان. يكون كل موظف على ملف واحد في كل وقت؛ ويشمل هذا القسم أيضاً جدول الدوام الأسبوعي ونقل الموظفين بين الملفات ابتداءً من تاريخ قادم."},{"name":"Attendance reports","x-name-ar":"تقارير الحضور","description":"How well people keep their working hours: today's live headcount (present, absent, on leave), attendance rates over time and by department, and per-employee totals of attendance, absence, lateness, overtime and permissions — for the whole company (HR) or for a manager's direct reports.","x-description-ar":"مدى التزام الموظفين بساعات العمل: أعداد اليوم المباشرة (حاضر، غائب، في إجازة)، ونسب الحضور عبر الزمن وحسب القسم، ومجاميع كل موظف من أيام الحضور والغياب والتأخير والعمل الإضافي والاستئذانات — للشركة كلها (الموارد البشرية) أو لمرؤوسي المدير المباشرين."},{"name":"Overtime","x-name-ar":"العمل الإضافي","description":"Hours worked outside the schedule. An employee requests them, their manager and then HR approve, and approved hours are paid in the next payroll run for that date at the company's overtime rate.","x-description-ar":"الساعات التي يعملها الموظف خارج دوامه المجدول. يطلبها الموظف، فيعتمدها مديره ثم الموارد البشرية، وتُصرف الساعات المعتمدة في أول مسير رواتب يغطي تاريخها بمعامل العمل الإضافي المحدد للشركة."},{"name":"Permission requests","x-name-ar":"طلبات الاستئذان","description":"Hourly leave of absence within a working day: an employee asks in advance to arrive late, leave early or step out for a few hours, and their manager and/or HR approve it. An approved permission excuses that time, so the late arrival, early leave or short hours it covers are not deducted from pay. This is not about access rights or roles.","x-description-ar":"الاستئذان هو غياب بالساعات داخل يوم العمل: يطلب الموظف مسبقاً أن يتأخر في الحضور أو ينصرف مبكراً أو يخرج بضع ساعات أثناء الدوام، ويوافق عليه مديره و/أو الموارد البشرية. الاستئذان المقبول يُعفي ذلك الوقت، فلا يُخصم من الراتب التأخير أو الانصراف المبكر أو نقص الساعات الذي يغطيه. لا علاقة له بصلاحيات الدخول أو الأدوار."},{"name":"Public holidays","x-name-ar":"العطل الرسمية","description":"The company's public holidays, per country: the days employees living in that country are not expected at work, which attendance, leave balances and absence deductions all respect.","x-description-ar":"العطل الرسمية للشركة حسب الدولة: الأيام التي لا يُنتظر فيها حضور الموظفين المقيمين في تلك الدولة، ويراعيها الحضور وأرصدة الإجازات وخصومات الغياب."},{"name":"Time incidents","x-name-ar":"مخالفات الوقت","description":"Absences, late arrivals, early leaves and short hours that QHR detects from attendance, and the decision to\ndeduct them from pay or let them go.\n\n**What an incident is.** Every working day QHR compares the employee's attendance with their attendance\nprofile (shift, grace period). A working day with no attendance is an `absence` worth the day's hours; a\ncheck-in after the shift start beyond the grace period is `late`; a check-out before the shift end is\n`early_leave`; on a flexible day, working fewer than the day's hours is `short_hours`; a day missing its\ncheck-in or check-out is `incomplete` (nothing to deduct until the record is corrected). Grace is a\nthreshold, not a discount: 20 minutes late with 15 minutes' grace is a 20-minute incident. Weekends,\npublic holidays, approved leave and approved permissions raise nothing. While undecided, an incident follows\nthe attendance: a correction updates its minutes or removes it.\n\n**Who decides.** The attendance profile's approval route is fixed on the incident when it is created:\n`manager` — the employee's direct manager decides, and that is final; `hr` — HR decides; `manager_and_hr`\n— the manager decides first: \"ignore\" is final, \"deduct\" only recommends and passes the incident to HR, who\nmake the final call. An employee whose manager cannot act (no manager, or a manager without the team\nattendance permission) goes straight to HR. Managers work from `time_incidents.team_list`, HR from\n`time_incidents.list`; both decide with `time_incidents.decide`. Before anyone acts, the employee may attach\na reason with `time_incidents.submit_justification`, which the decider sees.\n\n**What \"deduct\" does.** A decision is final and cannot be reversed. A deducted incident is picked up by the\npayroll run that covers its date: absence minutes go to the employee's timesheet as absence and late, early\nand short minutes as undertime, and the run reduces that month's pay accordingly. An ignored incident costs\nnothing. Once a payroll run covering the date is past time verification, or has paid the incident, it can\nno longer be decided.","x-description-ar":"الغياب والتأخر في الحضور والانصراف المبكر ونقص الساعات التي يكتشفها QHR من الحضور، وقرار خصمها من الراتب أو\nالتجاوز عنها.\n\n**ما المخالفة.** في كل يوم عمل يقارن QHR حضور الموظف بملف الحضور الخاص به (الوردية وفترة السماح). يوم العمل\nالذي لا حضور فيه `absence` (غياب) بقيمة ساعات اليوم؛ والحضور بعد بداية الوردية متجاوزاً فترة السماح `late`\n(تأخر)؛ والانصراف قبل نهاية الوردية `early_leave` (انصراف مبكر)؛ وفي اليوم المرن، العمل أقل من ساعات اليوم\n`short_hours` (نقص ساعات)؛ واليوم الذي ينقصه تسجيل الحضور أو الانصراف `incomplete` (غير مكتمل، ولا شيء\nيُخصم حتى يُصحَّح السجل). فترة السماح حدٌّ وليست خصماً: التأخر ٢٠ دقيقة مع سماح ١٥ دقيقة مخالفة بـ ٢٠ دقيقة.\nلا تنشأ مخالفة في نهاية الأسبوع أو العطل الرسمية أو الإجازات المعتمدة أو الاستئذانات المعتمدة. وما دامت\nالمخالفة دون قرار فهي تتبع الحضور: التصحيح يعدّل دقائقها أو يزيلها.\n\n**من يقرر.** يُثبَّت مسار الاعتماد من ملف الحضور على المخالفة عند إنشائها: `manager` — يقرر المدير المباشر\nوقراره نهائي؛ `hr` — تقرر الموارد البشرية؛ `manager_and_hr` — يقرر المدير أولاً: «التجاوز» نهائي، أما\n«الخصم» فتوصية تنقل المخالفة إلى الموارد البشرية لتتخذ القرار النهائي. الموظف الذي لا يستطيع مديره اتخاذ\nالقرار (لا مدير له، أو مديره بلا صلاحية حضور الفريق) تذهب مخالفاته مباشرة إلى الموارد البشرية. يعمل المدير\nمن `time_incidents.team_list` والموارد البشرية من `time_incidents.list`، ويقرر الاثنان عبر\n`time_incidents.decide`. وقبل أن يتخذ أحد قراراً يمكن للموظف إرفاق سبب عبر\n`time_incidents.submit_justification` يراه صاحب القرار.\n\n**ماذا يعني «الخصم».** القرار نهائي ولا يمكن التراجع عنه. يلتقط المخالفةَ المخصومة مسيرُ الرواتب الذي يغطي\nتاريخها: دقائق الغياب تذهب إلى سجل دوام الموظف غياباً، ودقائق التأخر والانصراف المبكر ونقص الساعات نقصاً\nفي الوقت، فيخفّض المسير راتب ذلك الشهر بقدرها. والمخالفة المتجاوَز عنها لا تكلّف شيئاً. وبعد أن يتجاوز مسير\nرواتب يغطي التاريخ مرحلة التحقق من الوقت، أو يصرف المخالفة، لا يعود ممكناً اتخاذ قرار فيها."},{"name":"All requests (HR)","x-name-ar":"جميع الطلبات (الموارد البشرية)","description":"HR's view over every internal request in the company, whatever its department or status, with the company-wide cards and bulk changes of assignee, priority and due date.","x-description-ar":"نظرة الموارد البشرية على كل الطلبات الداخلية في الشركة أياً كان قسمها أو حالتها، مع بطاقات الإحصاء على مستوى الشركة والتغيير الجماعي للمسؤول والأولوية وتاريخ الاستحقاق."},{"name":"Custody","x-name-ar":"العهد","description":"Company assets in employees' hands — laptops, phones, car keys: who holds what, its value, and handing it over, moving it to someone else, taking it back, and recovering the cost of a damaged or lost asset from the employee's salary.","x-description-ar":"أصول الشركة التي في عهدة الموظفين — الحواسيب والجوالات ومفاتيح السيارات: من يحمل ماذا وما قيمته، وتسليمه ونقله إلى موظف آخر واستلامه، واسترداد قيمة الأصل التالف أو المفقود من راتب الموظف."},{"name":"Custody settings","x-name-ar":"إعدادات العهد","description":"The catalogue HR hands custody from: categories (devices, vehicles, keys…) and the items inside each, with their default value and whether a serial number is required.","x-description-ar":"القائمة التي تُسلَّم منها العهد: الفئات (أجهزة، مركبات، مفاتيح…) والأصناف داخل كل فئة، مع قيمتها الافتراضية وهل يلزمها رقم تسلسلي."},{"name":"Department requests","x-name-ar":"طلبات القسم","description":"The work queue of the caller's own department: approved requests the department handles, plus anything assigned to the caller. Members take open requests, assign them to colleagues and accept what was assigned to them, one by one or several at once.","x-description-ar":"قائمة عمل قسم المستخدم نفسه: الطلبات المعتمدة التي ينفّذها القسم، إضافة إلى كل ما أُسند إلى المستخدم. يستلم أعضاء القسم الطلبات المفتوحة ويسندونها إلى زملائهم ويقبلون ما أُسند إليهم، طلباً طلباً أو عدة طلبات دفعة واحدة."},{"name":"Employee leave policies","x-name-ar":"سياسات إجازات الموظفين","description":"Which employees hold which leave policy, and their balances. Assigning a policy is what gives an employee a leave balance; an employee's own balances and day-by-day balance statement are here too.","x-description-ar":"أي الموظفين يحمل أي سياسة إجازة، وأرصدتهم. تعيين السياسة هو ما يمنح الموظف رصيد إجازة؛ وهنا أيضاً أرصدة الموظف نفسه وكشف رصيده حركةً بحركة."},{"name":"Employee time off","x-name-ar":"إجازات الموظف","description":"HR working on one employee's time off: their leave requests and balances, filing leave on their behalf, correcting a balance by hand, the day-by-day balance statement, which leave policies they hold, and the leave settlement when they leave the company.","x-description-ar":"عمل الموارد البشرية على إجازات موظف بعينه: طلباته وأرصدته، وتقديم إجازة نيابةً عنه، وتصحيح رصيده يدوياً، وكشف حركة الرصيد، وسياسات الإجازة المسندة إليه، وتسوية الإجازات عند مغادرته الشركة."},{"name":"HR leave overview","x-name-ar":"نظرة الموارد البشرية على الإجازات","description":"The company-wide view of leave for HR: the headline counts, every leave request waiting on a decision, each employee's balances and who is off today, and the export of the request list.","x-description-ar":"نظرة الموارد البشرية إلى الإجازات على مستوى الشركة: الأرقام الرئيسية، وكل طلبات الإجازة التي تنتظر قراراً، وأرصدة كل موظف ومن هو في إجازة اليوم، وتصدير قائمة الطلبات."},{"name":"Leave categories","x-name-ar":"فئات الإجازات","description":"The kinds of leave the company recognises (annual, sick, maternity…). Every leave policy belongs to one category, an employee holds at most one policy per category, and a category decides whether unused days may be carried over into the next year.","x-description-ar":"أنواع الإجازات التي تعتمدها الشركة (سنوية، مرضية، أمومة…). تنتمي كل سياسة إجازة إلى فئة واحدة، ولا يحمل الموظف أكثر من سياسة واحدة في الفئة نفسها، والفئة هي التي تحدد إن كان يجوز ترحيل الأيام غير المستخدمة إلى السنة التالية."},{"name":"Leave policies","x-name-ar":"سياسات الإجازات","description":"The rules for one kind of leave: how many days an employee is entitled to, how and when the days are granted (accrual), how much is carried into the next year, how the leave is paid and who approves it.","x-description-ar":"قواعد نوع واحد من الإجازات: عدد الأيام المستحقة للموظف، وكيف ومتى تُمنح الأيام (الاستحقاق)، وكم يُرحَّل منها إلى السنة التالية، وكيف تُدفع الإجازة ومن يعتمدها."},{"name":"Leave requests","x-name-ar":"طلبات الإجازة","description":"Requesting time off and deciding on it: an employee's own leave requests with their balance check, edits and cancellations, and the manager and HR approval steps that follow.","x-description-ar":"طلب الإجازات والبتّ فيها: طلبات إجازة الموظف نفسه مع التحقق من رصيده وتعديلها وإلغائها، ثم مراحل موافقة المدير والموارد البشرية التي تليها."},{"name":"Leave settings","x-name-ar":"إعدادات الإجازات","description":"Company-wide leave settings: whether approvers are reminded by email of leave requests still waiting for them, after how many days, and how often.","x-description-ar":"إعدادات الإجازات على مستوى الشركة: هل يُذكَّر المعتمدون بالبريد بطلبات الإجازة التي ما زالت تنتظرهم، وبعد كم يوماً، وبأي تكرار."},{"name":"My custody","x-name-ar":"عهدتي","description":"The token owner's own custody: the assets they hold now, the ones they held before, and what they still owe for a damaged or lost one. Read only.","x-description-ar":"عهدة صاحب الرمز نفسه: الأصول التي يحملها الآن والتي حملها سابقاً، وما بقي عليه سداده عن أصل تالف أو مفقود. للقراءة فقط."},{"name":"Request approvals","x-name-ar":"موافقات الطلبات","description":"Requests waiting on the caller's decision: the manager stage for their direct reports and, for HR, the HR stage — one by one or several at a time.","x-description-ar":"الطلبات التي تنتظر قرار صاحب الرمز: مرحلة المدير لمرؤوسيه المباشرين، ومرحلة الموارد البشرية لمن يملك صلاحيتها — واحداً تلو الآخر أو عدة طلبات دفعة واحدة."},{"name":"Request catalog","x-name-ar":"دليل الطلبات","description":"What an employee can ask for: the enabled request categories and, in each, the request types with the form to fill in, who approves and which department does the work. Read it before submitting a request.","x-description-ar":"ما يستطيع الموظف طلبه: فئات الطلبات المفعّلة، وفي كل فئة أنواع الطلبات مع النموذج المطلوب تعبئته ومن يعتمد الطلب والقسم الذي ينفّذه. اطّلع عليه قبل تقديم أي طلب."},{"name":"Request settings","x-name-ar":"إعدادات الطلبات","description":"HR's set-up of internal requests: the categories shown in the catalog and the request types inside them. A request type decides the form employees fill in, the approval stages (direct manager, HR, both or none), the department that handles the work, the default priority and the target number of days.","x-description-ar":"إعداد الموارد البشرية للطلبات الداخلية: الفئات التي تظهر في دليل الطلبات وأنواع الطلبات داخلها. يحدد نوع الطلب النموذج الذي يعبئه الموظف، ومراحل الاعتماد (المدير المباشر أو الموارد البشرية أو كلاهما أو بلا اعتماد)، والقسم الذي ينفّذ العمل، والأولوية الافتراضية، وعدد الأيام المستهدف للإنجاز."},{"name":"Requests","x-name-ar":"الطلبات","description":"Requests employees raise to an internal department (a laptop from IT, a salary certificate from HR…): submitting one, following it, approving it as the direct manager or HR, and the department's work on it — take, assign, send for review, close — with its conversation and activity log.","x-description-ar":"الطلبات التي يرفعها الموظفون إلى قسم داخلي (جهاز محمول من تقنية المعلومات، تعريف راتب من الموارد البشرية…): تقديم الطلب ومتابعته، والموافقة عليه بصفتك المدير المباشر أو الموارد البشرية، وعمل القسم عليه — الاستلام والإسناد والإرسال للمراجعة والإغلاق — مع المحادثة وسجل النشاط."},{"name":"Support","x-name-ar":"الدعم الفني","description":"Conversations between the token owner and the QHR support team: raising a problem, question or feature request, reading support's replies, replying, and closing it.","x-description-ar":"المحادثات بين صاحب الرمز وفريق دعم QHR: رفع مشكلة أو سؤال أو اقتراح ميزة، وقراءة ردود الدعم، والرد عليها، وإغلاق الطلب."},{"name":"Team leaves","x-name-ar":"إجازات الفريق","description":"A manager's view of their team's leave: who is away and when, the requests waiting for a decision, and filing leave on behalf of a direct report.","x-description-ar":"نظرة المدير إلى إجازات فريقه: من الغائب ومتى، والطلبات التي تنتظر قراراً، وتقديم إجازة نيابةً عن أحد مرؤوسيه المباشرين."},{"name":"Accounting connection","x-name-ar":"الربط المحاسبي","description":"The company's link to Qoyod accounting, read-only: whether it is connected and to which Qoyod company, whether Qoyod has an account for every cost the payroll uses, what each finalised payroll run became in Qoyod (journal entry, held, failed), and which employees Qoyod knows. Connecting, settings and re-sending stay in the QHR web app.","x-description-ar":"ربط الشركة بمحاسبة قيود، للقراءة فقط: هل الشركة مربوطة وبأي شركة في قيود، وهل لكل تكلفة في الرواتب حساب في قيود، وما الذي آل إليه كل مسيّر معتمد في قيود (قيد يومية، معلّق، فاشل)، وأي الموظفين تعرفهم قيود. أما الربط والإعدادات وإعادة الإرسال فتبقى في تطبيق QHR."},{"name":"Bonuses","x-name-ar":"المكافآت","description":"One-off amounts paid to an employee on top of their salary — a reward, a commission or a grant. HR adds them (or a manager proposes one for a direct report), HR approves them, and the next payroll run pays them as a line on the payslip.","x-description-ar":"مبالغ لمرة واحدة تُصرف للموظف فوق راتبه — مكافأة أو عمولة أو منحة. تضيفها الموارد البشرية (أو يقترحها المدير لأحد مرؤوسيه المباشرين)، وتعتمدها الموارد البشرية، فيصرفها مسيّر الرواتب التالي بنداً في قسيمة الراتب."},{"name":"Deductions","x-name-ar":"الاستقطاعات","description":"One-off amounts taken from an employee's pay — a penalty for a policy violation, a repayment or a reimbursement owed. HR adds them (or a manager proposes one for a direct report), HR approves them, and the next payroll run deducts them on the payslip.","x-description-ar":"مبالغ لمرة واحدة تُستقطع من راتب الموظف — جزاء مخالفة أو سداد أو مبلغ مستحق الاسترداد. تضيفها الموارد البشرية (أو يقترحها المدير لأحد مرؤوسيه المباشرين)، وتعتمدها الموارد البشرية، فيستقطعها مسيّر الرواتب التالي في قسيمة الراتب."},{"name":"End of service","x-name-ar":"نهاية الخدمة","description":"What an employee is owed when they leave: the end-of-service award under the Saudi labour law, unused leave paid out, the final salary and pending bonuses, minus outstanding loans, deductions and custody. A package is calculated, saved as a draft, then confirmed — which settles the loans, starts the offboarding and records the payout.","x-description-ar":"ما يستحقه الموظف عند مغادرته: مكافأة نهاية الخدمة وفق نظام العمل السعودي، وبدل الإجازات غير المستخدمة، والراتب الأخير والمكافآت المعلّقة، مخصوماً منها السلف والاستقطاعات والعهد القائمة. تُحسب التسوية وتُحفظ مسودة ثم تُعتمد — فتُسوّى السلف ويبدأ إنهاء الخدمة ويُسجَّل الصرف."},{"name":"Exports","x-name-ar":"التصدير","description":"The files the token's owner exported from QHR lists (employees, payslips, loans…) to Excel or CSV: their progress while a large export is built in the background, and how long the file is kept (7 days).","x-description-ar":"الملفات التي صدّرها صاحب الرمز من قوائم QHR (الموظفون، القسائم، السلف…) إلى Excel أو CSV: تقدّم التصدير الكبير أثناء إعداده في الخلفية، ومدة الاحتفاظ بالملف (٧ أيام)."},{"name":"GOSI","x-name-ar":"التأمينات الاجتماعية","description":"Live checks against GOSI (the Saudi General Organization for Social Insurance) through Masdr: the establishment's wage-protection compliance and head-count breakdown, a person's contributor record, and whether an employee's employment, registered wage and IBAN match what GOSI and the banks hold. Also the company's GOSI connection (its unified number).","x-description-ar":"فحوصات مباشرة لدى المؤسسة العامة للتأمينات الاجتماعية عبر منصة مصدر: التزام المنشأة بحماية الأجور وتوزيع موظفيها، وسجل المشترك لأي هوية، ومطابقة علاقة العمل والأجر المسجل والآيبان لدى التأمينات والبنوك. ويشمل كذلك ربط الشركة بالتأمينات (الرقم الموحد للمنشأة)."},{"name":"Insurance","x-name-ar":"التأمين","description":"The company's insurance plans — social insurance (GOSI), medical and others — with the percentage the employee pays from their salary and the percentage the company pays on top. Employees are enrolled in a plan on their salary (`salaries.enrol_insurance`).","x-description-ar":"خطط التأمين في الشركة — التأمينات الاجتماعية والطبي وغيرها — مع النسبة التي يدفعها الموظف من راتبه والنسبة التي تدفعها الشركة فوقه. يُشترك الموظف في الخطة على راتبه (`salaries.enrol_insurance`)."},{"name":"Loans","x-name-ar":"السلف","description":"Salary advances and loans: an employee's own requests, a manager's requests for their team, and HR's queue, where a loan is approved through payroll (paid out on a payslip, repaid in monthly installments) or directly (paid and repaid outside payroll), settled when the employee pays it back, and sent to Qoyod accounting.","x-description-ar":"السلف والقروض: طلبات الموظف لنفسه، وطلبات المدير لفريقه، وقائمة الموارد البشرية حيث تُعتمد السلفة عبر الرواتب (تُصرف في القسيمة وتُسدَّد بأقساط شهرية) أو مباشرةً (تُصرف وتُسدَّد خارج الرواتب)، وتُسوّى عندما يسددها الموظف، وتُرسل إلى محاسبة قيود."},{"name":"Locations","x-name-ar":"مواقع العمل","description":"The company's work sites: their names, whether they are active, the geo-fence (a map pin and radius, or allowed office networks) that attendance check-ins are held to, and how many employees are assigned to each as their main or an additional location.","x-description-ar":"مواقع العمل في الشركة: أسماؤها وهل هي نشطة، والسياج الجغرافي (نقطة على الخريطة ونطاق، أو شبكات المكتب المسموحة) الذي يُقيَّد به تسجيل الحضور، وعدد الموظفين المعيّنين على كل موقع كموقع رئيسي أو إضافي."},{"name":"Payments","x-name-ar":"المدفوعات","description":"Money actually transferred to an employee (`paid`) or received back from them (`received`), and how each payment is allocated against what it settles: payslips, bonuses and deductions. Allocating a payment is what marks a payslip paid and, through it, a loan installment repaid.","x-description-ar":"الأموال المحوّلة فعلاً إلى الموظف (`paid`) أو المستلمة منه (`received`)، وكيف يُخصَّص كل مبلغ لما يسدده: القسائم والمكافآت والاستقطاعات. تخصيص الدفعة هو ما يجعل القسيمة مصروفة، ومن خلالها يُعدّ قسط السلفة مسدداً."},{"name":"Payroll runs","x-name-ar":"مسيّرات الرواتب","description":"Paying the company's people for a period. A run picks its employees, takes their time (timesheets), calculates every payslip, moves through verification to finalised — or, for companies whose Qoyod accounting approves payroll, waits for that approval — and is then paid and posted to accounting.","x-description-ar":"صرف رواتب موظفي الشركة عن فترة محددة. يختار المسيّر موظفيه ويأخذ أوقاتهم (سجلات الوقت) ويحتسب كل قسيمة، ثم يمر بخطوات المراجعة حتى الاعتماد النهائي — أو ينتظر موافقة محاسبة قيود للشركات التي تعتمد فيها المحاسبةُ الرواتب — ثم يُصرف ويُرحَّل إلى المحاسبة."},{"name":"Payroll settings","x-name-ar":"إعدادات الرواتب","description":"Company-wide payroll rules: how overtime, lateness and undertime are priced, and which day salaries are paid.","x-description-ar":"قواعد الرواتب على مستوى الشركة: كيف يُسعَّر العمل الإضافي والتأخير والنقص في الساعات، وفي أي يوم تُصرف الرواتب."},{"name":"Payslips","x-name-ar":"قسائم الرواتب","description":"What each employee earned and had deducted in a payroll run: the payslip's totals, its lines (salary, allowances, overtime, bonuses, deductions, loan installments, insurance), its payment status and its PDF. Employees read their own issued payslips here too.","x-description-ar":"ما استحقه كل موظف وما استُقطع منه في مسيّر الرواتب: إجماليات القسيمة وبنودها (الراتب والبدلات والعمل الإضافي والمكافآت والاستقطاعات وأقساط السلف والتأمينات) وحالة صرفها وملفها بصيغة PDF. ويقرأ الموظفون هنا أيضاً قسائمهم الصادرة."},{"name":"Salaries","x-name-ar":"الرواتب","description":"What each employee is contracted to earn: the basic salary, its allowances (housing, transport…) and fixed deductions, the social-insurance enrolments payroll deducts, and the history of earlier salaries. Payroll runs read the active salary.","x-description-ar":"ما يستحقه كل موظف بموجب عقده: الراتب الأساسي وبدلاته (السكن، النقل…) واستقطاعاته الثابتة، واشتراكات التأمينات الاجتماعية التي يستقطعها المسيّر، وسجل الرواتب السابقة. تعتمد مسيّرات الرواتب على الراتب النشط."}],"x-tagGroups":[{"name":"Getting started","x-name-ar":"البداية","tags":["Token"]},{"name":"People \u0026 organisation","x-name-ar":"الموظفون والمنظمة","tags":["Audit log","Dashboard","Departments","Documents","Employee imports \u0026 bulk updates","Employee invitations","Employees","Notifications","Roles \u0026 permissions","Users"]},{"name":"Time \u0026 attendance","x-name-ar":"الوقت والحضور","tags":["Attendance","Attendance calendar","Attendance device support","Attendance devices","Attendance log","Attendance profiles","Attendance reports","Overtime","Permission requests","Public holidays","Time incidents"]},{"name":"Leave \u0026 requests","x-name-ar":"الإجازات والطلبات","tags":["All requests (HR)","Custody","Custody settings","Department requests","Employee leave policies","Employee time off","HR leave overview","Leave categories","Leave policies","Leave requests","Leave settings","My custody","Request approvals","Request catalog","Request settings","Requests","Support","Team leaves"]},{"name":"Payroll \u0026 finance","x-name-ar":"الرواتب والمالية","tags":["Accounting connection","Bonuses","Deductions","End of service","Exports","GOSI","Insurance","Loans","Locations","Payments","Payroll runs","Payroll settings","Payslips","Salaries"]}],"x-global-responses":{"402":{"description":"The feature isn't available for the company.","x-description-ar":"الميزة غير متاحة للشركة.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature isn't available for your company.","x-meaning-ar":"هذه الميزة غير متاحة لشركتك.","x-fix":"Contact your QHR account manager.","x-fix-ar":"تواصل مع مدير حسابك في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API isn't available for your company.","code":"entitlement_blocked","reason":"not_in_plan","feature":"open_api","module":"core"}}}},"412":{"description":"The feature is switched off for the company.","x-description-ar":"الميزة معطّلة للشركة.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature is switched off for your company (`reason: not_enabled`).","x-meaning-ar":"هذه الميزة معطّلة لشركتك (`reason: not_enabled`).","x-fix":"Ask your company's QHR administrator to switch it on.","x-fix-ar":"اطلب من مسؤول QHR في شركتك تفعيلها."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API is switched off for your company.","code":"entitlement_blocked","reason":"not_enabled","feature":"open_api","module":"core"}}}},"425":{"description":"The feature hasn't been launched yet.","x-description-ar":"الميزة لم تُطلق بعد.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature hasn't been launched yet (`reason: not_released`).","x-meaning-ar":"هذه الميزة لم تُطلق بعد (`reason: not_released`).","x-fix":"Wait for the launch; nothing to change on your side.","x-fix-ar":"انتظر الإطلاق؛ لا يلزمك أي تغيير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API is on its way.","code":"entitlement_blocked","reason":"not_released","feature":"open_api","module":"core"}}}},"429":{"description":"Too many requests.","x-description-ar":"طلبات كثيرة جداً.","x-codes":[{"code":"rate_limited","meaning":"Too many requests from this token or address.","x-meaning-ar":"طلبات كثيرة من هذا الرمز أو العنوان.","x-fix":"Wait the number of seconds in the `Retry-After` header, then retry.","x-fix-ar":"انتظر عدد الثواني الموجود في ترويسة `Retry-After` ثم أعد المحاولة."}],"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Too many requests. Wait a moment and try again.","code":"rate_limited"}}}},"500":{"description":"Unexpected error.","x-description-ar":"خطأ غير متوقع.","x-codes":[{"code":"internal_error","meaning":"Something went wrong on QHR's side.","x-meaning-ar":"حدث خطأ من جهة QHR.","x-fix":"Retry later. If it keeps happening, contact QHR support with the time of the request.","x-fix-ar":"أعد المحاولة لاحقاً. وإن تكرر فتواصل مع دعم QHR وأرسل وقت الطلب."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Something went wrong on our side. Try again later.","code":"internal_error"}}}}},"paths":{"/accounting_connection":{"get":{"summary":"Get the Qoyod accounting connection","operationId":"accounting_connection.show","tags":["Accounting connection"],"description":"Returns whether the company is connected to Qoyod accounting, to which Qoyod company, who connected it and\nwhen, whether sync is on, the settings (cost-centre dimension, payer), and — when connected — whether\nQoyod has an account for every cost the recent payroll runs used. When not connected, the previous\nconnection is described if there was one.\n\n**When to use:** \"are we connected to Qoyod?\", \"is sync on?\", or before reading the other accounting\noperations.\n\n**Prerequisites:** none.\n\n**Side effects:** none. When connected QHR asks Qoyod for the readiness; if Qoyod does not answer the page\nstill loads, with `readiness.error: provider_unreachable`.","x-summary-ar":"عرض الربط مع محاسبة قيود","x-description-ar":"يعرض هل الشركة مربوطة بمحاسبة قيود وبأي شركة فيها، ومن أجرى الربط ومتى، وهل المزامنة مفعّلة، والإعدادات (بُعد\nمركز التكلفة، الجهة الدافعة)، وعند الربط هل لكل تكلفة في المسيّرات الأخيرة حساب في قيود. وعند عدم الربط يصف\nالربط السابق إن وُجد.\n\n**متى تستخدمه:** «هل نحن مربوطون بقيود؟»، «هل المزامنة مفعّلة؟»، أو قبل قراءة عمليات المحاسبة الأخرى.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. عند الربط يسأل QHR قيود عن الجاهزية؛ وإن لم تُجب تُعرض الصفحة مع\n`readiness.error: provider_unreachable`.","x-access":"read","x-permission":{"key":"accounting/view","label":"View the accounting integration and what was sent to it","x-label-ar":"عرض تكامل المحاسبة وما تم إرساله إليه"},"x-feature":"accounting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The connection.","x-description-ar":"الربط.","content":{"application/json":{"example":{"accounting_connection":{"settings":{"cost_centre_dimension":"department","payer":"qhr","replay_history":false},"sync_enabled":true,"provider_available":true,"status":"connected","provider":"qoyod","connected_company":{"id":"qyd_0001","name":"Acme Trading Co.","base_currency":"SAR"},"connected_by":{"id":51,"name":"Omar Ali","email":"omar@acme.example"},"connected_at":"2026-09-01T07:00:00Z","capabilities":{"cost_centre_match":"by_name"},"sync_note":null,"readiness":{"ready":false,"runs_checked":["PYR-0042","PYR-0041","PYR-0040"],"cost_types_used":9,"unmapped_cost_types":[{"code":"allowance_housing","name":"Housing allowance","last_used_in":"PYR-0042","amount_last_run":"48000.00"}],"mapping_version":"7","checked_at":"2026-11-27T08:00:00Z","links":{"mapping_page":"https://app.qoyod.com/settings/integrations/qhr?company=qyd_0001"}},"links":{"mapping_page":"https://app.qoyod.com/settings/integrations/qhr?company=qyd_0001"}}},"schema":{"$ref":"#/components/schemas/accounting_connection"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/accounting_connection/employees":{"get":{"summary":"List employees and whether Qoyod has them","operationId":"accounting_connection.employees","tags":["Accounting connection"],"description":"Returns every employee, by employee number, with the fields QHR sends Qoyod (number, names, join date,\nemployment status) and their sync state: `synced`, `pending`, `failed` (with Qoyod's reason) or\n`never_synced`. `summary` counts each state across the whole company, not the page.\n\n**When to use:** \"why was this person's settlement held?\", \"who is missing from Qoyod?\" (`state=failed` or\n`never_synced`).\n\n**Prerequisites:** none. `q` searches the employee number and names.\n\n**Side effects:** none. Up to 50 per page. Re-syncing stays in the web app.","x-summary-ar":"عرض الموظفين وهل هم موجودون في قيود","x-description-ar":"يعرض كل الموظفين حسب الرقم الوظيفي مع الحقول التي يرسلها QHR إلى قيود (الرقم والاسمين وتاريخ الالتحاق وحالة\nالتوظيف) وحالة مزامنتهم: `synced` متزامن، `pending` بالانتظار، `failed` فشل (مع سبب قيود)، `never_synced` لم\nيُزامن قط. ويعدّ `summary` كل حالة على مستوى الشركة كلها لا الصفحة.\n\n**متى تستخدمه:** «لماذا عُلّقت تسوية هذا الموظف؟»، «من غير الموجود في قيود؟» (`state=failed` أو `never_synced`).\n\n**المتطلبات:** لا شيء. يبحث `q` في الرقم الوظيفي والأسماء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة. إعادة المزامنة تبقى في تطبيق الويب.","x-access":"read","x-permission":{"key":"accounting/view","label":"View the accounting integration and what was sent to it","x-label-ar":"عرض تكامل المحاسبة وما تم إرساله إليه"},"x-feature":"accounting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"state","in":"query","required":false,"schema":{"type":"string","enum":["all","synced","failed","pending","never_synced"]},"description":"Only this sync state; `all` by default.","x-description-ar":"حالة المزامنة هذه فقط؛ و`all` افتراضياً.","example":"failed"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number or name contains.","x-description-ar":"الرقم الوظيفي أو الاسم يحتوي على.","example":"Sara"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of employees with their sync state.","x-description-ar":"صفحة من الموظفين مع حالة مزامنتهم.","content":{"application/json":{"example":{"summary":{"synced":40,"pending":0,"failed":1,"never_synced":1},"sync_enabled":true,"connection_status":"connected","records":[{"employee_id":1203,"employee_no":"E-0042","name_en":"Sara Ahmed","name_ar":"سارة أحمد","join_date":"2024-03-01","status":"active","sync":{"state":"failed","synced_at":null,"reason_code":"duplicate_employee_no","reason":"Another employee in Qoyod has this number."}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"The employees.","x-description-ar":"الموظفون.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية.","nullable":true},"join_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","nullable":true},"status":{"type":"string","description":"Employment status as sent to Qoyod.","x-description-ar":"حالة التوظيف كما تُرسل إلى قيود."},"sync":{"type":"object","description":"`state`, `synced_at`, `reason_code`, `reason`.","x-description-ar":"`state` و`synced_at` و`reason_code` و`reason`."}}}},"pagination":{"$ref":"#/components/schemas/pagination"},"summary":{"type":"object","description":"Count per sync state, whole company.","x-description-ar":"العدد لكل حالة، للشركة كلها.","properties":{"synced":{"type":"integer","description":"Synced.","x-description-ar":"متزامن."},"pending":{"type":"integer","description":"Pending.","x-description-ar":"بالانتظار."},"failed":{"type":"integer","description":"Failed.","x-description-ar":"فشل."},"never_synced":{"type":"integer","description":"Never synced.","x-description-ar":"لم يُزامن قط."}}},"sync_enabled":{"type":"boolean","description":"True when sync is on.","x-description-ar":"صحيح إذا كانت المزامنة مفعّلة."},"connection_status":{"type":"string","description":"Connection status.","x-description-ar":"حالة الربط."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/accounting_connection/posting_by_run":{"get":{"summary":"List each finalised payroll run and its Qoyod posting","operationId":"accounting_connection.posting_by_run","tags":["Accounting connection"],"description":"Returns every payroll run finalised in the range, newest first, with its totals (gross, deductions, net,\nand by cost type when sent) and what it became in Qoyod: `posted` with the journal entry, `held`, `failed`,\n`reversed`… or `not_sent` with the reason (not connected, finalised before the connection, sync off).\nTotals come from what Qoyod received when the run was sent.\n\n**When to use:** month-end and audit: \"which runs are in the books, and under which journal entries?\".\n\n**Prerequisites:** none. `period=YYYY-MM` for one month, or `from`/`to` (`YYYY-MM`); this calendar year to\ndate by default.\n\n**Side effects:** none.","x-summary-ar":"عرض كل مسيّر معتمد وترحيله في قيود","x-description-ar":"يعرض كل مسيّر اعتُمد في المدى، الأحدث أولاً، مع إجمالياته (الإجمالي والاستقطاعات والصافي، وحسب نوع التكلفة عند\nإرساله) وما آل إليه في قيود: `posted` مع قيد اليومية، أو `held` أو `failed` أو `reversed`… أو `not_sent` مع\nالسبب (غير مربوط، اعتُمد قبل الربط، المزامنة متوقفة). تؤخذ الإجماليات مما استلمته قيود عند الإرسال.\n\n**متى تستخدمه:** لإقفال الشهر والتدقيق: «أي المسيّرات في الدفاتر وبأي قيود يومية؟».\n\n**المتطلبات:** لا شيء. `period=YYYY-MM` لشهر واحد، أو `from`/`to` (`YYYY-MM`)؛ والافتراضي من بداية السنة\nالحالية حتى الآن.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"accounting/view","label":"View the accounting integration and what was sent to it","x-label-ar":"عرض تكامل المحاسبة وما تم إرساله إليه"},"x-feature":"accounting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"period","in":"query","required":false,"schema":{"type":"string"},"description":"One month, `YYYY-MM`.","x-description-ar":"شهر واحد بالشكل `YYYY-MM`.","example":"2026-09"},{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"First month, `YYYY-MM`.","x-description-ar":"الشهر الأول بالشكل `YYYY-MM`.","example":"2026-01"},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"Last month, `YYYY-MM`.","x-description-ar":"الشهر الأخير بالشكل `YYYY-MM`.","example":"2026-09"}],"responses":{"200":{"description":"The runs and their postings.","x-description-ar":"المسيّرات وترحيلها.","content":{"application/json":{"example":{"period":"2026-09","from":"2026-09","to":"2026-09","runs":[{"reference":"PYR-0042","period":"2026-09","from":"2026-09-01","to":"2026-09-30","finalized_at":"2026-09-28T10:15:00Z","net":"401310.00","totals":{"SAR":{"gross":"441000.00","deductions":"39690.00","net":"401310.00"}},"totals_by_cost_type":{"basic_salary":"378000.00"},"history":["JE-1042 posted"],"state":"posted","event_id":"7d1c2f0e-4b7a-4a51-9a51-2f0f6f3b9b21","posting_id":"post_88a1","journal_entry":"JE-1042","reversal_entry":null,"reason_code":null}],"payments":[],"off_cycle":[]},"schema":{"type":"object","properties":{"period":{"type":"string","description":"The month, when the range is one month.","x-description-ar":"الشهر إذا كان المدى شهراً واحداً.","nullable":true},"from":{"type":"string","description":"First month.","x-description-ar":"الشهر الأول."},"to":{"type":"string","description":"Last month.","x-description-ar":"الشهر الأخير."},"runs":{"type":"array","description":"One entry per finalised run.","x-description-ar":"مدخل لكل مسيّر معتمد.","items":{"type":"object","properties":{"reference":{"type":"string","description":"Run reference.","x-description-ar":"مرجع المسيّر."},"period":{"type":"string","description":"Month, `YYYY-MM`.","x-description-ar":"الشهر بالشكل `YYYY-MM`."},"finalized_at":{"type":"string","description":"When it was finalised, UTC.","x-description-ar":"وقت الاعتماد بتوقيت UTC."},"net":{"type":"string","description":"Net pay, decimal string.","x-description-ar":"صافي الرواتب، نص عشري.","nullable":true},"totals":{"type":"object","description":"Gross, deductions and net per currency.","x-description-ar":"الإجمالي والاستقطاعات والصافي لكل عملة."},"state":{"type":"string","description":"`posted`, `held`, `failed`, `reversed`, `not_sent`…","x-description-ar":"`posted` أو `held` أو `failed` أو `reversed` أو `not_sent`…"},"reason":{"type":"string","description":"Why it was not sent (`not_sent` only).","x-description-ar":"سبب عدم الإرسال (مع `not_sent` فقط)."},"journal_entry":{"type":"string","description":"Qoyod journal entry reference.","x-description-ar":"مرجع قيد اليومية في قيود.","nullable":true},"history":{"type":"array","description":"What happened to it, in order.","x-description-ar":"ما جرى عليه بالترتيب.","items":{"type":"string"}}}}},"payments":{"type":"array","description":"Reserved; empty for now.","x-description-ar":"محجوز؛ فارغ حالياً.","items":{"type":"object"}},"off_cycle":{"type":"array","description":"Reserved; empty for now.","x-description-ar":"محجوز؛ فارغ حالياً.","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"`period`, `from` or `to` is not a month in `YYYY-MM` form.","x-meaning-ar":"`period` أو `from` أو `to` ليس شهراً بالشكل `YYYY-MM`.","x-fix":"Send months as `YYYY-MM`, e.g. `2026-09`.","x-fix-ar":"أرسل الأشهر بالشكل `YYYY-MM`، مثل `2026-09`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A valid period is required.","code":"validation_failed"}}}}}}},"/accounting_connection/readiness":{"get":{"summary":"Check Qoyod has an account for every payroll cost","operationId":"accounting_connection.readiness","tags":["Accounting connection"],"description":"Asks Qoyod whether it has an account for every cost type the last `runs` finalised payroll runs used (plus\nnet salaries payable and end-of-service), and lists the missing ones with the amount at stake in the\nnewest run. Anything missing would be held in Qoyod instead of posted.\n\n**When to use:** before switching sync on, or when runs show as `held` in `accounting_connection.sync_status`.\n\n**Prerequisites:** a live connection (`accounting_connection.show`, `status` other than `not_connected`).\n\n**Side effects:** none. Calls Qoyod live.","x-summary-ar":"التحقق من وجود حساب في قيود لكل تكلفة رواتب","x-description-ar":"يسأل قيود هل لديها حساب لكل نوع تكلفة استُخدم في آخر `runs` مسيّرات معتمدة (إضافة إلى الرواتب المستحقة الصافية\nونهاية الخدمة)، ويذكر الناقصة مع مبلغها في أحدث مسيّر. أي نوع ناقص سيُعلَّق في قيود بدل أن يُرحَّل.\n\n**متى تستخدمه:** قبل تفعيل المزامنة، أو عندما تظهر مسيّرات بحالة `held` في `accounting_connection.sync_status`.\n\n**المتطلبات:** ربط قائم (`accounting_connection.show`، و`status` غير `not_connected`).\n\n**الآثار الجانبية:** لا شيء. يستدعي قيود مباشرة.","x-access":"read","x-permission":{"key":"accounting/view","label":"View the accounting integration and what was sent to it","x-label-ar":"عرض تكامل المحاسبة وما تم إرساله إليه"},"x-feature":"accounting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"runs","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":12},"description":"How many recent finalised runs to check, 1–12 (3 by default).","x-description-ar":"عدد المسيّرات المعتمدة الأخيرة المراد فحصها، ١–١٢ (٣ افتراضياً).","example":3}],"responses":{"200":{"description":"The readiness.","x-description-ar":"الجاهزية.","content":{"application/json":{"example":{"ready":false,"runs_checked":["PYR-0042","PYR-0041","PYR-0040"],"cost_types_used":9,"unmapped_cost_types":[{"code":"allowance_housing","name":"Housing allowance","last_used_in":"PYR-0042","amount_last_run":"48000.00"}],"mapping_version":"7","checked_at":"2026-11-27T08:00:00Z","links":{"mapping_page":"https://app.qoyod.com/settings/integrations/qhr?company=qyd_0001"}},"schema":{"$ref":"#/components/schemas/accounting_readiness"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"Readiness cannot be checked.","x-description-ar":"تعذّر فحص الجاهزية.","x-codes":[{"code":"not_connected","meaning":"No accounting system is connected, so there is no Qoyod to ask.","x-meaning-ar":"لا يوجد نظام محاسبي مربوط، فلا توجد قيود لسؤالها.","x-fix":"Connect Qoyod in QHR › Settings › Accounting connection first.","x-fix-ar":"اربط قيود أولاً من QHR › الإعدادات › الربط المحاسبي."},{"code":"provider_unreachable","meaning":"Qoyod did not answer. Nothing was changed.","x-meaning-ar":"لم تُجب قيود. لم يتغير شيء.","x-fix":"Try again in a moment.","x-fix-ar":"أعد المحاولة بعد قليل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Qoyod did not answer. Nothing was changed — please try again in a moment.","code":"provider_unreachable","error_code":"provider_unreachable"}}}}}}},"/accounting_connection/sync_status":{"get":{"summary":"List what QHR sent to Qoyod and what became of it","operationId":"accounting_connection.sync_status","tags":["Accounting connection"],"description":"Returns everything QHR sent or will send to Qoyod — finalised payroll runs, settlements, employee syncs —\nnewest first, each with its state (posted with its journal entry, held for a missing account, waiting for a\ndecision on a closed period, failed…), its amount and the action that fixes it in the web app. Rows are\nnever deleted: a posted row is the receipt. `summary` counts every state for the period.\n\n**When to use:** \"did September's payroll reach Qoyod?\", \"what is stuck?\" (`state=problems`).\n\n**Prerequisites:** none. Works when not connected (an empty list unless the company was connected before).\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض ما أرسله QHR إلى قيود وما آل إليه","x-description-ar":"يعرض كل ما أرسله QHR أو سيرسله إلى قيود — المسيّرات المعتمدة والتسويات ومزامنة الموظفين — الأحدث أولاً، مع\nحالة كل عنصر (رُحّل مع قيد اليومية، معلّق لنقص حساب، بانتظار قرار لفترة مغلقة، فشل…) ومبلغه والإجراء الذي\nيصلحه في تطبيق الويب. لا تُحذف الصفوف أبداً: الصف المرحّل هو الإيصال. ويعدّ `summary` كل حالة في الفترة.\n\n**متى تستخدمه:** «هل وصلت رواتب سبتمبر إلى قيود؟»، «ما العالق؟» (`state=problems`).\n\n**المتطلبات:** لا شيء. يعمل دون ربط (قائمة فارغة ما لم تكن الشركة مربوطة سابقاً).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"accounting/view","label":"View the accounting integration and what was sent to it","x-label-ar":"عرض تكامل المحاسبة وما تم إرساله إليه"},"x-feature":"accounting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"state","in":"query","required":false,"schema":{"type":"string","enum":["all","problems","posted"]},"description":"`problems` (held, waiting for a decision, failed, rejected…) or `posted`; `all` by default.","x-description-ar":"`problems` المعلّقة والمنتظرة والفاشلة والمرفوضة…، أو `posted` المرحّلة؛ و`all` افتراضياً.","example":"problems"},{"name":"period","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}$"},"description":"Only this month, `YYYY-MM`.","x-description-ar":"هذا الشهر فقط، بالشكل `YYYY-MM`.","example":"2026-09"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of sync items.","x-description-ar":"صفحة من عناصر المزامنة.","content":{"application/json":{"example":{"summary":{"posted":1,"held":0,"needs_decision":0,"retrying":0,"sending":0,"failed":0,"queued":0,"reversed":0},"sync_enabled":true,"connection_status":"connected","records":[{"event_type":"payroll.finalized","reference":"PYR-0042","state":"posted","occurred_at":"2026-09-30T12:00:00Z","title":"September 2026 payroll","amount":"401310.00","currency":"SAR","actions":[],"accounting":{"state":"posted","event_id":"7d1c2f0e-4b7a-4a51-9a51-2f0f6f3b9b21","posting_id":"post_88a1","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"attempts":1,"reason_code":null,"reason":null}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/accounting_sync_item"},"description":"The items, newest first.","x-description-ar":"العناصر، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"},"summary":{"type":"object","description":"Count per state over the period.","x-description-ar":"العدد لكل حالة في الفترة.","properties":{"posted":{"type":"integer","description":"Posted.","x-description-ar":"مرحّلة."},"held":{"type":"integer","description":"Held.","x-description-ar":"معلّقة."},"needs_decision":{"type":"integer","description":"Waiting for a decision.","x-description-ar":"بانتظار قرار."},"retrying":{"type":"integer","description":"Being retried.","x-description-ar":"يُعاد إرسالها."},"sending":{"type":"integer","description":"Being sent.","x-description-ar":"قيد الإرسال."},"failed":{"type":"integer","description":"Failed or rejected.","x-description-ar":"فاشلة أو مرفوضة."},"queued":{"type":"integer","description":"Queued.","x-description-ar":"بالانتظار."},"reversed":{"type":"integer","description":"Reversed.","x-description-ar":"معكوسة."}}},"sync_enabled":{"type":"boolean","description":"True when sync is on.","x-description-ar":"صحيح إذا كانت المزامنة مفعّلة."},"connection_status":{"type":"string","description":"`connected`, `needs_reauth`, `disconnected` or `not_connected`.","x-description-ar":"`connected` أو `needs_reauth` أو `disconnected` أو `not_connected`."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_calendar_setting":{"get":{"summary":"Get the company weekend and timezone","operationId":"attendance_calendar.show","tags":["Attendance calendar"],"description":"Returns the company weekend (the weekdays, 0 Sunday to 6 Saturday) and the company timezone. The timezone\ndecides which calendar day a check-in belongs to and how a profile's times such as `08:00` are read; the\nweekend is the days off of the default attendance profile.\n\n**When to use:** to answer \"what is our weekend?\" or to read profile times and work dates correctly. A\nprofile other than the default may have its own days off: see `attendance_profiles.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض عطلة نهاية الأسبوع والمنطقة الزمنية للشركة","x-description-ar":"يعرض عطلة نهاية الأسبوع للشركة (أيام الأسبوع من 0 الأحد إلى 6 السبت) والمنطقة الزمنية للشركة. تحدد المنطقة\nالزمنية اليوم الذي ينتمي إليه تسجيل الحضور وطريقة قراءة أوقات الملفات مثل `08:00`، أما عطلة نهاية الأسبوع فهي\nأيام الراحة في ملف الحضور الافتراضي.\n\n**متى تستخدمه:** للإجابة عن «ما عطلة نهاية الأسبوع لدينا؟» أو لقراءة أوقات الملفات وتواريخ العمل بشكل صحيح.\nقد يكون لملف غير الافتراضي أيام راحة خاصة به: انظر `attendance_profiles.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"weekend_setting/view","label":"View the attendance calendar","x-label-ar":"عرض تقويم الحضور"},"x-feature":"weekend_setting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The calendar.","x-description-ar":"التقويم.","content":{"application/json":{"example":{"weekend_days":[5,6],"timezone":"Asia/Riyadh"},"schema":{"type":"object","description":"The company's attendance calendar.","x-description-ar":"تقويم الحضور للشركة.","properties":{"weekend_days":{"type":"array","description":"The company weekend, weekdays 0 (Sunday) to 6 (Saturday).","x-description-ar":"عطلة نهاية الأسبوع للشركة، أيام من 0 (الأحد) إلى 6 (السبت).","items":{"type":"integer","minimum":0,"maximum":6}},"timezone":{"type":"string","description":"The company timezone, an IANA name such as `Asia/Riyadh`.","x-description-ar":"المنطقة الزمنية للشركة، باسم IANA مثل `Asia/Riyadh`."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"patch":{"summary":"Change the company weekend or timezone","operationId":"attendance_calendar.update","tags":["Attendance calendar"],"description":"Changes the company weekend, the timezone, or both; what you leave out stays. Both are saved together or\nnot at all. A new weekend also becomes the days off of the default attendance profile, from today on; other\nprofiles keep their own days off and past days keep their saved records.\n\n**When to use:** when the company changes its weekend or moves to another timezone.\n\n**Prerequisites:** the token's owner must have an employee record in the company (otherwise 422\n`employee_required`). Read the current values with `attendance_calendar.show`. The timezone is an IANA name\n(`Asia/Riyadh`, `Africa/Cairo`).\n\n**Side effects:** recorded in the audit log. When the weekend changes, the pending and\napproved-but-not-started leave of every employee is recounted with the new days off. The timezone changes\nhow every later check-in is dated. Not offered to Claude, because it changes how attendance and leave are\ncounted for the whole company.","x-summary-ar":"تغيير عطلة نهاية الأسبوع أو المنطقة الزمنية للشركة","x-description-ar":"يغيّر عطلة نهاية الأسبوع للشركة أو المنطقة الزمنية أو كليهما، ويبقى ما لا ترسله كما هو. يُحفظان معاً أو لا\nيُحفظ أي منهما. تصبح العطلة الجديدة أيضاً أيام الراحة في ملف الحضور الافتراضي ابتداءً من اليوم، وتحتفظ الملفات\nالأخرى بأيام راحتها، وتبقى سجلات الأيام الماضية كما حُفظت.\n\n**متى تستخدمه:** عندما تغيّر الشركة عطلة نهاية الأسبوع أو تنتقل إلى منطقة زمنية أخرى.\n\n**المتطلبات:** يجب أن يكون لصاحب الرمز سجل موظف في الشركة (وإلا يُرجع 422 بالرمز `employee_required`). اقرأ\nالقيم الحالية عبر `attendance_calendar.show`. المنطقة الزمنية باسم IANA (`Asia/Riyadh`، `Africa/Cairo`).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. عند تغيير العطلة يُعاد احتساب الإجازات المعلّقة والمعتمدة التي لم\nتبدأ لكل الموظفين بأيام الراحة الجديدة. وتغيّر المنطقة الزمنية تاريخ كل تسجيل حضور لاحق. لا يُعرض على Claude\nلأنه يغيّر طريقة احتساب الحضور والإجازات للشركة كلها.","x-access":"write","x-permission":{"key":"weekend_setting/manage","label":"Configure weekend days and timezone","x-label-ar":"تهيئة أيام عطلة نهاية الأسبوع والمنطقة الزمنية"},"x-feature":"weekend_setting","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The calendar after the change.","x-description-ar":"التقويم بعد التعديل.","content":{"application/json":{"example":{"weekend_days":[5,6],"timezone":"Asia/Riyadh"},"schema":{"type":"object","description":"The company's attendance calendar.","x-description-ar":"تقويم الحضور للشركة.","properties":{"weekend_days":{"type":"array","description":"The company weekend, weekdays 0 (Sunday) to 6 (Saturday).","x-description-ar":"عطلة نهاية الأسبوع للشركة، أيام من 0 (الأحد) إلى 6 (السبت).","items":{"type":"integer","minimum":0,"maximum":6}},"timezone":{"type":"string","description":"The company timezone, an IANA name such as `Asia/Riyadh`.","x-description-ar":"المنطقة الزمنية للشركة، باسم IANA مثل `Asia/Riyadh`."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"The timezone is not an IANA name, the weekend is empty or leaves no working day, or it clashes with a day shift of the default profile.","x-meaning-ar":"المنطقة الزمنية ليست اسماً حسب IANA، أو العطلة فارغة أو لا تترك يوم عمل، أو تتعارض مع وردية في الملف الافتراضي.","x-fix":"Fix the value named in `error`; remove the clashing day shift with `attendance_profiles.update` first.","x-fix-ar":"صحّح القيمة المذكورة في `error`، واحذف الوردية المتعارضة أولاً عبر `attendance_profiles.update`."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee record.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل موظف.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_calendar_setting"],"properties":{"attendance_calendar_setting":{"type":"object","description":"Send one or both.","x-description-ar":"أرسل أحدهما أو كليهما.","properties":{"weekend_days":{"type":"array","description":"The new weekend, 0 (Sunday) to 6 (Saturday): at least one day, and at least one working day left.","x-description-ar":"العطلة الجديدة من 0 (الأحد) إلى 6 (السبت): يوم واحد على الأقل، ويبقى يوم عمل واحد على الأقل.","items":{"type":"integer","minimum":0,"maximum":6}},"timezone":{"type":"string","description":"IANA timezone name, e.g. `Asia/Riyadh`.","x-description-ar":"اسم المنطقة الزمنية حسب IANA، مثل `Asia/Riyadh`."}}}}},"example":{"attendance_calendar_setting":{"weekend_days":[5,6],"timezone":"Asia/Riyadh"}}}},"required":true,"description":"The values to change."}}},"/attendance_device_movements":{"get":{"summary":"List every device scan in the company","operationId":"attendance_device_movements.list","tags":["Attendance devices"],"description":"Returns the raw scans from every device, newest first: which device, which number and employee, when the\nperson scanned and when it reached QHR, in or out, how they verified, and what QHR did with it\n(`processing_state`). A scan is evidence: it is never edited, and a disagreement is recorded in its state.\n\n**When to use:** to answer \"did Sara's scan this morning register?\" across all devices, or to find scans that\nneed review (`q[processing_state_eq]=review_required`). For one device use\n`attendance_device_movements.list_for_device`.\n\n**Prerequisites:** none. Employee ids come from `employees.list` or `employees.search`.\n\n**Side effects:** none. Up to 50 scans per page. Scans are kept for twelve months.","x-summary-ar":"عرض كل بصمات الأجهزة في الشركة","x-description-ar":"يعيد البصمات الخام من كل الأجهزة، الأحدث أولاً: الجهاز والرقم والموظف، ووقت البصمة ووقت وصولها إلى QHR،\nوحضور أم انصراف، وطريقة التحقق، وما فعله QHR بها (`processing_state`). البصمة دليل لا يُعدَّل أبداً، وأي\nاختلاف يُسجَّل في حالتها.\n\n**متى تستخدمه:** للإجابة عن «هل سُجّلت بصمة سارة صباح اليوم؟» في كل الأجهزة، أو لإيجاد البصمات التي تحتاج\nمراجعة (`q[processing_state_eq]=review_required`). لجهاز واحد استخدم\n`attendance_device_movements.list_for_device`.\n\n**المتطلبات:** لا شيء. أرقام الموظفين من `employees.list` أو `employees.search`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ بصمة في الصفحة. تُحفظ البصمات اثني عشر شهراً.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee's scans (id from `employees.list` or `employees.search`).","x-description-ar":"بصمات هذا الموظف فقط (الرقم من `employees.list` أو `employees.search`).","example":1203},{"name":"q[external_employee_no_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only scans of this device number, exactly.","x-description-ar":"بصمات هذا الرقم على الجهاز فقط، مطابقاً تماماً.","example":"0123"},{"name":"q[processing_state_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_link","pending_processing","processed","superseded","repeat_scan","review_required","failed","after_day_ended"]},"description":"Only scans in this state, e.g. `review_required`.","x-description-ar":"البصمات في هذه الحالة فقط، مثل `review_required`.","example":"review_required"},{"name":"q[occurred_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Scanned at or after this time (ISO 8601).","x-description-ar":"بصمات في هذا الوقت أو بعده (ISO 8601).","example":"2026-11-26T00:00:00+03:00"},{"name":"q[occurred_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Scanned at or before this time (ISO 8601).","x-description-ar":"بصمات في هذا الوقت أو قبله (ISO 8601).","example":"2026-11-26T23:59:59+03:00"}],"responses":{"200":{"description":"A page of scans.","x-description-ar":"صفحة من البصمات.","content":{"application/json":{"example":{"records":[{"id":88412,"device":{"id":14,"name":"Riyadh HQ main gate"},"external_employee_no":"0123","employee":{"id":1203,"full_name":"Sara Ahmed"},"occurred_at":"2026-11-26T05:02:13Z","received_at":"2026-11-26T05:02:15Z","effective_direction":"in","raw_direction":"0","verification_method":"fingerprint","processing_state":"processed","processing_note":null,"attendance_record_id":55310}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_device_movement_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_device_support_requests":{"get":{"summary":"List the company's device support requests","operationId":"attendance_device_support_requests.list","tags":["Attendance device support"],"description":"Returns the device support requests this company has raised, newest first, with their reference, device,\nstatus and when QHR last wrote. `done` and `rejected` are final; anything else is still open.\n\n**When to use:** to answer \"what happened to our request for the Hikvision reader?\", or to find a request's\n`id` for `attendance_device_support_requests.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات دعم الأجهزة في الشركة","x-description-ar":"يعيد طلبات دعم الأجهزة التي أرسلتها هذه الشركة، الأحدث أولاً، مع المرجع والجهاز والحالة ووقت آخر رسالة من QHR.\nالحالتان `done` و`rejected` نهائيتان، وما عداهما ما زال مفتوحاً.\n\n**متى تستخدمه:** للإجابة عن «ماذا حدث لطلبنا الخاص بقارئ Hikvision؟»، أو لمعرفة رقم `id` الطلب لاستخدامه في\n`attendance_device_support_requests.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of requests.","x-description-ar":"صفحة من الطلبات.","content":{"application/json":{"example":{"records":[{"id":57,"reference":"DEV-1042","manufacturer":"Hikvision","model":"DS-K1T341","status":"in_progress","contact_email":"hr@acme.example","created_at":"2026-11-20T09:15:00Z","updated_at":"2026-11-22T11:00:00Z","last_message_at":"2026-11-22T11:00:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_device_support_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Ask QHR to support a device","operationId":"attendance_device_support_requests.create","tags":["Attendance device support"],"description":"Sends the QHR team a request to support a device: one that is not in `attendance_devices.catalogue`, or one\nthat will not connect. Answers with the request and its reference (e.g. `DEV-1042`). The team works through\n`submitted`, `reviewed`, `in_progress` and then `done` or `rejected`, and replies by email.\n\n**When to use:** when the company's device is missing from the catalogue, or registration did not lead to a\nconnection.\n\n**Prerequisites:** none. `failure_context.attendance_device_id` can name a device from\n`attendance_devices.list`; `attachment_ids` are ids of documents already uploaded to the company in QHR\n(ids that are not the company's are ignored).\n\n**Side effects:** the request joins the QHR support queue, and a confirmation email goes to `contact_email`\n(the token owner's email when omitted). Not offered to Claude: it contacts the QHR team on the company's\nbehalf.","x-summary-ar":"طلب دعم جهاز من QHR","x-description-ar":"يرسل إلى فريق QHR طلب دعم جهاز: جهاز غير موجود في `attendance_devices.catalogue`، أو جهاز لا يتصل. يعيد الطلب\nومرجعه (مثل `DEV-1042`). يمر الطلب لدى الفريق بالحالات `submitted` ثم `reviewed` ثم `in_progress` ثم `done`\nأو `rejected`، ويرد الفريق بالبريد.\n\n**متى تستخدمه:** عندما لا يكون جهاز الشركة في القائمة، أو لم يتصل الجهاز بعد تسجيله.\n\n**المتطلبات:** لا شيء. يمكن أن يذكر `failure_context.attendance_device_id` جهازاً من `attendance_devices.list`،\nو`attachment_ids` أرقام مستندات مرفوعة مسبقاً للشركة في QHR (تُتجاهل الأرقام التي لا تخص الشركة).\n\n**الآثار الجانبية:** يدخل الطلب قائمة دعم QHR، ويصل بريد تأكيد إلى `contact_email` (بريد صاحب الرمز إن لم\nيُرسل). لا تُعرض على Claude لأنها تتواصل مع فريق QHR نيابةً عن الشركة.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request.","x-description-ar":"الطلب الجديد.","content":{"application/json":{"example":{"id":57,"reference":"DEV-1042","manufacturer":"Hikvision","model":"DS-K1T341","status":"submitted","contact_email":"hr@acme.example","created_at":"2026-11-20T09:15:00Z","updated_at":"2026-11-20T09:15:00Z","last_message_at":null},"schema":{"$ref":"#/components/schemas/attendance_device_support_request_row"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The request cannot be sent: manufacturer, model or contact email missing or invalid, or a count below 1.","x-description-ar":"لا يمكن إرسال الطلب: الشركة المصنّعة أو الطراز أو بريد التواصل ناقص أو غير صحيح، أو عدد أقل من ١.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Manufacturer can't be blank","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["support_request"],"properties":{"support_request":{"type":"object","required":["manufacturer","model"],"description":"The device and how to reach you.","x-description-ar":"الجهاز وطريقة التواصل معك.","properties":{"manufacturer":{"type":"string","description":"Manufacturer, as printed on the device.","x-description-ar":"الشركة المصنّعة كما هي على الجهاز."},"model":{"type":"string","description":"Model.","x-description-ar":"الطراز."},"firmware":{"type":"string","description":"Firmware version, if known.","x-description-ar":"إصدار البرنامج الثابت إن كان معروفاً."},"existing_software":{"type":"string","description":"Software used with the device today.","x-description-ar":"البرنامج المستخدم مع الجهاز حالياً."},"devices_count":{"type":"integer","description":"How many such devices (1 or more).","x-description-ar":"عدد هذه الأجهزة (١ أو أكثر).","minimum":1},"locations_count":{"type":"integer","description":"Across how many locations (1 or more).","x-description-ar":"في كم موقع (١ أو أكثر).","minimum":1},"contact_email":{"type":"string","description":"Where QHR should reply; the token owner's email when omitted.","x-description-ar":"البريد الذي يرد عليه QHR؛ بريد صاحب الرمز إن لم يُرسل.","format":"email"},"notes":{"type":"string","description":"Anything else the team should know.","x-description-ar":"أي معلومات أخرى يحتاجها الفريق."},"attachment_ids":{"type":"array","description":"Ids of documents already uploaded to the company (photos of the device label, manuals).","x-description-ar":"أرقام مستندات مرفوعة مسبقاً للشركة (صور ملصق الجهاز، الأدلة).","items":{"type":"integer"}},"failure_context":{"type":"object","description":"Where setup failed, if it did. Other keys are dropped.","x-description-ar":"أين فشل الإعداد إن فشل. تُحذف أي مفاتيح أخرى.","properties":{"attendance_device_id":{"type":"integer","description":"The registered device, from `attendance_devices.list`.","x-description-ar":"الجهاز المسجل، من `attendance_devices.list`."},"stage":{"type":"string","description":"Setup stage reached, e.g. `awaiting_connection`.","x-description-ar":"مرحلة الإعداد التي وصل إليها، مثل `awaiting_connection`."},"manufacturer_key":{"type":"string","description":"Catalogue manufacturer key tried.","x-description-ar":"مفتاح الشركة المصنّعة الذي جُرّب."},"model_key":{"type":"string","description":"Catalogue model key tried.","x-description-ar":"مفتاح الطراز الذي جُرّب."},"model_name":{"type":"string","description":"Model name typed for `other`.","x-description-ar":"اسم الطراز المكتوب مع `other`."},"firmware_key":{"type":"string","description":"Catalogue firmware key tried.","x-description-ar":"مفتاح الإصدار الذي جُرّب."},"firmware_name":{"type":"string","description":"Firmware name typed for `other`.","x-description-ar":"اسم الإصدار المكتوب مع `other`."},"serial_number":{"type":"string","description":"Device serial number.","x-description-ar":"الرقم التسلسلي للجهاز."}}}}}}},"example":{"support_request":{"manufacturer":"Hikvision","model":"DS-K1T341","firmware":"3.2.40","existing_software":"iVMS-4200","devices_count":2,"locations_count":1,"contact_email":"hr@acme.example","notes":"Two devices at the main gate.","failure_context":{"stage":"awaiting_connection","model_key":"other"}}}}},"required":true,"description":"The request."}}},"/attendance_device_support_requests/{id}":{"get":{"summary":"Get one device support request with QHR's replies","operationId":"attendance_device_support_requests.show","tags":["Attendance device support"],"description":"Returns one of the company's device support requests in full: the device details, counts, notes, where setup\nfailed, the attachments sent, and every message the QHR team has sent about it, newest first.\n\n**When to use:** to read what the QHR team has said about a request, or to check its details.\n\n**Prerequisites:** the request `id`, from `attendance_device_support_requests.list`. Another company's\nrequest answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض طلب دعم جهاز مع ردود QHR","x-description-ar":"يعيد أحد طلبات دعم الأجهزة الخاصة بالشركة كاملاً: تفاصيل الجهاز والأعداد والملاحظات وأين فشل الإعداد والمرفقات\nالمرسلة، وكل رسالة أرسلها فريق QHR بشأنه، الأحدث أولاً.\n\n**متى تستخدمه:** لقراءة ما قاله فريق QHR عن طلب، أو للتحقق من تفاصيله.\n\n**المتطلبات:** رقم `id` الطلب من `attendance_device_support_requests.list`. طلب شركة أخرى يعيد 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_support_request_id"}],"responses":{"200":{"description":"The request.","x-description-ar":"الطلب.","content":{"application/json":{"example":{"id":57,"reference":"DEV-1042","manufacturer":"Hikvision","model":"DS-K1T341","status":"in_progress","contact_email":"hr@acme.example","created_at":"2026-11-20T09:15:00Z","updated_at":"2026-11-22T11:00:00Z","last_message_at":"2026-11-22T11:00:00Z","firmware":"3.2.40","existing_software":"iVMS-4200","devices_count":2,"locations_count":1,"notes":"Two devices at the main gate.","failure_context":{"stage":"awaiting_connection","model_key":"other"},"attachments":[],"messages":[{"subject":"We are working on your device","body":"Our team has started adding support for the DS-K1T341.","sent_at":"2026-11-22T11:00:00Z"}]},"schema":{"$ref":"#/components/schemas/attendance_device_support_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices":{"get":{"summary":"List attendance devices","operationId":"attendance_devices.list","tags":["Attendance devices"],"description":"Returns the company's attendance devices, newest first: name, location, model, connection state, last\ncontact and scan, how many employees are linked and how many scanned numbers belong to nobody yet.\n\n**When to use:** to answer \"which devices do we have and are they working?\", or to find a device's `id` for\nthe other device operations. For the totals only, `attendance_devices.stat_cards` is lighter.\n\n**Prerequisites:** none. Location ids for the filter come from `employees.meta_data` (`locations`).\n\n**Side effects:** none. Up to 50 devices per page.","x-summary-ar":"عرض قائمة أجهزة الحضور","x-description-ar":"يعرض أجهزة الحضور في الشركة، الأحدث إضافةً أولاً: الاسم والموقع والطراز وحالة الاتصال وآخر اتصال وآخر بصمة،\nوعدد الموظفين المرتبطين، وعدد الأرقام التي بصمت ولم تُربط بأحد بعد.\n\n**متى تستخدمه:** للإجابة عن «ما الأجهزة لدينا وهل تعمل؟»، أو لمعرفة رقم `id` الجهاز الذي تحتاجه عمليات\nالأجهزة الأخرى. للأعداد الإجمالية فقط، `attendance_devices.stat_cards` أخف.\n\n**المتطلبات:** لا شيء. أرقام المواقع للتصفية من `employees.meta_data` (`locations`).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ جهازاً في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Device name contains.","x-description-ar":"اسم الجهاز يحتوي على.","example":"gate"},{"name":"q[serial_number_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Serial number contains.","x-description-ar":"الرقم التسلسلي يحتوي على.","example":"CGH82"},{"name":"q[location_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only devices at this location.","x-description-ar":"أجهزة هذا الموقع فقط.","example":2},{"name":"q[connection_state_eq]","in":"query","required":false,"schema":{"type":"string","enum":["awaiting_connection","online","offline","disabled"]},"description":"Only devices in this connection state.","x-description-ar":"الأجهزة في حالة الاتصال هذه فقط.","example":"offline"}],"responses":{"200":{"description":"A page of devices.","x-description-ar":"صفحة من الأجهزة.","content":{"application/json":{"example":{"records":[{"id":14,"name":"Riyadh HQ main gate","serial_number":"CGH8234900014","usage_mode":"shared","timezone":"Asia/Riyadh","connection_state":"online","existing_software":"ZKBioTime","manufacturer":"ZKTeco","model":"K40","firmware":"Ver 6.60 (1.10)","verified_combination":true,"location":{"id":2,"name":"Riyadh HQ"},"usage_mode_effective_from":"2026-09-01","last_contact_at":"2026-11-26T08:41:00Z","last_movement_at":"2026-11-26T05:02:13Z","linked_employees_count":46,"pending_numbers_count":2,"created_by":{"id":51,"name":"Omar Ali"}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_device_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Register an attendance device","operationId":"attendance_devices.create","tags":["Attendance devices"],"description":"Registers a device at a location and answers with the device and its `setup` card: the server address and\nport IT enters on the device, and step-by-step instructions for that model in the caller's language. The\ndevice stays `awaiting_connection` until it calls QHR. A serial number can be registered once across QHR.\n\n**When to use:** when the company installs a new device. Then poll `attendance_devices.connection` until it\nis `online`, and link employees with `attendance_device_employee_links.create` or the CSV import.\n\n**Prerequisites:** `manufacturer_key`, `model_key` and `firmware_key` from `attendance_devices.catalogue`\n(`other` with `model_name` / `firmware_name` for unlisted hardware); `location_id` from\n`employees.meta_data` (`locations`).\n\n**Side effects:** QHR starts accepting scans from this serial number. The device is recorded in the audit\nlog. Not offered to Claude: it is a technical setup that needs someone at the device.","x-summary-ar":"تسجيل جهاز حضور","x-description-ar":"يسجّل جهازاً في موقع ويعيد الجهاز مع بطاقة الإعداد `setup`: عنوان الخادم والمنفذ اللذين يُدخلهما فريق تقنية\nالمعلومات في الجهاز، وتعليمات خطوة بخطوة لهذا الطراز بلغة المستدعي. يبقى الجهاز في حالة\n`awaiting_connection` حتى يتصل بـ QHR. لا يُسجَّل الرقم التسلسلي إلا مرة واحدة في QHR كله.\n\n**متى تستخدمه:** عند تركيب جهاز جديد في الشركة. بعدها استعلم عبر `attendance_devices.connection` حتى يصبح\n`online`، ثم اربط الموظفين عبر `attendance_device_employee_links.create` أو استيراد ملف CSV.\n\n**المتطلبات:** `manufacturer_key` و`model_key` و`firmware_key` من `attendance_devices.catalogue` (أو `other`\nمع `model_name` و`firmware_name` لجهاز غير مدرج)، و`location_id` من `employees.meta_data` (`locations`).\n\n**الآثار الجانبية:** يبدأ QHR قبول البصمات من هذا الرقم التسلسلي. يُسجَّل الجهاز في سجل التدقيق. لا تُعرض\nعلى Claude لأنها إعداد تقني يحتاج شخصاً عند الجهاز.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new device, with its setup card.","x-description-ar":"الجهاز الجديد مع بطاقة الإعداد.","content":{"application/json":{"example":{"id":14,"name":"Riyadh HQ main gate","serial_number":"CGH8234900014","usage_mode":"shared","timezone":"Asia/Riyadh","connection_state":"awaiting_connection","existing_software":"ZKBioTime","manufacturer":"ZKTeco","model":"K40","firmware":"Ver 6.60 (1.10)","verified_combination":true,"location":{"id":2,"name":"Riyadh HQ"},"usage_mode_effective_from":"2026-09-01","last_contact_at":null,"last_movement_at":null,"linked_employees_count":0,"pending_numbers_count":0,"created_by":{"id":51,"name":"Omar Ali"},"setup":{"server_address":"qhr-api.qoyod.com","server_port":443,"instructions":[{"step":1,"text":"On the device press Menu \u003e Comm \u003e Ethernet and confirm it has an IP address."},{"step":2,"text":"Go to Comm \u003e Cloud Server Setting."},{"step":3,"text":"Set Server Address to qhr-api.qoyod.com and Port to 443."},{"step":4,"text":"Save. The device restarts and contacts QHR within a minute."}]}},"schema":{"$ref":"#/components/schemas/attendance_device_created"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The device cannot be registered.","x-description-ar":"لا يمكن تسجيل الجهاز.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Serial number has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_device"],"properties":{"attendance_device":{"type":"object","required":["name","location_id","serial_number","manufacturer_key","model_key","timezone","usage_mode"],"description":"The device.","x-description-ar":"الجهاز.","properties":{"name":{"type":"string","description":"A name people will recognise, e.g. the door it stands at.","x-description-ar":"اسم يعرفه الناس، مثل الباب الذي يقف عنده."},"location_id":{"type":"integer","description":"Work location id, from `employees.meta_data` (`locations`). Only employees of this location can be linked.","x-description-ar":"رقم موقع العمل من `employees.meta_data` (`locations`). لا يُربط إلا موظفو هذا الموقع."},"serial_number":{"type":"string","description":"Serial number printed on the device.","x-description-ar":"الرقم التسلسلي المطبوع على الجهاز."},"manufacturer_key":{"type":"string","description":"Manufacturer `key` from `attendance_devices.catalogue`.","x-description-ar":"مفتاح الشركة المصنّعة `key` من `attendance_devices.catalogue`."},"model_key":{"type":"string","description":"Model `key` from the catalogue, or `other`.","x-description-ar":"مفتاح الطراز من القائمة، أو `other`."},"model_name":{"type":"string","description":"The model's name; required when `model_key` is `other`.","x-description-ar":"اسم الطراز؛ مطلوب إن كان `model_key` هو `other`."},"firmware_key":{"type":"string","description":"Firmware `key` from the catalogue, or `other`. Optional.","x-description-ar":"مفتاح إصدار البرنامج الثابت من القائمة، أو `other`. اختياري."},"firmware_name":{"type":"string","description":"The firmware's name; required when `firmware_key` is `other`.","x-description-ar":"اسم الإصدار؛ مطلوب إن كان `firmware_key` هو `other`."},"timezone":{"type":"string","description":"IANA timezone of the device's clock, e.g. `Asia/Riyadh`.","x-description-ar":"المنطقة الزمنية IANA لساعة الجهاز، مثل `Asia/Riyadh`."},"usage_mode":{"type":"string","description":"`check_in_only`, `check_out_only` or `shared`.","x-description-ar":"`check_in_only` حضور فقط، `check_out_only` انصراف فقط، أو `shared` مشترك.","enum":["check_in_only","check_out_only","shared"]},"existing_software":{"type":"string","description":"Software used with the device before QHR, for reference.","x-description-ar":"البرنامج المستخدم مع الجهاز قبل QHR، للعلم."}}}}},"example":{"attendance_device":{"name":"Riyadh HQ main gate","location_id":2,"serial_number":"CGH8234900014","manufacturer_key":"zkteco","model_key":"zkteco_k40","firmware_key":"6_60_1_10","timezone":"Asia/Riyadh","usage_mode":"shared","existing_software":"ZKBioTime"}}}},"required":true,"description":"The new device."}}},"/attendance_devices/catalogue":{"get":{"summary":"List supported device manufacturers and models","operationId":"attendance_devices.catalogue","tags":["Attendance devices"],"description":"Returns the device manufacturers QHR can connect to, each with its models and the firmware versions per model.\n`verified` says whether QHR has tested that model or firmware; an unverified one can still be registered. Each\nlist ends with an `other` entry for hardware that is not listed.\n\n**When to use:** before `attendance_devices.create`, to get `manufacturer_key`, `model_key` and `firmware_key`,\nor to answer \"does QHR support our device?\". If the device is missing, raise\n`attendance_device_support_requests.create`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض الشركات المصنّعة والطرازات المدعومة","x-description-ar":"يعيد الشركات المصنّعة للأجهزة التي يستطيع QHR الاتصال بها، ولكل منها طرازاتها وإصدارات البرنامج الثابت لكل\nطراز. يوضح `verified` إن كان QHR قد اختبر الطراز أو الإصدار، ويمكن تسجيل غير المختبَر أيضاً. تنتهي كل قائمة\nبخيار `other` للأجهزة غير المدرجة.\n\n**متى تستخدمه:** قبل `attendance_devices.create` لمعرفة `manufacturer_key` و`model_key` و`firmware_key`، أو\nللإجابة عن «هل يدعم QHR جهازنا؟». إن لم يكن الجهاز مدرجاً فأرسل `attendance_device_support_requests.create`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The catalogue.","x-description-ar":"قائمة الأجهزة المدعومة.","content":{"application/json":{"example":{"manufacturers":[{"key":"zkteco","name":"ZKTeco","integration":"push","models":[{"key":"zkteco_k40","name":"K40","verified":true,"capabilities":{"reads_direction":false},"firmwares":[{"key":"6_60_1_10","name":"Ver 6.60 (1.10)","verified":true},{"key":"other","name":"Other","verified":false}],"instructions":{"en":[{"step":1,"text":"On the device press Menu \u003e Comm \u003e Ethernet and confirm it has an IP address."}],"ar":[{"step":1,"text":"من الجهاز اضغط القائمة \u003e الاتصال \u003e الشبكة وتأكد من وجود عنوان IP."}]}},{"key":"other","name":"Other","verified":false,"capabilities":{"reads_direction":false},"firmwares":[{"key":"other","name":"Other","verified":false}]}]}]},"schema":{"type":"object","properties":{"manufacturers":{"type":"array","description":"Manufacturers: `key`, `name`, `integration` and `models` (each with `key`, `name`, `verified`, `capabilities.reads_direction`, `firmwares` and setup `instructions` in `en` and `ar`).","x-description-ar":"الشركات المصنّعة: `key` و`name` و`integration` و`models` (لكل طراز `key` و`name` و`verified` و`capabilities.reads_direction` و`firmwares` وتعليمات الإعداد `instructions` بالعربية والإنجليزية).","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_devices/stat_cards":{"get":{"summary":"Count devices by connection state","operationId":"attendance_devices.stat_cards","tags":["Attendance devices"],"description":"Returns how many devices there are, how many are online, offline and awaiting their first connection, how\nmany scanned numbers belong to nobody yet, and how many of the company's device support requests are still\nopen. Takes the same filters as `attendance_devices.list` and counts the devices that list would show.\n\n**When to use:** for a quick health check (\"are all our devices online?\") without paging through the list.\n`total` also counts `disabled` devices, which have no card of their own.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عدّ الأجهزة حسب حالة الاتصال","x-description-ar":"يعيد عدد الأجهزة، وكم منها متصل ومنقطع وبانتظار أول اتصال، وعدد الأرقام التي بصمت ولم تُربط بأحد، وعدد\nطلبات دعم الأجهزة المفتوحة في الشركة. يقبل مرشحات `attendance_devices.list` نفسها ويعدّ الأجهزة التي كانت\nالقائمة ستعرضها.\n\n**متى تستخدمه:** لفحص سريع لحالة الأجهزة («هل كل أجهزتنا متصلة؟») دون تصفح القائمة. يشمل `total` الأجهزة\nالمعطّلة `disabled` أيضاً، وليس لها عدّاد مستقل.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[location_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only devices at this location.","x-description-ar":"أجهزة هذا الموقع فقط.","example":2},{"name":"q[connection_state_eq]","in":"query","required":false,"schema":{"type":"string","enum":["awaiting_connection","online","offline","disabled"]},"description":"Only devices in this connection state.","x-description-ar":"الأجهزة في حالة الاتصال هذه فقط.","example":"online"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Device name contains.","x-description-ar":"اسم الجهاز يحتوي على.","example":"gate"},{"name":"q[serial_number_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Serial number contains.","x-description-ar":"الرقم التسلسلي يحتوي على.","example":"CGH82"}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"total":5,"online":3,"offline":1,"awaiting_connection":1,"pending_numbers":4,"open_support_requests":1},"schema":{"type":"object","properties":{"total":{"type":"integer","description":"Devices matching the filters, every state.","x-description-ar":"الأجهزة المطابقة بكل حالاتها."},"online":{"type":"integer","description":"Online.","x-description-ar":"المتصلة."},"offline":{"type":"integer","description":"Silent for over an hour.","x-description-ar":"المنقطعة منذ أكثر من ساعة."},"awaiting_connection":{"type":"integer","description":"Registered, never connected.","x-description-ar":"المسجلة التي لم تتصل بعد."},"pending_numbers":{"type":"integer","description":"Scanned numbers that belong to nobody, across these devices.","x-description-ar":"الأرقام التي بصمت ولم تُربط بأحد في هذه الأجهزة."},"open_support_requests":{"type":"integer","description":"Device support requests not `done` or `rejected` (whole company, not filtered).","x-description-ar":"طلبات دعم الأجهزة غير المكتملة أو المرفوضة (للشركة كلها، دون تصفية)."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_devices/{attendance_device_id}/employee_links":{"get":{"summary":"List who each number on a device belongs to","operationId":"attendance_device_employee_links.list","tags":["Attendance devices"],"description":"Returns the device's links between a number on the device and an employee, current ones first, then closed\nones newest first. Closed links stay in the list because they explain past attendance: a number reassigned\nlast week still belonged to someone else before.\n\n**When to use:** to answer \"whose is number 0123 on the Riyadh gate?\" or \"is Sara set up on this device?\", or\nto find a link `id` to change or close.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`. Employee ids for the filter come from\n`employees.list` or `employees.search`.\n\n**Side effects:** none. Up to 50 links per page.","x-summary-ar":"عرض أصحاب الأرقام على جهاز","x-description-ar":"يعيد روابط الجهاز بين رقم على الجهاز وموظف، القائمة أولاً ثم المغلقة الأحدث فالأقدم. تبقى الروابط المغلقة في\nالقائمة لأنها تفسّر الحضور السابق: الرقم الذي نُقل الأسبوع الماضي كان لشخص آخر قبل ذلك.\n\n**متى تستخدمه:** للإجابة عن «لمن الرقم 0123 على بوابة الرياض؟» أو «هل سارة مرتبطة بهذا الجهاز؟»، أو لمعرفة رقم\n`id` الربط لتغييره أو إغلاقه.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`. أرقام الموظفين للتصفية من `employees.list` أو\n`employees.search`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ ربطاً في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[external_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Device number contains.","x-description-ar":"الرقم على الجهاز يحتوي على.","example":"012"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee's links.","x-description-ar":"روابط هذا الموظف فقط.","example":1203},{"name":"q[created_via_eq]","in":"query","required":false,"schema":{"type":"string","enum":["manual","csv"]},"description":"`manual` or `csv`.","x-description-ar":"`manual` يدوي أو `csv` من الملف.","example":"manual"}],"responses":{"200":{"description":"A page of links.","x-description-ar":"صفحة من الروابط.","content":{"application/json":{"example":{"records":[{"id":301,"external_employee_no":"0123","created_via":"manual","employee":{"id":1203,"employee_no":"E-0042","full_name":"Sara Ahmed"},"effective_from":"2026-11-01","effective_to":null,"movements_count":37}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_device_link_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Link a device number to an employee","operationId":"attendance_device_employee_links.create","tags":["Attendance devices"],"description":"Says which employee a number on the device belongs to, from the start of the earliest payroll period that is\nstill open (never later than today). One number per employee and one employee per number on each device.\n\n**When to use:** when an employee is enrolled on a device, or to claim a number from\n`attendance_device_pending_numbers.list`. For a whole location at once, use the CSV import.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`; `employee_id` from\n`attendance_device_employee_links.candidates`.\n\n**Side effects:** scans this number already sent from that date on are applied to the employee's attendance\nin the background, so their attendance days (and the payroll built on them) can change. Days in a closed\npayroll period are held for review instead. Not offered to Claude: it rewrites attendance.","x-summary-ar":"ربط رقم على الجهاز بموظف","x-description-ar":"يحدد الموظف صاحب رقم على الجهاز، ابتداءً من بداية أقدم فترة رواتب ما زالت مفتوحة (ولا يتجاوز اليوم). لكل موظف\nرقم واحد ولكل رقم موظف واحد على كل جهاز.\n\n**متى تستخدمه:** عند تسجيل موظف على جهاز، أو لنسبة رقم من `attendance_device_pending_numbers.list` إلى صاحبه.\nلموقع كامل دفعة واحدة استخدم استيراد CSV.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`، و`employee_id` من\n`attendance_device_employee_links.candidates`.\n\n**الآثار الجانبية:** تُطبَّق في الخلفية البصمات التي أرسلها هذا الرقم من ذلك التاريخ على حضور الموظف، فقد تتغير\nأيام حضوره (والرواتب المبنية عليها). أما الأيام في فترة رواتب مغلقة فتُحجز للمراجعة. لا تُعرض على Claude لأنها\nتعيد كتابة الحضور.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"}],"responses":{"201":{"description":"The new link.","x-description-ar":"الربط الجديد.","content":{"application/json":{"example":{"id":301,"external_employee_no":"0123","created_via":"manual","employee":{"id":1203,"employee_no":"E-0042","full_name":"Sara Ahmed"},"effective_from":"2026-11-01","effective_to":null,"movements_count":0},"schema":{"$ref":"#/components/schemas/attendance_device_link"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The number cannot be linked: blank number, employee not at the device's location, number already someone else's on this device, or employee already has a number here.","x-description-ar":"لا يمكن ربط الرقم: الرقم فارغ، أو الموظف ليس في موقع الجهاز، أو الرقم لموظف آخر على هذا الجهاز، أو للموظف رقم آخر عليه.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This device number is already linked to another employee on this device.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_link"],"properties":{"employee_link":{"type":"object","required":["employee_id","external_employee_no"],"description":"Who and which number.","x-description-ar":"الموظف والرقم.","properties":{"employee_id":{"type":"integer","description":"Employee id, from `attendance_device_employee_links.candidates`. The employee must work at the device's location (main or additional).","x-description-ar":"رقم الموظف من `attendance_device_employee_links.candidates`. يجب أن يعمل الموظف في موقع الجهاز (رئيسياً أو إضافياً)."},"external_employee_no":{"type":"string","description":"The number the employee uses on the device, exactly as the device shows it (`0123` is not `123`).","x-description-ar":"الرقم الذي يستخدمه الموظف على الجهاز كما يظهر فيه تماماً (`0123` ليس `123`)."}}}}},"example":{"employee_link":{"employee_id":1203,"external_employee_no":"0123"}}}},"required":true,"description":"The link."}}},"/attendance_devices/{attendance_device_id}/employee_links/candidates":{"get":{"summary":"List employees who can be linked to a device","operationId":"attendance_device_employee_links.candidates","tags":["Attendance devices"],"description":"Returns the employees of the device's location (as their main or an additional location), ordered by\nemployee number, each with the number they already hold on this device (`linked_number`, null if none) and\nwhether the location is their `primary` or an `additional` one. Also returns the location, how many\nemployees have no location at all (they can be linked to no device) and how many listed employees are here\nthrough an additional location.\n\n**When to use:** to find the `employee_id` for `attendance_device_employee_links.create`, or to answer \"who at\nthis branch is not on the device yet?\" with `linked=false`.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين يمكن ربطهم بجهاز","x-description-ar":"يعيد موظفي موقع الجهاز (موقعاً رئيسياً أو إضافياً) مرتبين حسب الرقم الوظيفي، ومع كل منهم الرقم الذي يحمله على\nهذا الجهاز (`linked_number`، فارغ إن لم يوجد) وهل الموقع `primary` رئيسي أو `additional` إضافي له. يعيد أيضاً\nالموقع، وعدد الموظفين بلا موقع إطلاقاً (لا يمكن ربطهم بأي جهاز)، وعدد المعروضين الذين ينتمون إلى الموقع كموقع\nإضافي.\n\n**متى تستخدمه:** لمعرفة `employee_id` المطلوب في `attendance_device_employee_links.create`، أو للإجابة عن «من\nفي هذا الفرع لم يُربط بالجهاز بعد؟» مع `linked=false`.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"linked","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` only employees with a number on this device, `false` only those without.","x-description-ar":"`true` الموظفون الذين لهم رقم على هذا الجهاز فقط، `false` من ليس لهم رقم فقط.","example":false},{"name":"q[full_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains (English or Arabic).","x-description-ar":"الاسم يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"104"}],"responses":{"200":{"description":"The candidates.","x-description-ar":"الموظفون المرشحون.","content":{"application/json":{"example":{"location":{"id":2,"name":"Riyadh HQ"},"employees_without_location_count":3,"additional_employees_count":1,"records":[{"id":1203,"employee_no":"E-0042","full_name":"Sara Ahmed","linked_number":null,"assignment":"primary"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"location":{"type":"object","description":"The device's location: `id` and `name`.","x-description-ar":"موقع الجهاز: `id` و`name`."},"employees_without_location_count":{"type":"integer","description":"Employees with no location, who no device can list.","x-description-ar":"الموظفون بلا موقع، ولا يظهرون لأي جهاز."},"additional_employees_count":{"type":"integer","description":"Listed employees whose main location is elsewhere.","x-description-ar":"المعروضون الذين موقعهم الرئيسي في مكان آخر."},"records":{"type":"array","description":"The employees.","x-description-ar":"الموظفون.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"linked_number":{"type":"string","description":"Their number on this device; null if none.","x-description-ar":"رقمه على هذا الجهاز؛ null إن لم يوجد.","nullable":true},"assignment":{"type":"string","description":"`primary` or `additional` location.","x-description-ar":"الموقع `primary` رئيسي أو `additional` إضافي.","enum":["primary","additional"]}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{attendance_device_id}/employee_links/import":{"post":{"summary":"Link a whole location from an uploaded sheet","operationId":"attendance_device_employee_links.import","tags":["Attendance devices"],"description":"Reads the sheet from `attendance_device_employee_links.template` and applies it in one go: a new number\nopens a link, a changed number closes the old link and opens a new one, an empty number is skipped. All or\nnothing: if any row is wrong, nothing is saved and `rows` lists each problem with its spreadsheet row number.\nAnswers with how many links were `created`, `updated` and `skipped`, and `total_rows`.\n\n**When to use:** to link a whole branch at once after enrolling people on the device. For one person use\n`attendance_device_employee_links.create`.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`; the filled-in template (CSV, up to 1 MB\nand 2,000 rows, headers in English or Arabic) sent as `file` in a `multipart/form-data` body.\n\n**Side effects:** as for `attendance_device_employee_links.create`, for every row: stored scans of the new\nnumbers are applied to attendance in the background. Not offered to Claude: it is a file upload and rewrites\nattendance for a whole location.","x-summary-ar":"ربط موظفي موقع كامل من ملف مرفوع","x-description-ar":"يقرأ الملف المأخوذ من `attendance_device_employee_links.template` ويطبّقه دفعة واحدة: الرقم الجديد يفتح ربطاً،\nوالرقم المتغيّر يغلق الربط القديم ويفتح جديداً، والرقم الفارغ يُتجاوز. الكل أو لا شيء: إن كان أي صف خاطئاً لا\nيُحفظ شيء ويذكر `rows` كل مشكلة مع رقم صفها في الملف. يعيد عدد الروابط `created` المنشأة و`updated` المعدّلة\nو`skipped` المتجاوزة و`total_rows`.\n\n**متى تستخدمه:** لربط فرع كامل دفعة واحدة بعد تسجيل الموظفين على الجهاز. لموظف واحد استخدم\n`attendance_device_employee_links.create`.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`، والملف المعبّأ (CSV حتى ١ ميغابايت و٢٠٠٠ صف،\nبعناوين عربية أو إنجليزية) مرسلاً في الحقل `file` بصيغة `multipart/form-data`.\n\n**الآثار الجانبية:** كما في `attendance_device_employee_links.create` لكل صف: تُطبَّق البصمات المخزنة للأرقام\nالجديدة على الحضور في الخلفية. لا تُعرض على Claude لأنها رفع ملف وتعيد كتابة حضور موقع كامل.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"}],"responses":{"200":{"description":"The sheet was applied.","x-description-ar":"طُبّق الملف.","content":{"application/json":{"example":{"created":38,"updated":2,"skipped":6,"total_rows":46},"schema":{"type":"object","properties":{"created":{"type":"integer","description":"Links opened for numbers that had none.","x-description-ar":"روابط فُتحت لأرقام لم تكن مرتبطة."},"updated":{"type":"integer","description":"Links replaced because the number changed.","x-description-ar":"روابط استُبدلت لتغيّر الرقم."},"skipped":{"type":"integer","description":"Rows with no number, or unchanged.","x-description-ar":"صفوف بلا رقم أو دون تغيير."},"total_rows":{"type":"integer","description":"Data rows read.","x-description-ar":"عدد صفوف البيانات المقروءة."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"Nothing was saved. `rows` lists each problem (`row`, `employee_no`, `device_no`, `error`); it is empty when the file itself is wrong (not a CSV, too large, missing columns, no rows).","x-description-ar":"لم يُحفظ شيء. يذكر `rows` كل مشكلة (`row` و`employee_no` و`device_no` و`error`)، ويكون فارغاً إن كان الملف نفسه خاطئاً (ليس CSV، أو كبير جداً، أو تنقصه أعمدة، أو بلا صفوف).","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The file has 1 problems. Fix them and upload again.","code":"validation_failed","rows":[{"row":3,"employee_no":"9999","device_no":"0140","error":"No employee with this number"}]}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"The CSV from `attendance_device_employee_links.template`, third column filled in.","x-description-ar":"ملف CSV من `attendance_device_employee_links.template` بعد تعبئة العمود الثالث.","format":"binary"}}}}},"required":true,"description":"The filled-in template."}}},"/attendance_devices/{attendance_device_id}/employee_links/template":{"get":{"summary":"Download the sheet that links a whole location","operationId":"attendance_device_employee_links.template","tags":["Attendance devices"],"description":"Returns a CSV with one row per employee of the device's location: QHR employee number, full name, and the\nnumber they hold on this device (empty if none). Headers are in the caller's language. The file is named\nafter the device.\n\n**When to use:** to link many employees at once: fill in the third column, then upload the file with\n`attendance_device_employee_links.import`. It also works as a review of the current mapping.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** none. Returns a file (`.csv`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل ملف ربط موظفي موقع كامل","x-description-ar":"يعيد ملف CSV فيه صف لكل موظف في موقع الجهاز: الرقم الوظيفي في QHR، والاسم الكامل، والرقم الذي يحمله على هذا\nالجهاز (فارغ إن لم يوجد). العناوين بلغة المستدعي، والملف مسمّى باسم الجهاز.\n\n**متى تستخدمه:** لربط عدد كبير من الموظفين دفعة واحدة: املأ العمود الثالث ثم ارفع الملف عبر\n`attendance_device_employee_links.import`. ويصلح أيضاً لمراجعة الربط الحالي.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`.csv`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"}],"responses":{"200":{"description":"The CSV file.","x-description-ar":"ملف CSV.","content":{"text/csv":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{attendance_device_id}/employee_links/{id}":{"patch":{"summary":"Change the number linked to an employee","operationId":"attendance_device_employee_links.update","tags":["Attendance devices"],"description":"Gives an employee a different number on the device. The old link is closed today and a new one opens, so\npast scans keep pointing at whoever made them. Sending the number the link already has changes nothing.\n\n**When to use:** when an employee is re-enrolled on the device under a new number.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`; the link `id`, from\n`attendance_device_employee_links.list`.\n\n**Side effects:** as for `attendance_device_employee_links.create`: stored scans of the new number are applied\nto the employee's attendance in the background. Not offered to Claude: it rewrites attendance.","x-summary-ar":"تغيير الرقم المرتبط بموظف","x-description-ar":"يعطي الموظف رقماً مختلفاً على الجهاز. يُغلق الربط القديم اليوم ويُفتح ربط جديد، فتبقى البصمات السابقة منسوبة\nلمن قام بها. إرسال الرقم نفسه الموجود في الربط لا يغيّر شيئاً.\n\n**متى تستخدمه:** عند إعادة تسجيل موظف على الجهاز برقم جديد.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`، ورقم `id` الربط من\n`attendance_device_employee_links.list`.\n\n**الآثار الجانبية:** كما في `attendance_device_employee_links.create`: تُطبَّق البصمات المخزنة للرقم الجديد على\nحضور الموظف في الخلفية. لا تُعرض على Claude لأنها تعيد كتابة الحضور.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/attendance_device_employee_link_id"}],"responses":{"200":{"description":"The new link that replaces the old one.","x-description-ar":"الربط الجديد الذي حل محل القديم.","content":{"application/json":{"example":{"id":302,"external_employee_no":"0456","created_via":"manual","employee":{"id":1203,"employee_no":"E-0042","full_name":"Sara Ahmed"},"effective_from":"2026-11-27","effective_to":null,"movements_count":0},"schema":{"$ref":"#/components/schemas/attendance_device_link"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The number cannot be used: blank, or already someone else's on this device.","x-description-ar":"لا يمكن استخدام الرقم: فارغ، أو لموظف آخر على هذا الجهاز.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Enter the number this employee uses on the device.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_link"],"properties":{"employee_link":{"type":"object","required":["external_employee_no"],"description":"The new number.","x-description-ar":"الرقم الجديد.","properties":{"external_employee_no":{"type":"string","description":"The number the employee uses on the device, exactly as the device shows it (`0123` is not `123`).","x-description-ar":"الرقم الذي يستخدمه الموظف على الجهاز كما يظهر فيه تماماً (`0123` ليس `123`)."}}}}},"example":{"employee_link":{"external_employee_no":"0456"}}}},"required":true,"description":"The new number."}},"delete":{"summary":"Close a device number link","operationId":"attendance_device_employee_links.delete","tags":["Attendance devices"],"description":"Ends the link today: from now on the number belongs to nobody on this device. The link stays in the list as\nclosed, and attendance already recorded is untouched.\n\n**When to use:** when an employee leaves the branch or stops using the device.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`; the link `id`, from\n`attendance_device_employee_links.list`.\n\n**Side effects:** new scans of the number are no longer counted as anyone's attendance; they wait in\n`attendance_device_pending_numbers.list` until the number is linked again. Not offered to Claude: the\nemployee silently stops getting attendance from the device.","x-summary-ar":"إغلاق ربط رقم على الجهاز","x-description-ar":"ينهي الربط اليوم، فلا يعود الرقم لأحد على هذا الجهاز من الآن. يبقى الربط في القائمة مغلقاً، ولا يتغير الحضور\nالمسجل سابقاً.\n\n**متى تستخدمه:** عند مغادرة الموظف للفرع أو توقفه عن استخدام الجهاز.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`، ورقم `id` الربط من\n`attendance_device_employee_links.list`.\n\n**الآثار الجانبية:** لا تُحتسب البصمات الجديدة لهذا الرقم حضوراً لأحد، وتنتظر في\n`attendance_device_pending_numbers.list` حتى يُربط الرقم مجدداً. لا تُعرض على Claude لأن الموظف يتوقف عن تسجيل\nحضوره من الجهاز دون تنبيه.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/attendance_device_employee_link_id"}],"responses":{"204":{"description":"Closed.","x-description-ar":"أُغلق الربط."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{attendance_device_id}/movements":{"get":{"summary":"List one device's scans","operationId":"attendance_device_movements.list_for_device","tags":["Attendance devices"],"description":"Returns the raw scans one device has sent, newest first, with the same fields and filters as\n`attendance_device_movements.list`. A large gap between `occurred_at` and `received_at` means the device was\noffline and sent its scans later.\n\n**When to use:** to check that a device is recording (\"did anyone scan at the Riyadh gate today?\"), or to\nsee what a given number has done on it.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** none. Up to 50 scans per page.","x-summary-ar":"عرض بصمات جهاز واحد","x-description-ar":"يعيد البصمات الخام التي أرسلها جهاز واحد، الأحدث أولاً، بحقول ومرشحات `attendance_device_movements.list`\nنفسها. الفرق الكبير بين `occurred_at` و`received_at` يعني أن الجهاز كان منقطعاً وأرسل بصماته لاحقاً.\n\n**متى تستخدمه:** للتحقق من أن جهازاً يسجّل («هل بصم أحد على بوابة الرياض اليوم؟»)، أو لمعرفة ما فعله رقم معين\nعليه.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ بصمة في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee's scans (id from `employees.list` or `employees.search`).","x-description-ar":"بصمات هذا الموظف فقط (الرقم من `employees.list` أو `employees.search`).","example":1203},{"name":"q[external_employee_no_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only scans of this device number, exactly.","x-description-ar":"بصمات هذا الرقم على الجهاز فقط، مطابقاً تماماً.","example":"0123"},{"name":"q[processing_state_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_link","pending_processing","processed","superseded","repeat_scan","review_required","failed","after_day_ended"]},"description":"Only scans in this state, e.g. `review_required`.","x-description-ar":"البصمات في هذه الحالة فقط، مثل `review_required`.","example":"review_required"},{"name":"q[occurred_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Scanned at or after this time (ISO 8601).","x-description-ar":"بصمات في هذا الوقت أو بعده (ISO 8601).","example":"2026-11-26T00:00:00+03:00"},{"name":"q[occurred_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Scanned at or before this time (ISO 8601).","x-description-ar":"بصمات في هذا الوقت أو قبله (ISO 8601).","example":"2026-11-26T23:59:59+03:00"}],"responses":{"200":{"description":"A page of the device's scans.","x-description-ar":"صفحة من بصمات الجهاز.","content":{"application/json":{"example":{"records":[{"id":88412,"device":{"id":14,"name":"Riyadh HQ main gate"},"external_employee_no":"0123","employee":{"id":1203,"full_name":"Sara Ahmed"},"occurred_at":"2026-11-26T05:02:13Z","received_at":"2026-11-26T05:02:15Z","effective_direction":"in","raw_direction":"0","verification_method":"fingerprint","processing_state":"processed","processing_note":null,"attendance_record_id":55310}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_device_movement_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{attendance_device_id}/pending_numbers":{"get":{"summary":"List device numbers nobody is linked to","operationId":"attendance_device_pending_numbers.list","tags":["Attendance devices"],"description":"Returns each number that has scanned on the device but belongs to no employee yet, once per number, with how\nmany times it scanned and when it was first and last seen; most recently seen first. These scans count as no\none's attendance until the number is linked.\n\n**When to use:** to answer \"why is someone's attendance missing?\" or \"who still needs linking on this\ndevice?\". Link a number with `attendance_device_employee_links.create`; its stored scans are then applied.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** none. Up to 50 numbers per page.","x-summary-ar":"عرض أرقام الجهاز غير المرتبطة بأحد","x-description-ar":"يعيد كل رقم بصم على الجهاز ولا يخص أي موظف بعد، مرة واحدة لكل رقم، مع عدد مرات البصم وأول وآخر ظهور له؛ الأحدث\nظهوراً أولاً. لا تُحتسب هذه البصمات حضوراً لأحد حتى يُربط الرقم.\n\n**متى تستخدمه:** للإجابة عن «لماذا حضور فلان مفقود؟» أو «من بقي بلا ربط على هذا الجهاز؟». اربط الرقم عبر\n`attendance_device_employee_links.create` فتُطبَّق بصماته المخزنة.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ رقماً في الصفحة.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_parent_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of unclaimed numbers.","x-description-ar":"صفحة من الأرقام غير المرتبطة.","content":{"application/json":{"example":{"records":[{"external_employee_no":"0777","movements_count":9,"first_seen_at":"2026-11-23T05:10:02Z","last_seen_at":"2026-11-26T05:12:40Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"The numbers.","x-description-ar":"الأرقام.","items":{"type":"object","properties":{"external_employee_no":{"type":"string","description":"The number on the device.","x-description-ar":"الرقم على الجهاز."},"movements_count":{"type":"integer","description":"Times it scanned.","x-description-ar":"عدد مرات البصم."},"first_seen_at":{"type":"string","description":"First scan, UTC.","x-description-ar":"أول بصمة بتوقيت UTC.","format":"date-time"},"last_seen_at":{"type":"string","description":"Latest scan, UTC.","x-description-ar":"آخر بصمة بتوقيت UTC.","format":"date-time"}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{id}":{"get":{"summary":"Get one attendance device","operationId":"attendance_devices.show","tags":["Attendance devices"],"description":"Returns one device with the same fields as `attendance_devices.list`: where it is, what model, whether it is\nconnected, when it last called QHR and last recorded a scan, and how many employees are linked to it.\n\n**When to use:** to answer questions about a specific device (\"is the Riyadh gate online?\"), or before\n`attendance_devices.update` to see the current values.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض جهاز حضور","x-description-ar":"يعرض جهازاً واحداً بحقول `attendance_devices.list` نفسها: مكانه وطرازه وهل هو متصل ومتى اتصل بـ QHR آخر مرة\nومتى سجّل آخر بصمة، وعدد الموظفين المرتبطين به.\n\n**متى تستخدمه:** للإجابة عن أسئلة تخص جهازاً بعينه («هل جهاز بوابة الرياض متصل؟»)، أو قبل\n`attendance_devices.update` لمعرفة القيم الحالية.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_id"}],"responses":{"200":{"description":"The device.","x-description-ar":"الجهاز.","content":{"application/json":{"example":{"id":14,"name":"Riyadh HQ main gate","serial_number":"CGH8234900014","usage_mode":"shared","timezone":"Asia/Riyadh","connection_state":"online","existing_software":"ZKBioTime","manufacturer":"ZKTeco","model":"K40","firmware":"Ver 6.60 (1.10)","verified_combination":true,"location":{"id":2,"name":"Riyadh HQ"},"usage_mode_effective_from":"2026-09-01","last_contact_at":"2026-11-26T08:41:00Z","last_movement_at":"2026-11-26T05:02:13Z","linked_employees_count":46,"pending_numbers_count":2,"created_by":{"id":51,"name":"Omar Ali"}},"schema":{"$ref":"#/components/schemas/attendance_device"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Edit an attendance device","operationId":"attendance_devices.update","tags":["Attendance devices"],"description":"Changes a device's name, location, timezone or usage mode. Send only the fields to change. The serial number,\nmanufacturer and model cannot change: they identify the hardware, so to replace a device remove it with\n`attendance_devices.delete` and register the new one.\n\n**When to use:** when a device is renamed, moved to another branch, or should now count only check-ins or\nonly check-outs.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`; a new `location_id` from\n`employees.meta_data` (`locations`).\n\n**Side effects:** a new usage mode applies from today in the device's timezone; scans already processed keep\ntheir meaning. A new location changes only which employees can be linked from now on; existing links stay.\nThe change is recorded in the audit log. Not offered to Claude: the usage mode and timezone decide how every\nfuture scan is read into attendance and payroll.","x-summary-ar":"تعديل جهاز حضور","x-description-ar":"يغيّر اسم الجهاز أو موقعه أو منطقته الزمنية أو وضع استخدامه. أرسل الحقول المراد تغييرها فقط. لا يمكن تغيير\nالرقم التسلسلي ولا الشركة المصنّعة ولا الطراز لأنها تعرّف الجهاز نفسه؛ لاستبدال جهاز احذفه عبر\n`attendance_devices.delete` ثم سجّل الجديد.\n\n**متى تستخدمه:** عند تغيير اسم الجهاز، أو نقله إلى فرع آخر، أو جعله يحسب الحضور فقط أو الانصراف فقط.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`، ورقم `location_id` الجديد من\n`employees.meta_data` (`locations`).\n\n**الآثار الجانبية:** يسري وضع الاستخدام الجديد من اليوم بتوقيت الجهاز، وتحتفظ البصمات المعالجة سابقاً\nبمعناها. تغيير الموقع يغيّر فقط من يمكن ربطه من الموظفين من الآن، وتبقى الروابط الحالية. يُسجَّل التغيير في سجل\nالتدقيق. لا تُعرض على Claude لأن وضع الاستخدام والمنطقة الزمنية يحددان كيف تُقرأ كل بصمة قادمة في الحضور\nوالرواتب.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_id"}],"responses":{"200":{"description":"The device as it now is.","x-description-ar":"الجهاز بعد التعديل.","content":{"application/json":{"example":{"id":14,"name":"Riyadh HQ main gate","serial_number":"CGH8234900014","usage_mode":"shared","timezone":"Asia/Riyadh","connection_state":"online","existing_software":"ZKBioTime","manufacturer":"ZKTeco","model":"K40","firmware":"Ver 6.60 (1.10)","verified_combination":true,"location":{"id":2,"name":"Riyadh HQ"},"usage_mode_effective_from":"2026-09-01","last_contact_at":"2026-11-26T08:41:00Z","last_movement_at":"2026-11-26T05:02:13Z","linked_employees_count":46,"pending_numbers_count":2,"created_by":{"id":51,"name":"Omar Ali"}},"schema":{"$ref":"#/components/schemas/attendance_device"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The device cannot be saved.","x-description-ar":"لا يمكن حفظ الجهاز.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Usage mode is not included in the list","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_device"],"properties":{"attendance_device":{"type":"object","description":"The device's editable fields.","x-description-ar":"حقول الجهاز القابلة للتعديل.","properties":{"name":{"type":"string","description":"Device name.","x-description-ar":"اسم الجهاز."},"location_id":{"type":"integer","description":"Work location id, from `employees.meta_data` (`locations`).","x-description-ar":"رقم موقع العمل، من `employees.meta_data` (`locations`)."},"timezone":{"type":"string","description":"IANA timezone of the device's clock, e.g. `Asia/Riyadh`.","x-description-ar":"المنطقة الزمنية IANA لساعة الجهاز، مثل `Asia/Riyadh`."},"usage_mode":{"type":"string","description":"`check_in_only`, `check_out_only` or `shared`.","x-description-ar":"`check_in_only` حضور فقط، `check_out_only` انصراف فقط، أو `shared` مشترك.","enum":["check_in_only","check_out_only","shared"]}}}}},"example":{"attendance_device":{"name":"Riyadh HQ main gate","usage_mode":"check_in_only"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Remove an attendance device","operationId":"attendance_devices.delete","tags":["Attendance devices"],"description":"Removes a device from the company. QHR stops accepting its scans; the scans it already sent and its employee\nlinks are kept, because they are the evidence behind past attendance. The same hardware can be registered\nagain later with `attendance_devices.create`.\n\n**When to use:** when a device is retired or replaced by new hardware.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list`.\n\n**Side effects:** scans from the device are no longer recorded, so employees using it stop getting attendance\nfrom it. The removal is recorded in the audit log. Not offered to Claude: it stops attendance collection at a\nlocation.","x-summary-ar":"حذف جهاز حضور","x-description-ar":"يحذف جهازاً من الشركة، فيتوقف QHR عن قبول بصماته. تبقى البصمات التي أرسلها وروابط الموظفين لأنها دليل الحضور\nالسابق. يمكن تسجيل الجهاز نفسه لاحقاً عبر `attendance_devices.create`.\n\n**متى تستخدمه:** عند إيقاف جهاز عن العمل أو استبداله بجهاز جديد.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list`.\n\n**الآثار الجانبية:** لا تُسجَّل بصمات الجهاز بعد ذلك، فيتوقف حضور الموظفين الذين يستخدمونه عن الوصول منه.\nيُسجَّل الحذف في سجل التدقيق. لا تُعرض على Claude لأنها توقف جمع الحضور في موقع.","x-access":"write","x-permission":{"key":"attendance_device/manage","label":"Connect, edit and remove attendance devices","x-label-ar":"ربط أجهزة الحضور وتعديلها وحذفها"},"x-feature":"attendance_device","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_id"}],"responses":{"204":{"description":"Removed.","x-description-ar":"حُذف الجهاز."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_devices/{id}/connection":{"get":{"summary":"Check whether a device has connected","operationId":"attendance_devices.connection","tags":["Attendance devices"],"description":"Returns just a device's connection state, its last contact and last scan, and how many scans it has sent in\ntotal. This is what the setup screen polls while IT enters the server address on the device.\n\n**When to use:** right after `attendance_devices.create`, to see whether the device has called QHR yet\n(`connection_state` leaves `awaiting_connection`), or to check quickly that a device is still sending.\nFor the full record use `attendance_devices.show`.\n\n**Prerequisites:** the device `id`, from `attendance_devices.list` or `attendance_devices.create`.\n\n**Side effects:** none.","x-summary-ar":"التحقق من اتصال جهاز","x-description-ar":"يعيد حالة اتصال الجهاز فقط، وآخر اتصال وآخر بصمة، وعدد البصمات التي أرسلها إجمالاً. هذا ما تستعلم عنه شاشة\nالإعداد بشكل متكرر بينما يُدخل فريق تقنية المعلومات عنوان الخادم في الجهاز.\n\n**متى تستخدمه:** بعد `attendance_devices.create` مباشرة لمعرفة هل اتصل الجهاز بـ QHR (تتغير\n`connection_state` عن `awaiting_connection`)، أو للتحقق سريعاً من أن جهازاً ما زال يرسل. للسجل الكامل استخدم\n`attendance_devices.show`.\n\n**المتطلبات:** رقم `id` الجهاز من `attendance_devices.list` أو `attendance_devices.create`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_device/view","label":"View attendance devices","x-label-ar":"عرض أجهزة الحضور"},"x-feature":"attendance_device","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_device_id"}],"responses":{"200":{"description":"The connection state.","x-description-ar":"حالة الاتصال.","content":{"application/json":{"example":{"connection_state":"online","last_contact_at":"2026-11-26T08:41:00Z","last_movement_at":"2026-11-26T05:02:13Z","movements_received":1284},"schema":{"type":"object","properties":{"connection_state":{"type":"string","description":"`awaiting_connection`, `online`, `offline` or `disabled`.","x-description-ar":"`awaiting_connection` أو `online` أو `offline` أو `disabled`.","enum":["awaiting_connection","online","offline","disabled"]},"last_contact_at":{"type":"string","description":"Last contact, UTC.","x-description-ar":"آخر اتصال بتوقيت UTC.","format":"date-time","nullable":true},"last_movement_at":{"type":"string","description":"Latest scan, UTC.","x-description-ar":"آخر بصمة بتوقيت UTC.","format":"date-time","nullable":true},"movements_received":{"type":"integer","description":"Scans received from the device, ever.","x-description-ar":"عدد البصمات المستلمة من الجهاز منذ ربطه."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/attendance_profile_assignments":{"post":{"summary":"Move employees to another attendance profile","operationId":"attendance_profiles.assign","tags":["Attendance profiles"],"description":"Moves the selected employees onto one profile from the same date. All or nothing: if any employee is\nrefused, nobody is moved, and the answer lists every refused employee and why in `errors`\n(`employee_id`, `employee_name`, `error`).\n\nThe move starts tomorrow at the earliest, and never on a date a payroll run already covers. An employee who\nalready has a change starting that exact date has it replaced; past assignments are never changed.\n\n**When to use:** to put a group (a branch, a department, a new shift) on a profile. Call\n`attendance_profiles.preview_assignment` first to see each employee's current profile. For one employee,\n`attendance_profiles.change_employee_profile` does the same.\n\n**Prerequisites:** the profile's `id` from `attendance_profiles.list`; employee ids from `employees.list`\n(1 to 500). An unknown id answers 404 and moves nobody.\n\n**Side effects:** saves a profile change per employee, and recounts the upcoming leave (pending, and\napproved but not started) of every employee whose profile actually changed. Not offered to Claude, because\nit changes the schedules and leave counts of many people at once.","x-summary-ar":"نقل موظفين إلى ملف حضور آخر","x-description-ar":"ينقل الموظفين المحددين إلى ملف واحد ابتداءً من التاريخ نفسه. الكل أو لا شيء: إن رُفض أي موظف لا يُنقل أحد،\nوتذكر الإجابة في `errors` كل موظف مرفوض وسبب رفضه (`employee_id` و`employee_name` و`error`).\n\nيبدأ النقل غداً على الأقرب، ولا يكون في تاريخ تغطيه مسيرة رواتب. الموظف الذي لديه تغيير يبدأ في التاريخ نفسه\nيُستبدل تغييره، ولا تُمس التعيينات السابقة أبداً.\n\n**متى تستخدمه:** لوضع مجموعة (فرع أو قسم أو وردية جديدة) على ملف. استدعِ `attendance_profiles.preview_assignment`\nأولاً لمعرفة الملف الحالي لكل موظف. ولموظف واحد تؤدي `attendance_profiles.change_employee_profile` الغرض نفسه.\n\n**المتطلبات:** رقم `id` الملف من `attendance_profiles.list`، وأرقام الموظفين من `employees.list` (من ١ إلى\n٥٠٠). الرقم غير الموجود يُرجع 404 ولا يُنقل أحد.\n\n**الآثار الجانبية:** يحفظ تغيير ملف لكل موظف، ويعيد احتساب الإجازات القادمة (المعلّقة، والمعتمدة التي لم تبدأ)\nلكل موظف تغيّر ملفه فعلاً. لا يُعرض على Claude لأنه يغيّر جداول عدد كبير من الأشخاص وأرصدة إجازاتهم دفعة واحدة.","x-access":"write","x-permission":{"key":"attendance_profile/assign","label":"Assign profiles to employees","x-label-ar":"إسناد ملفات الحضور للموظفين"},"x-feature":"attendance_profile","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The employees moved.","x-description-ar":"الموظفون الذين نُقلوا.","content":{"application/json":{"example":{"employees":[{"employee_id":1203,"assignment_id":418,"effective_from":"2026-12-01","changed":true},{"employee_id":1204,"assignment_id":419,"effective_from":"2026-12-01","changed":true}]},"schema":{"$ref":"#/components/schemas/attendance_profile_assignment_result"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"Nobody was moved.","x-description-ar":"لم يُنقل أحد.","x-codes":[{"code":"validation_failed","meaning":"No employees, more than 500, a start date today or earlier, or some employees were refused (a payroll run covers the date); `errors` lists them.","x-meaning-ar":"لا موظفين، أو أكثر من ٥٠٠، أو تاريخ بدء هو اليوم أو قبله، أو رُفض بعض الموظفين (مسيرة رواتب تغطي التاريخ)؛ ويذكرهم `errors`.","x-fix":"Fix the selection or the date, or revert the payroll run, then send again.","x-fix-ar":"صحّح الاختيار أو التاريخ، أو تراجع عن مسيرة الرواتب، ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Select at least one employee.","code":"validation_failed","errors":[]}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_profile_assignment_input"},"example":{"attendance_profile_assignment":{"attendance_setting_id":5,"employee_ids":[1203,1204],"effective_from":"2026-12-01"}}}},"required":true,"description":"Who moves, where and from when."}}},"/attendance_profile_assignments/preview":{"post":{"summary":"Preview moving employees to another profile","operationId":"attendance_profiles.preview_assignment","tags":["Attendance profiles"],"description":"Shows, for each selected employee, the profile they are on today, the profile they would move to, and\nwhether a change already starts on that date (it would be replaced). Nothing is saved.\n\n**When to use:** before `attendance_profiles.assign`, to show HR what the move would do and catch employees\nwho already have a change on that date.\n\n**Prerequisites:** the profile's `id` from `attendance_profiles.list`, the employees' ids from\n`employees.list`. The start date must be tomorrow or later; 1 to 500 employees. Needs the same permission\nas the move itself. A read-only token may call it: it is a POST only to carry up to 500 ids.\n\n**Side effects:** none. An unknown profile or employee id answers 404; an unreadable date answers 400.","x-summary-ar":"معاينة نقل موظفين إلى ملف حضور آخر","x-description-ar":"يعرض لكل موظف محدد الملف الذي يتبعه اليوم والملف الذي سيُنقل إليه، وهل هناك تغيير يبدأ في التاريخ نفسه\n(وسيُستبدل). لا يُحفظ شيء.\n\n**متى تستخدمه:** قبل `attendance_profiles.assign` لتطلع الموارد البشرية على أثر النقل وتكتشف الموظفين الذين\nلديهم تغيير في التاريخ نفسه.\n\n**المتطلبات:** رقم `id` الملف من `attendance_profiles.list`، وأرقام الموظفين من `employees.list`. يجب أن يكون\nتاريخ البدء غداً أو بعده، ومن موظف واحد إلى ٥٠٠ موظف. تحتاج الصلاحية نفسها التي يحتاجها النقل. ويمكن استدعاؤه برمز\nللقراءة فقط: هو POST فقط لحمل حتى ٥٠٠ رقم.\n\n**الآثار الجانبية:** لا شيء. رقم ملف أو موظف غير موجود يُرجع 404، والتاريخ غير المقروء يُرجع 400.","x-access":"read","x-permission":{"key":"attendance_profile/assign","label":"Assign profiles to employees","x-label-ar":"إسناد ملفات الحضور للموظفين"},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"What the move would do.","x-description-ar":"أثر النقل.","content":{"application/json":{"example":{"effective_from":"2026-12-01","employees":[{"employee_id":1203,"employee_name":"Sara Ahmed","current_profile":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي"},"new_profile":{"id":5,"name":"Night shift","name_en":"Night shift","name_ar":"الوردية الليلية"},"replaces_existing_change":false,"existing_change":null}]},"schema":{"$ref":"#/components/schemas/attendance_profile_assignment_preview"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The move cannot be previewed.","x-description-ar":"لا يمكن معاينة النقل.","x-codes":[{"code":"validation_failed","meaning":"No employees were selected, more than 500 were, or the start date is today or earlier.","x-meaning-ar":"لم يُحدد أي موظف، أو حُدد أكثر من ٥٠٠، أو تاريخ البدء هو اليوم أو قبله.","x-fix":"Select 1 to 500 employees and a start date from tomorrow on.","x-fix-ar":"حدد من موظف واحد إلى ٥٠٠ موظف وتاريخ بدء من الغد فصاعداً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A profile change can start tomorrow at the earliest.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_profile_assignment_input"},"example":{"attendance_profile_assignment":{"attendance_setting_id":3,"employee_ids":[1203,1204],"effective_from":"2026-12-01"}}}},"required":true,"description":"The move to preview."}}},"/attendance_schedule":{"get":{"summary":"Get the weekly schedule of employees","operationId":"attendance_profiles.schedule","tags":["Attendance profiles"],"description":"Returns the schedule grid: one page of active employees, ordered by name, across one week from Sunday to\nSaturday. Each day says which profile applies, whether it is a working day, a day off, a public holiday\nor approved leave, the shift window or scheduled hours, and whether it is locked (today, past days and\ndays of approved leave cannot be changed any more).\n\nWith the \"View attendance reports\" permission each day also carries the hours worked against the hours\nrequired, and each row and the page carry week totals (`hours`, `page_summary`) over the days already\ncompleted. Without it those keys are left out.\n\n**When to use:** to see who works when in a given week, or to check a team's hours against their schedule.\nFor one employee's profile and its next change, `attendance_profiles.employee_profile` is lighter.\n\n**Prerequisites:** none. Filter ids come from `employees.meta_data` (`locations`, `departments`) and\n`attendance_profiles.list`.\n\n**Side effects:** none. Up to 50 employees per page.","x-summary-ar":"عرض جدول الدوام الأسبوعي للموظفين","x-description-ar":"يعرض جدول الدوام: صفحة من الموظفين النشطين مرتبين بالاسم على مدى أسبوع من الأحد إلى السبت. يبيّن كل يوم\nالملف المطبق، وهل هو يوم عمل أو راحة أو عطلة رسمية أو إجازة معتمدة، ونافذة الوردية أو الساعات المجدولة،\nوهل هو مقفل (اليوم الحالي والأيام الماضية وأيام الإجازة المعتمدة لم يعد تغييرها ممكناً).\n\nمع صلاحية «عرض تقارير الحضور» يتضمن كل يوم أيضاً الساعات المعمولة مقابل المطلوبة، ويتضمن كل صف وكل صفحة\nمجاميع الأسبوع (`hours` و`page_summary`) للأيام المكتملة. وبدونها لا تظهر هذه المفاتيح.\n\n**متى تستخدمه:** لمعرفة من يعمل ومتى في أسبوع معين، أو لمقارنة ساعات فريق بجدولهم. لملف موظف واحد وتغييره\nالقادم، `attendance_profiles.employee_profile` أخف.\n\n**المتطلبات:** لا شيء. أرقام التصفية من `employees.meta_data` (`locations` و`departments`) ومن\n`attendance_profiles.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ موظفاً في الصفحة.","x-access":"read","x-permission":{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"week_start","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Any date in the week to show (`YYYY-MM-DD`); the grid starts on that week's Sunday. This week when omitted.","x-description-ar":"أي تاريخ في الأسبوع المطلوب (`YYYY-MM-DD`)؛ يبدأ الجدول بيوم الأحد من ذلك الأسبوع. الأسبوع الحالي إن لم يُرسل.","example":"2026-11-22"},{"name":"location_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees at this location, main or additional (id from `employees.meta_data`).","x-description-ar":"الموظفون في هذا الموقع فقط، رئيسياً أو إضافياً (الرقم من `employees.meta_data`).","example":2},{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department (id from `employees.meta_data`).","x-description-ar":"قسم محدد فقط (الرقم من `employees.meta_data`).","example":4},{"name":"attendance_setting_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees on this profile at the start of the week (id from `attendance_profiles.list`).","x-description-ar":"الموظفون المسجلون على هذا الملف في بداية الأسبوع فقط (الرقم من `attendance_profiles.list`).","example":3},{"name":"q[employee_name_or_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name or employee number contains.","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على.","example":"Sara"}],"responses":{"200":{"description":"One week of the schedule.","x-description-ar":"أسبوع من جدول الدوام.","content":{"application/json":{"example":{"week_start":"2026-11-22","records":[{"employee":{"id":1203,"name":"Sara Ahmed","employee_no":"E-0042"},"cells":[{"date":"2026-11-22","profile":{"id":3,"name":"Head office"},"kind":"working","window":{"start":"08:00","end":"16:00"},"shift_kind":null,"scheduled_hours":8.0,"location_id":null,"locked":true,"required_hours":8.0,"worked_hours":8.25,"status":"present","met":true},{"date":"2026-11-27","profile":{"id":3,"name":"Head office"},"kind":"day_off","window":null,"shift_kind":null,"scheduled_hours":null,"location_id":null,"locked":true,"required_hours":0.0,"worked_hours":null,"status":null,"met":null}],"hours":{"worked_hours":38.5,"required_hours":38.0,"full_week_required_hours":38.0,"percent":101,"status":"met"}}],"page_summary":{"worked_hours":38.5,"required_hours":38.0,"percent":101},"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_profile_schedule"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_schedule/export":{"get":{"summary":"Download the work schedule for a period as Excel or CSV","operationId":"attendance_profiles.schedule_export","tags":["Attendance profiles"],"description":"Builds a spreadsheet of the schedule grid of `attendance_profiles.schedule` for a period: one row per employee per day, with the profile, the kind of day (working, day off, holiday, leave) and the shift. With \"View attendance reports\" it also carries the required and worked hours. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** to hand a manager or HR the schedule of a month. To read one week, `attendance_profiles.schedule` is lighter.\n\n**Prerequisites:** at least one column key from `attendance_profiles.schedule_export_columns`. Needs the HR data export permission.\n`from` and `to` are required, a period of at most 31 days counting both ends, so `to` is at most 30 days after `from` (otherwise 400 `bad_filters`). Ids for the filters come from `employees.meta_data` and `attendance_profiles.list`.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل جدول العمل لفترة بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـجدول `attendance_profiles.schedule` لفترة: صف لكل موظف في كل يوم، مع الملف ونوع اليوم (عمل، راحة، عطلة رسمية، إجازة) والوردية. ومع «عرض تقارير الحضور» يضم أيضاً الساعات المطلوبة والفعلية. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** لتسليم مدير أو الموارد البشرية جدول شهر. لقراءة أسبوع واحد `attendance_profiles.schedule` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `attendance_profiles.schedule_export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\n`from` و`to` مطلوبان، والفترة ٣١ يوماً على الأكثر شاملةً الطرفين، أي أن `to` بعد `from` بـ ٣٠ يوماً على الأكثر (وإلا 400 `bad_filters`). أرقام المرشحات من `employees.meta_data` و`attendance_profiles.list`.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"}]},"x-feature":"attendance_profile","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `attendance_profiles.schedule_export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `attendance_profiles.schedule_export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["employee_no","name","date","weekday","profile","day_type","shift"]},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day of the period.","x-description-ar":"أول يوم في الفترة.","example":"2026-11-01"},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day of the period, at most 30 days after `from` (31 days counting both ends).","x-description-ar":"آخر يوم في الفترة، بعد `from` بـ ٣٠ يوماً على الأكثر (٣١ يوماً شاملةً الطرفين).","example":"2026-11-30"},{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department.","x-description-ar":"هذا القسم فقط.","example":4},{"name":"location_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this location.","x-description-ar":"هذا الموقع فقط.","example":2},{"name":"attendance_setting_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees on this profile on the period's first day.","x-description-ar":"الموظفون على هذا الملف في أول يوم من الفترة فقط.","example":3},{"name":"q[employee_name_or_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name or employee number contains.","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على.","example":"Sara"}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"attendance_schedule","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي سجل.","x-fix":"Widen the filters or the period.","x-fix-ar":"وسّع المرشحات أو الفترة."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters or shorten the period.","x-fix-ar":"ضيّق المرشحات أو قصّر الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/attendance_schedule/export/columns":{"get":{"summary":"List the columns of the work schedule export","operationId":"attendance_profiles.schedule_export_columns","tags":["Attendance profiles"],"description":"Lists the columns you may put in `attendance_profiles.schedule_export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `attendance_profiles.schedule_export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير جدول العمل","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `attendance_profiles.schedule_export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `attendance_profiles.schedule_export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"}]},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"employee_no","label":"Employee number","default":true,"type":"string"},{"key":"name","label":"Name","default":true,"type":"string"},{"key":"date","label":"Date","default":true,"type":"date"},{"key":"profile","label":"Profile","default":true,"type":"string"},{"key":"day_type","label":"Day type","default":true,"type":"enum"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_settings":{"get":{"summary":"List attendance profiles","operationId":"attendance_profiles.list","tags":["Attendance profiles"],"description":"Returns the company's attendance profiles, newest first. Each one carries its working hours, days off,\nday shifts, grace period and request rules, and how many employees are on it today.\n\n**When to use:** to see which working-time rules exist, or to find a profile's `id` for the other profile\noperations and for moving employees between profiles.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 profiles per page.","x-summary-ar":"عرض قائمة ملفات الحضور","x-description-ar":"يعرض ملفات الحضور في الشركة، الأحدث أولاً. يتضمن كل ملف ساعات العمل وأيام الراحة وورديات الأيام وفترة\nالسماح وقواعد الطلبات، وعدد الموظفين المسجلين عليه اليوم.\n\n**متى تستخدمه:** لمعرفة قواعد وقت العمل الموجودة، أو للحصول على رقم `id` الملف الذي تحتاجه عمليات الملفات\nالأخرى ونقل الموظفين بين الملفات.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ ملفاً في الصفحة.","x-access":"read","x-permission":{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of profiles.","x-description-ar":"صفحة من ملفات الحضور.","content":{"application/json":{"example":{"records":[{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_profile_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create an attendance profile","operationId":"attendance_profiles.create","tags":["Attendance profiles"],"description":"Creates a set of working-time rules: working hours, days off, optional per-weekday shifts, grace period,\nwhen a missing check-in becomes an absence, break tracking, and whether employees may ask for corrections\nand permissions. A new profile has nobody on it until employees are moved onto it.\n\n**When to use:** when a group of employees works on different rules from the existing profiles (a night\nshift, a branch with another weekend). To move people onto it afterwards, use `attendance_profiles.assign`.\n\n**Prerequisites:** a unique English and Arabic name. Location ids for day shifts come from\n`employees.meta_data` (`locations`). Send `days_off`: when omitted on create the profile has no day off.\n\n**Side effects:** recorded in the audit log. With `is_default: true` the profile replaces the company\ndefault, and the upcoming leave of every employee who falls back to the default is recounted with its days\noff. Not offered to Claude, because it sets how attendance and leave are counted for the whole company.","x-summary-ar":"إنشاء ملف حضور","x-description-ar":"ينشئ مجموعة من قواعد وقت العمل: ساعات الدوام وأيام الراحة وورديات اختيارية لأيام الأسبوع وفترة السماح ومتى\nيتحول عدم تسجيل الحضور إلى غياب وتتبع الاستراحات، وهل يمكن للموظفين طلب التصحيح والاستئذان. لا يكون على الملف\nالجديد أي موظف حتى يُنقل إليه.\n\n**متى تستخدمه:** عندما تعمل مجموعة من الموظفين بقواعد تختلف عن الملفات الحالية (وردية ليلية، أو فرع بعطلة\nأسبوعية مختلفة). لنقل الموظفين إليه بعد ذلك استخدم `attendance_profiles.assign`.\n\n**المتطلبات:** اسم فريد بالإنجليزية والعربية. أرقام المواقع لورديات الأيام من `employees.meta_data`\n(`locations`). أرسل `days_off`: إن لم يُرسل عند الإنشاء فلن يكون في الملف يوم راحة.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. ومع `is_default: true` يحل الملف محل الملف الافتراضي للشركة،\nويُعاد احتساب الإجازات القادمة لكل موظف يتبع الافتراضي بأيام الراحة الجديدة. لا يُعرض على Claude لأنه يحدد\nطريقة احتساب الحضور والإجازات للشركة كلها.","x-access":"write","x-permission":{"key":"attendance_profile/create","label":"Add attendance profiles","x-label-ar":"إضافة ملف حضور"},"x-feature":"attendance_profile","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new profile.","x-description-ar":"الملف الجديد.","content":{"application/json":{"example":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"schema":{"$ref":"#/components/schemas/attendance_profile"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The profile was refused.","x-description-ar":"رُفض الملف.","x-codes":[{"code":"validation_failed","meaning":"A field is missing or breaks a rule: a name already used, start and end equal, hours out of range, all seven days off, a rigid day shift whose hours differ from the daily target, two shifts on one weekday or a shift on a day off.","x-meaning-ar":"حقل ناقص أو يخالف قاعدة: اسم مستخدم، أو بداية ونهاية متساويتان، أو ساعات خارج النطاق، أو الأيام السبعة كلها راحة، أو وردية ثابتة ساعاتها لا تساوي الساعات اليومية، أو ورديتان في يوم واحد، أو وردية في يوم راحة.","x-fix":"Fix the field named in `error` and send again.","x-fix-ar":"صحّح الحقل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_setting"],"properties":{"attendance_setting":{"$ref":"#/components/schemas/attendance_profile_input"}}},"example":{"attendance_setting":{"name_en":"Head office","name_ar":"المكتب الرئيسي","work_start_time":"08:00","work_end_time":"16:00","daily_target_hours":8,"days_off":[5,6],"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"day_shifts_attributes":[{"name":"Short Thursday","day_of_week":4,"kind":"flexible","required_hours":6}]}}}},"required":true,"description":"The new profile."}}},"/attendance_settings/export":{"get":{"summary":"Download the attendance profiles as Excel or CSV","operationId":"attendance_profiles.export","tags":["Attendance profiles"],"description":"Builds a spreadsheet of every attendance profile of the company, as `attendance_profiles.list` shows them: name, working days and days off, shift times, weekly target hours and how many employees each has. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** to hand someone a file of the company's working schedules. To answer a question, `attendance_profiles.list` is lighter.\n\n**Prerequisites:** at least one column key from `attendance_profiles.export_columns`. Needs the HR data export permission.\nThere are no filters: the file always holds every profile.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل ملفات الحضور بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـكل ملفات الحضور في الشركة كما يعرضها `attendance_profiles.list`: الاسم وأيام العمل والراحة وأوقات الوردية والساعات الأسبوعية المستهدفة وعدد الموظفين في كل ملف. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** لتسليم أحدهم ملفاً بجداول العمل في الشركة. للإجابة عن سؤال `attendance_profiles.list` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `attendance_profiles.export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\nلا توجد مرشحات: يضم الملف كل الملفات دائماً.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"}]},"x-feature":"attendance_profile","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `attendance_profiles.export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `attendance_profiles.export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["name","days_off","employees","weekly_hours"]}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"attendance_profiles","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}}}}},"/attendance_settings/export/columns":{"get":{"summary":"List the columns of the attendance profiles export","operationId":"attendance_profiles.export_columns","tags":["Attendance profiles"],"description":"Lists the columns you may put in `attendance_profiles.export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `attendance_profiles.export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير ملفات الحضور","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `attendance_profiles.export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `attendance_profiles.export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"}]},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"name","label":"Name","default":true,"type":"string"},{"key":"days_off","label":"Days off","default":true,"type":"string"},{"key":"employees","label":"Employees","default":true,"type":"integer"},{"key":"weekly_hours","label":"Weekly hours","default":true,"type":"number"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendance_settings/{id}":{"get":{"summary":"Get an attendance profile","operationId":"attendance_profiles.show","tags":["Attendance profiles"],"description":"Returns one attendance profile: working hours, days off, weekly targets, day shifts, grace period,\nabsence rule, break tracking, correction and permission request rules, and how many employees are on it\ntoday. Times are wall-clock times in the company's timezone (`attendance_calendar.show`).\n\n**When to use:** to answer what an employee's working day looks like, or before\n`attendance_profiles.update` to read the current values and the day shift ids.\n\n**Prerequisites:** the profile's `id`, from `attendance_profiles.list` or the `current` profile of\n`attendance_profiles.employee_profile`.\n\n**Side effects:** none.","x-summary-ar":"عرض ملف حضور","x-description-ar":"يعرض ملف حضور واحداً: ساعات العمل وأيام الراحة والساعات المستهدفة أسبوعياً وورديات الأيام وفترة السماح\nوقاعدة الغياب وتتبع الاستراحات وقواعد طلبات التصحيح والاستئذان، وعدد الموظفين المسجلين عليه اليوم. الأوقات\nساعات حائط بتوقيت الشركة (`attendance_calendar.show`).\n\n**متى تستخدمه:** لمعرفة شكل يوم العمل لموظف ما، أو قبل `attendance_profiles.update` لقراءة القيم الحالية\nوأرقام ورديات الأيام.\n\n**المتطلبات:** رقم `id` الملف من `attendance_profiles.list` أو من الملف `current` في\n`attendance_profiles.employee_profile`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_id"}],"responses":{"200":{"description":"The profile.","x-description-ar":"ملف الحضور.","content":{"application/json":{"example":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"schema":{"$ref":"#/components/schemas/attendance_profile"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Update an attendance profile","operationId":"attendance_profiles.update","tags":["Attendance profiles"],"description":"Changes the fields you send; the rest stay as they are. Day shifts are added, changed (with their `id`) or\nremoved (`_destroy: true`) through `day_shifts_attributes`.\n\nA change to the days off or day shifts applies from tomorrow: today keeps the schedule it started with, so\ncheck-ins already judged today are not restated. A profile created today changes at once.\n\n**When to use:** to change working hours, days off, the grace period or request rules for everyone on a\nprofile. To move one employee to another profile instead, use `attendance_profiles.change_employee_profile`.\n\n**Prerequisites:** the profile's `id` from `attendance_profiles.list`; read the current values and day shift\nids with `attendance_profiles.show`.\n\n**Side effects:** recorded in the audit log. When the days off change, or the profile becomes the default,\nthe upcoming leave (pending, and approved but not started) of every employee it governs is recounted with\nthe new days off. Not offered to Claude, because it changes how attendance and leave are counted for\neveryone on the profile.","x-summary-ar":"تعديل ملف حضور","x-description-ar":"يعدّل الحقول التي ترسلها فقط ويترك الباقي كما هو. تُضاف ورديات الأيام أو تُعدّل (برقم `id`) أو تُحذف\n(`_destroy: true`) عبر `day_shifts_attributes`.\n\nتغيير أيام الراحة أو ورديات الأيام يسري من الغد: يبقى اليوم الحالي على الجدول الذي بدأ به، فلا يُعاد تقييم\nتسجيلات الحضور التي احتُسبت اليوم. أما الملف المنشأ اليوم فيتغير فوراً.\n\n**متى تستخدمه:** لتغيير ساعات الدوام أو أيام الراحة أو فترة السماح أو قواعد الطلبات لكل المسجلين على الملف.\nلنقل موظف واحد إلى ملف آخر استخدم `attendance_profiles.change_employee_profile`.\n\n**المتطلبات:** رقم `id` الملف من `attendance_profiles.list`؛ اقرأ القيم الحالية وأرقام ورديات الأيام عبر\n`attendance_profiles.show`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. عند تغيير أيام الراحة أو جعل الملف افتراضياً، يُعاد احتساب\nالإجازات القادمة (المعلّقة، والمعتمدة التي لم تبدأ) لكل موظف يتبعه بأيام الراحة الجديدة. لا يُعرض على Claude\nلأنه يغيّر طريقة احتساب الحضور والإجازات لكل المسجلين على الملف.","x-access":"write","x-permission":{"key":"attendance_profile/edit","label":"Edit attendance profiles","x-label-ar":"تعديل ملف حضور"},"x-feature":"attendance_profile","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_id"}],"responses":{"200":{"description":"The profile after the change.","x-description-ar":"الملف بعد التعديل.","content":{"application/json":{"example":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"schema":{"$ref":"#/components/schemas/attendance_profile"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"A field breaks a rule (see `attendance_profiles.create`), or `is_default: false` was sent for the default profile.","x-meaning-ar":"حقل يخالف قاعدة (انظر `attendance_profiles.create`)، أو أُرسل `is_default: false` للملف الافتراضي.","x-fix":"Fix the field named in `error`. To change the default, make another profile the default.","x-fix-ar":"صحّح الحقل المذكور في `error`. لتغيير الافتراضي اجعل ملفاً آخر هو الافتراضي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Days off must leave at least one working day","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_setting"],"properties":{"attendance_setting":{"$ref":"#/components/schemas/attendance_profile_input"}}},"example":{"attendance_setting":{"grace_period_minutes":10,"days_off":[5]}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete an attendance profile","operationId":"attendance_profiles.delete","tags":["Attendance profiles"],"description":"Deletes an attendance profile and its day shifts. Only a profile nobody uses can go: one that an employee is\nor was assigned to (now, in the past or from a future date), or the company default, is refused.\n\n**When to use:** to remove a profile created by mistake or no longer used. Move its employees to another\nprofile first with `attendance_profiles.assign`.\n\n**Prerequisites:** the profile's `id` from `attendance_profiles.list`; `assigned_employees_count` there\nshows who is on it today.\n\n**Side effects:** the profile is gone for good; recorded in the audit log. Not offered to Claude, because\nit cannot be undone.","x-summary-ar":"حذف ملف حضور","x-description-ar":"يحذف ملف حضور ووردياته. لا يُحذف إلا ملف لا يستخدمه أحد: يُرفض حذف ملف نُقل إليه موظف (حالياً أو سابقاً أو من\nتاريخ قادم)، أو الملف الافتراضي للشركة.\n\n**متى تستخدمه:** لإزالة ملف أُنشئ خطأً أو لم يعد مستخدماً. انقل موظفيه إلى ملف آخر أولاً عبر\n`attendance_profiles.assign`.\n\n**المتطلبات:** رقم `id` الملف من `attendance_profiles.list`، ويبيّن `assigned_employees_count` فيه من يتبعه\nاليوم.\n\n**الآثار الجانبية:** يُحذف الملف نهائياً ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه لا يمكن التراجع عنه.","x-access":"write","x-permission":{"key":"attendance_profile/delete","label":"Delete attendance profiles","x-label-ar":"حذف ملف حضور"},"x-feature":"attendance_profile","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_id"}],"responses":{"204":{"description":"Deleted; no body.","x-description-ar":"حُذف؛ بلا محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The profile cannot be deleted.","x-description-ar":"لا يمكن حذف الملف.","x-codes":[{"code":"validation_failed","meaning":"The profile is the company default, or employees are or will be on it.","x-meaning-ar":"الملف هو الافتراضي للشركة، أو عليه موظفون حالياً أو مستقبلاً.","x-fix":"Make another profile the default, or move its employees with `attendance_profiles.assign`.","x-fix-ar":"اجعل ملفاً آخر هو الافتراضي، أو انقل موظفيه عبر `attendance_profiles.assign`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot delete record because dependent employee attendance assignments exist","code":"validation_failed"}}}}}}},"/attendances/check_in":{"post":{"summary":"Check in for today","operationId":"attendances.check_in","tags":["Attendance"],"description":"Records the token owner's arrival now, exactly like the Check in button of the QHR app. The day is the work\ndate in the company's timezone (a check-in shortly after midnight on a night shift belongs to the shift\nthat started the evening before). QHR compares the time with the employee's schedule: after the shift\nstart plus the grace period the day is `late`, and a late-arrival deduction is opened for review.\n\n**When to use:** when the person says they have arrived and wants to check in. Check first with\n`attendances.check_in_status`. To record someone else's day, a manager uses `attendances.adjust`.\n\n**Prerequisites:** a token created by a user linked to an employee record. If `geo_fencing` in\n`attendances.check_in_status` requires coordinates, send `latitude` and `longitude`; a check-in from\noutside every allowed location or network is refused. The coordinates are the ones the client reports, so\na token check-in is only as trustworthy as the system holding the token. The punch channel shown in the\nattendance log is set by the server for API calls.\n\n**Side effects:** creates or updates today's attendance record with source `app`. A late arrival opens a\ntime incident that the manager or HR decides on (`time_incidents.list`) and may become a payroll deduction.\nOn a profile that tracks breaks, it starts the tracked day.","x-summary-ar":"تسجيل حضوري اليوم","x-description-ar":"يسجّل وصول صاحب الرمز الآن، تماماً كزر «تسجيل الحضور» في تطبيق QHR. اليوم هو تاريخ العمل بتوقيت الشركة\n(الحضور بعد منتصف الليل بقليل في وردية ليلية يتبع الوردية التي بدأت مساء اليوم السابق). يقارن QHR الوقت\nبجدول الموظف: بعد بداية الوردية وفترة السماح يصبح اليوم `late`، وتُفتح مخالفة تأخير للمراجعة.\n\n**متى تستخدمه:** عندما يقول الشخص إنه وصل ويريد تسجيل حضوره. تحقق أولاً عبر `attendances.check_in_status`.\nلتسجيل يوم شخص آخر يستخدم المدير `attendances.adjust`.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي. إن كان `geo_fencing` في `attendances.check_in_status`\nيتطلب الإحداثيات فأرسل `latitude` و`longitude`؛ ويُرفض الحضور من خارج كل المواقع والشبكات المسموحة. والإحداثيات هي ما\nيرسله العميل، فالحضور عبر الرمز موثوق بقدر موثوقية النظام الذي يحمل الرمز. وقناة\nالتسجيل الظاهرة في سجل الحضور يحددها الخادم لاستدعاءات الواجهة البرمجية.\n\n**الآثار الجانبية:** ينشئ سجل حضور اليوم أو يحدّثه بالمصدر `app`. التأخير يفتح مخالفة يقرر فيها المدير أو\nالموارد البشرية (`time_incidents.list`) وقد تصبح خصماً في الرواتب. وفي ملف يتتبع الاستراحات يبدأ اليوم المتتبَّع.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"Today's attendance record.","x-description-ar":"سجل حضور اليوم.","content":{"application/json":{"example":{"id":58231,"status":"late","date":"2026-11-02","check_in_at":"2026-11-02T06:22:00Z","check_out_at":null,"hours_worked":null,"check_in_source":"app","check_out_source":null,"check_in_device":null,"check_out_device":null,"incidents":[],"tracks_breaks":false,"day_state":null,"ended_by":null,"break_minutes":null,"breaks":[]},"schema":{"$ref":"#/components/schemas/attendance_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"The day was being updated by a device.","x-description-ar":"كان جهاز يحدّث اليوم.","x-codes":[{"code":"conflict","meaning":"A device was saving scans for the same day at that moment, so the action was not recorded.","x-meaning-ar":"كان جهاز يحفظ بصمات اليوم نفسه في تلك اللحظة، فلم يُسجَّل الإجراء.","x-fix":"Wait a few seconds and send the same request again.","x-fix-ar":"انتظر بضع ثوانٍ وأعد إرسال الطلب نفسه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Your attendance is updating. Try again in a moment.","code":"conflict"}}}},"422":{"description":"The check-in was refused.","x-description-ar":"رُفض تسجيل الحضور.","x-codes":[{"code":"validation_failed","meaning":"Refused: already checked in today, a previous shift is still open, outside every allowed location or network (`error` says how far), the day is closed for payroll, or HR corrected the day.","x-meaning-ar":"مرفوض: سُجّل الحضور اليوم مسبقاً، أو وردية سابقة ما زالت مفتوحة، أو خارج كل المواقع والشبكات المسموحة (يوضح `error` المسافة)، أو اليوم مغلق للرواتب، أو صحّحت الموارد البشرية اليوم.","x-fix":"Read `error`, then check the day with `attendances.check_in_status` before trying again.","x-fix-ar":"اقرأ `error` ثم راجع اليوم عبر `attendances.check_in_status` قبل المحاولة مجدداً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You have already checked in today.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"latitude":{"type":"number","description":"The person's latitude, when their location fences check-in (`geo_fencing.requires_coordinates`).","x-description-ar":"خط عرض موقع الشخص، إن كان موقعه يقيّد الحضور (`geo_fencing.requires_coordinates`)."},"longitude":{"type":"number","description":"The person's longitude, with `latitude`.","x-description-ar":"خط طول موقع الشخص، مع `latitude`."}}},"example":{"latitude":24.7136,"longitude":46.6753}}},"required":true,"description":"Where the person is, when their location requires it. Send `{}` otherwise."}}},"/attendances/check_in_status":{"get":{"summary":"Get my check-in status for today","operationId":"attendances.check_in_status","tags":["Attendance"],"description":"Tells where the token owner's current work day stands: whether they have checked in, when, how (app,\ndevice or manual correction), and whether they have checked out. On a profile that tracks breaks it also\ngives the live state (`working`, `paused`, `ended`), minutes worked and on break so far, and the day's breaks.\n`geo_fencing` says whether check-in is limited to certain locations and whether coordinates are needed.\n\n**When to use:** before `attendances.check_in`, `attendances.check_out`, `attendances.pause` or\n`attendances.resume`, to know which one makes sense now, or to answer \"did I check in today?\". \"Today\" is\nthe work date in the company's timezone; after midnight on a night shift it is still the shift's date.\n\n**Prerequisites:** a token created by a user who is linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"عرض حالة حضوري اليوم","x-description-ar":"يوضح وضع يوم العمل الحالي لصاحب الرمز: هل سجّل حضوره ومتى وكيف (من التطبيق أو جهاز أو بتصحيح يدوي)، وهل\nسجّل انصرافه. وفي ملف حضور يتتبع الاستراحات يعطي أيضاً الحالة الحية (`working` أو `paused` أو `ended`)\nودقائق العمل والاستراحة حتى الآن واستراحات اليوم. ويوضح `geo_fencing` هل الحضور مقيد بمواقع معينة وهل\nيلزم إرسال الإحداثيات.\n\n**متى تستخدمه:** قبل `attendances.check_in` أو `attendances.check_out` أو `attendances.pause` أو\n`attendances.resume` لمعرفة الإجراء المناسب الآن، أو للإجابة عن \"هل سجّلت حضوري اليوم؟\". \"اليوم\" هو تاريخ\nالعمل بتوقيت الشركة؛ وبعد منتصف الليل في وردية ليلية يبقى تاريخ بداية الوردية.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Today's status. The fields after `as_of` appear only when the day tracks breaks.","x-description-ar":"حالة اليوم. الحقول بعد `as_of` تظهر فقط إن كان اليوم يتتبع الاستراحات.","content":{"application/json":{"example":{"checked_in":true,"check_in_at":"2026-11-02T06:02:00Z","check_out_at":null,"already_checked_in_via":"app","device_name":null,"geo_fencing":null,"tracks_breaks":false,"state":"working","as_of":"2026-11-02T07:00:00Z"},"schema":{"$ref":"#/components/schemas/attendance_check_in_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/attendances/check_out":{"post":{"summary":"Check out","operationId":"attendances.check_out","tags":["Attendance"],"description":"Records the token owner's departure now on the day they checked in to, exactly like the Check out button of\nthe QHR app, and computes the hours worked. On a profile that tracks breaks this ends the day, like\n`attendances.end_day`.\n\n**When to use:** when the person says they are leaving. Check first with `attendances.check_in_status`.\n\n**Prerequisites:** a check-in on the current work day (`attendances.check_in`). Send `latitude` and\n`longitude` when the location fences check-out (`geo_fencing.enforced_on_check_out`).\n\n**Side effects:** saves the check-out with source `app` and the hours worked. Leaving before the shift end\nopens an early-leave time incident for review (`time_incidents.list`), which may become a payroll\ndeduction. A shift longer than QHR's limit is refused: the employee must ask for a correction instead.","x-summary-ar":"تسجيل انصرافي","x-description-ar":"يسجّل انصراف صاحب الرمز الآن في اليوم الذي سجّل حضوره فيه، تماماً كزر «تسجيل الانصراف» في تطبيق QHR،\nويحسب ساعات العمل. وفي ملف يتتبع الاستراحات ينهي اليوم مثل `attendances.end_day`.\n\n**متى تستخدمه:** عندما يقول الشخص إنه سيغادر. تحقق أولاً عبر `attendances.check_in_status`.\n\n**المتطلبات:** تسجيل حضور في يوم العمل الحالي (`attendances.check_in`). أرسل `latitude` و`longitude` إن كان\nالموقع يقيّد الانصراف (`geo_fencing.enforced_on_check_out`).\n\n**الآثار الجانبية:** يحفظ الانصراف بالمصدر `app` مع ساعات العمل. المغادرة قبل نهاية الوردية تفتح مخالفة خروج\nمبكر للمراجعة (`time_incidents.list`) قد تصبح خصماً في الرواتب. والوردية الأطول من حد QHR تُرفض: على الموظف\nطلب تصحيح بدلاً من ذلك.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The day with its check-out.","x-description-ar":"اليوم مع الانصراف.","content":{"application/json":{"example":{"id":58231,"status":"late","date":"2026-11-02","check_in_at":"2026-11-02T06:22:00Z","check_out_at":"2026-11-02T14:05:00Z","hours_worked":7.72,"check_in_source":"app","check_out_source":"device","check_in_device":null,"check_out_device":{"name":"Main gate","external_employee_no":"1042"},"incidents":[{"id":912,"kind":"late","status":"pending","justification_state":"none"}],"tracks_breaks":false,"day_state":null,"ended_by":null,"break_minutes":null,"breaks":[]},"schema":{"$ref":"#/components/schemas/attendance_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"The day was being updated by a device.","x-description-ar":"كان جهاز يحدّث اليوم.","x-codes":[{"code":"conflict","meaning":"A device was saving scans for the same day at that moment, so the action was not recorded.","x-meaning-ar":"كان جهاز يحفظ بصمات اليوم نفسه في تلك اللحظة، فلم يُسجَّل الإجراء.","x-fix":"Wait a few seconds and send the same request again.","x-fix-ar":"انتظر بضع ثوانٍ وأعد إرسال الطلب نفسه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Your attendance is updating. Try again in a moment.","code":"conflict"}}}},"422":{"description":"The check-out was refused.","x-description-ar":"رُفض تسجيل الانصراف.","x-codes":[{"code":"validation_failed","meaning":"Refused: no check-in today, the shift is too long to close automatically, outside the allowed locations, or the day is closed for payroll.","x-meaning-ar":"مرفوض: لا يوجد حضور اليوم، أو الوردية أطول من أن تُغلق تلقائياً، أو خارج المواقع المسموحة، أو اليوم مغلق للرواتب.","x-fix":"Read `error`, then check the day with `attendances.check_in_status` before trying again.","x-fix-ar":"اقرأ `error` ثم راجع اليوم عبر `attendances.check_in_status` قبل المحاولة مجدداً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No check-in found for today.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"latitude":{"type":"number","description":"The person's latitude, when their location fences check-in (`geo_fencing.requires_coordinates`).","x-description-ar":"خط عرض موقع الشخص، إن كان موقعه يقيّد الحضور (`geo_fencing.requires_coordinates`)."},"longitude":{"type":"number","description":"The person's longitude, with `latitude`.","x-description-ar":"خط طول موقع الشخص، مع `latitude`."}}},"example":{"latitude":24.7136,"longitude":46.6753}}},"required":true,"description":"Where the person is, when their location requires it. Send `{}` otherwise."}}},"/attendances/end_day":{"post":{"summary":"End my tracked work day","operationId":"attendances.end_day","tags":["Attendance"],"description":"Ends the token owner's tracked work day now, like the End day button of the QHR app: a running break is\nclosed, the check-out is recorded and the net hours worked are computed. On a profile that does not track\nbreaks, use `attendances.check_out`.\n\n**When to use:** when an employee on a break-tracking profile says they are done for the day.\n\n**Prerequisites:** a tracked day that is `working` or `paused` (`attendances.check_in_status`).\n\n**Side effects:** closes the day with source `app`. Leaving before the shift end, or working less than the\nrequired hours, opens a time incident for review (`time_incidents.list`) that may become a payroll\ndeduction. An ended day cannot be restarted from the app.","x-summary-ar":"إنهاء يوم عملي المتتبَّع","x-description-ar":"ينهي يوم العمل المتتبَّع لصاحب الرمز الآن، مثل زر «إنهاء اليوم» في تطبيق QHR: تُغلق أي استراحة جارية ويُسجَّل\nالانصراف وتُحسب صافي ساعات العمل. في ملف لا يتتبع الاستراحات استخدم `attendances.check_out`.\n\n**متى تستخدمه:** عندما يقول موظف ملفه يتتبع الاستراحات إنه أنهى يومه.\n\n**المتطلبات:** يوم متتبَّع حالته `working` أو `paused` (`attendances.check_in_status`).\n\n**الآثار الجانبية:** يُغلق اليوم بالمصدر `app`. المغادرة قبل نهاية الوردية أو العمل أقل من الساعات المطلوبة يفتح\nمخالفة للمراجعة (`time_incidents.list`) قد تصبح خصماً في الرواتب. لا يمكن إعادة بدء يوم منتهٍ من التطبيق.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The day's status, ended.","x-description-ar":"حالة اليوم، منتهٍ.","content":{"application/json":{"example":{"checked_in":true,"check_in_at":"2026-11-02T06:02:00Z","check_out_at":"2026-11-02T14:05:00Z","already_checked_in_via":"app","device_name":null,"geo_fencing":null,"tracks_breaks":true,"state":"ended","ended_by":"employee","ended_at":"2026-11-02T14:05:00Z","as_of":"2026-11-02T09:30:00Z","worked_minutes":463,"break_minutes":20,"allowed_break_minutes":60,"current_period_started_at":null,"paused_since":null,"breaks":[{"started_at":"2026-11-02T09:20:00Z","ended_at":"2026-11-02T09:40:00Z","started_via":"app","ended_via":"app","started_device_name":null,"ended_device_name":null}],"last_event":{"source":"app","device_name":null,"at":"2026-11-02T14:05:00Z"}},"schema":{"$ref":"#/components/schemas/attendance_check_in_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"Ending the day was refused.","x-description-ar":"رُفض إنهاء اليوم.","x-codes":[{"code":"validation_failed","meaning":"Refused: no open tracked day (not checked in, or breaks are not tracked), the day already ended, the location is not allowed, or the day is closed for payroll.","x-meaning-ar":"مرفوض: لا يوجد يوم متتبَّع مفتوح (لم يُسجَّل الحضور أو الاستراحات غير متتبَّعة)، أو انتهى اليوم، أو الموقع غير مسموح، أو اليوم مغلق للرواتب.","x-fix":"Read `error`, then check the day with `attendances.check_in_status` before trying again.","x-fix-ar":"اقرأ `error` ثم راجع اليوم عبر `attendances.check_in_status` قبل المحاولة مجدداً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You have not checked in today.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"latitude":{"type":"number","description":"The person's latitude, when their location fences check-in (`geo_fencing.requires_coordinates`).","x-description-ar":"خط عرض موقع الشخص، إن كان موقعه يقيّد الحضور (`geo_fencing.requires_coordinates`)."},"longitude":{"type":"number","description":"The person's longitude, with `latitude`.","x-description-ar":"خط طول موقع الشخص، مع `latitude`."}}},"example":{"latitude":24.7136,"longitude":46.6753}}},"required":true,"description":"Where the person is, when their location requires it. Send `{}` otherwise."}}},"/attendances/export":{"get":{"summary":"Download my attendance history as Excel or CSV","operationId":"attendances.export","tags":["Attendance"],"description":"Builds a spreadsheet of the token owner's own attendance days, the same rows `attendances.my_history` returns for the same filters: date, status, check-in and check-out (in the company's timezone), hours worked and the approved permissions of each day. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** when the person wants a file of their attendance, e.g. for a month. To answer a question, `attendances.my_history` is lighter.\n\n**Prerequisites:** at least one column key from `attendances.export_columns`. Needs the HR data export permission.\nA token created by a user linked to an employee record.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل سجل حضوري بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـأيام حضور صاحب الرمز، وهي الصفوف نفسها التي يعيدها `attendances.my_history` بالمرشحات نفسها: التاريخ والحالة ووقتا الحضور والانصراف (بتوقيت الشركة) وساعات العمل والاستئذانات المعتمدة لكل يوم. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** عندما يريد الشخص ملفاً بحضوره، مثلاً لشهر. للإجابة عن سؤال `attendances.my_history` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `attendances.export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\nرمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"}]},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `attendances.export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `attendances.export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["date","status","check_in_at","check_out_at","hours_worked"]},{"name":"q[date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"From this work date (inclusive).","x-description-ar":"من تاريخ العمل هذا (شاملاً).","example":"2026-10-01"},{"name":"q[date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Up to this work date (inclusive).","x-description-ar":"حتى تاريخ العمل هذا (شاملاً).","example":"2026-10-31"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["present","late","incomplete","absent","on_leave","holiday","weekend"]},"description":"Only days with this status.","x-description-ar":"الأيام بهذه الحالة فقط.","example":"late"}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"my_attendance","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي سجل.","x-fix":"Widen the filters or the period.","x-fix-ar":"وسّع المرشحات أو الفترة."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters or shorten the period.","x-fix-ar":"ضيّق المرشحات أو قصّر الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/attendances/export/columns":{"get":{"summary":"List the columns of the My attendance export","operationId":"attendances.export_columns","tags":["Attendance"],"description":"Lists the columns you may put in `attendances.export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `attendances.export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير سجل حضوري","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `attendances.export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `attendances.export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"}]},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"date","label":"Date","default":true,"type":"date"},{"key":"status","label":"Status","default":true,"type":"enum"},{"key":"check_in_at","label":"Check-in","default":true,"type":"datetime"},{"key":"check_out_at","label":"Check-out","default":true,"type":"datetime"},{"key":"hours_worked","label":"Hours worked","default":true,"type":"number"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/attendances/my_history":{"get":{"summary":"List my attendance history","operationId":"attendances.my_history","tags":["Attendance"],"description":"Returns the token owner's attendance, one row per work date, newest first: status (present, late, absent,\non leave, holiday, weekend…), check-in and check-out times and how each was recorded, hours worked, breaks,\nthe deductions the day produced (late arrival, early leave…) with whether a reason was given, and the\nhourly permissions that covered it.\n\n**When to use:** to answer \"when did I arrive last week?\", \"which days was I late?\" or \"do I have any\ndeductions to explain?\". Filter by date range and status. For today alone, `attendances.check_in_status`\nis lighter; for the hours of the current week, `attendances.weekly_summary`.\n\n**Prerequisites:** a token created by a user linked to an employee record. Dates are work dates in the\ncompany's timezone (`YYYY-MM-DD`); times are UTC.\n\n**Side effects:** none. Up to 50 days per page.","x-summary-ar":"عرض سجل حضوري","x-description-ar":"يعرض حضور صاحب الرمز، صفاً لكل تاريخ عمل، الأحدث أولاً: الحالة (حاضر، متأخر، غائب، في إجازة، عطلة رسمية،\nعطلة أسبوعية…) ووقتا الحضور والانصراف وطريقة تسجيل كل منهما، وساعات العمل، والاستراحات، والخصومات التي نتجت\nعن اليوم (تأخير، خروج مبكر…) وهل قُدّم لها مبرر، وطلبات الاستئذان التي غطّته.\n\n**متى تستخدمه:** للإجابة عن \"متى وصلت الأسبوع الماضي؟\" أو \"في أي الأيام تأخرت؟\" أو \"هل لدي خصومات تحتاج\nتبريراً؟\". صفِّ بنطاق التاريخ والحالة. لليوم وحده `attendances.check_in_status` أخف، ولساعات الأسبوع الحالي\n`attendances.weekly_summary`.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي. التواريخ تواريخ عمل بتوقيت الشركة (`YYYY-MM-DD`)\nوالأوقات بتوقيت UTC.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ يوماً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"From this work date (inclusive).","x-description-ar":"من تاريخ العمل هذا (شاملاً).","example":"2026-10-01"},{"name":"q[date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Up to this work date (inclusive).","x-description-ar":"حتى تاريخ العمل هذا (شاملاً).","example":"2026-10-31"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["present","late","incomplete","absent","on_leave","holiday","weekend"]},"description":"Only days with this status.","x-description-ar":"الأيام بهذه الحالة فقط.","example":"late"},{"name":"q[check_in_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Checked in at or after this time (ISO 8601).","x-description-ar":"سجّل الحضور في هذا الوقت أو بعده (ISO 8601).","example":"2026-10-01T00:00:00Z"},{"name":"q[check_out_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Checked out at or before this time (ISO 8601).","x-description-ar":"سجّل الانصراف في هذا الوقت أو قبله (ISO 8601).","example":"2026-10-31T23:59:59Z"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`, e.g. `date desc`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`، مثل `date desc`. الأحدث أولاً إن لم يُرسل.","example":"date desc"}],"responses":{"200":{"description":"A page of attendance days.","x-description-ar":"صفحة من أيام الحضور.","content":{"application/json":{"example":{"records":[{"id":58231,"status":"late","date":"2026-11-02","check_in_at":"2026-11-02T06:22:00Z","check_out_at":"2026-11-02T14:05:00Z","hours_worked":7.72,"check_in_source":"app","check_out_source":"device","check_in_device":null,"check_out_device":{"name":"Main gate","external_employee_no":"1042"},"incidents":[{"id":912,"kind":"late","status":"pending","justification_state":"none"}],"tracks_breaks":false,"day_state":null,"ended_by":null,"break_minutes":null,"breaks":[],"permissions":[{"id":77,"kind":"late_arrival","status":"approved","start_time":"09:00","end_time":"09:30"}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_record_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/attendances/my_schedule":{"get":{"summary":"Get my work schedule for a week","operationId":"attendances.my_schedule","tags":["Attendance"],"description":"Returns the token owner's planned schedule for one week, Sunday to Saturday: for each day whether it is a\nworking day, a day off, a public holiday or approved leave, the attendance profile in force, the shift\nwindow (`09:00`–`17:00`, company time) or `flexible` with its hours, and the scheduled hours. It also\ngives the profile's weekly target hours, days off and grace period, and any profile change already\nscheduled for the future (`next_change`).\n\n**When to use:** to answer \"what time do I start tomorrow?\", \"am I working on Thursday?\" or \"when does my\nnew schedule start?\". Any week can be asked for, past or future.\n\n**Prerequisites:** a token created by a user linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"عرض جدول عملي لأسبوع","x-description-ar":"يعرض جدول العمل المخطط لصاحب الرمز لأسبوع واحد من الأحد إلى السبت: لكل يوم هل هو يوم عمل أو يوم راحة أو\nعطلة رسمية أو إجازة معتمدة، وملف الحضور المطبّق، ونافذة الوردية (`09:00`–`17:00` بتوقيت الشركة) أو\n`flexible` مرنة مع ساعاتها، والساعات المجدولة. ويعطي أيضاً الساعات الأسبوعية المستهدفة في الملف وأيام\nالراحة وفترة السماح، وأي تغيير ملف مجدول مستقبلاً (`next_change`).\n\n**متى تستخدمه:** للإجابة عن \"متى يبدأ دوامي غداً؟\" أو \"هل أعمل يوم الخميس؟\" أو \"متى يبدأ جدولي الجديد؟\".\nيمكن طلب أي أسبوع، ماضياً أو قادماً.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"week_start","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Any date in the week wanted; the week starts on the Sunday on or before it. The current week when omitted.","x-description-ar":"أي تاريخ في الأسبوع المطلوب؛ يبدأ الأسبوع من الأحد الواقع فيه أو قبله. الأسبوع الحالي إن لم يُرسل.","example":"2026-11-04"}],"responses":{"200":{"description":"The week.","x-description-ar":"الأسبوع.","content":{"application/json":{"example":{"week_start":"2026-11-01","days":[{"date":"2026-11-01","profile":{"id":3,"name":"Morning"},"kind":"working","window":{"start":"09:00","end":"17:00"},"shift_kind":"rigid","scheduled_hours":8.0,"location_id":null,"locked":true},{"date":"2026-11-06","profile":{"id":3,"name":"Morning"},"kind":"day_off","window":null,"shift_kind":null,"scheduled_hours":null,"location_id":null,"locked":false}],"summary":{"profile":{"id":3,"name":"Morning"},"weekly_target_hours":40.0,"days_off":[5,6],"grace_period_minutes":15},"next_change":{"effective_from":"2026-12-01","profile":{"id":4,"name":"Ramadan"},"days_off":[5,6]}},"schema":{"type":"object","properties":{"week_start":{"type":"string","description":"The Sunday the week starts on.","x-description-ar":"الأحد الذي يبدأ به الأسبوع.","format":"date"},"days":{"type":"array","description":"Seven days, Sunday first.","x-description-ar":"سبعة أيام بدءاً بالأحد.","items":{"type":"object","properties":{"date":{"type":"string","description":"Date.","x-description-ar":"التاريخ.","format":"date"},"profile":{"type":"object","description":"Attendance profile in force: `id`, `name`.","x-description-ar":"ملف الحضور المطبّق: `id` و`name`."},"kind":{"type":"string","description":"`working`, `day_off`, `holiday` or `leave`.","x-description-ar":"`working` عمل، `day_off` راحة، `holiday` عطلة رسمية، `leave` إجازة.","enum":["working","day_off","holiday","leave"]},"window":{"type":"object","description":"Shift window, company time: `start`, `end` (`HH:MM`). Null on flexible and non-working days.","x-description-ar":"نافذة الوردية بتوقيت الشركة: `start` و`end` (`HH:MM`). null في الأيام المرنة وأيام عدم العمل.","nullable":true},"shift_kind":{"type":"string","description":"`rigid` (fixed hours) or `flexible`; null on non-working days.","x-description-ar":"`rigid` ساعات ثابتة أو `flexible` مرنة؛ null في أيام عدم العمل.","nullable":true},"scheduled_hours":{"type":"number","description":"Hours owed that day; null when nothing is owed.","x-description-ar":"الساعات المطلوبة ذلك اليوم؛ null إن لم يُطلب شيء.","nullable":true},"location_id":{"type":"integer","description":"Location of that day's shift, when set.","x-description-ar":"موقع وردية ذلك اليوم إن حُدد.","nullable":true},"locked":{"type":"boolean","description":"True for today and past days, and leave days: no longer changeable in the schedule.","x-description-ar":"صحيح لليوم والأيام الماضية وأيام الإجازة: لم يعد تغييرها في الجدول ممكناً."}}}},"summary":{"type":"object","description":"Today's profile (`profile`), `weekly_target_hours`, `days_off` (0 = Sunday … 6 = Saturday) and `grace_period_minutes`.","x-description-ar":"ملف اليوم (`profile`) و`weekly_target_hours` و`days_off` (0 = الأحد … 6 = السبت) و`grace_period_minutes`."},"next_change":{"type":"object","description":"A scheduled profile change: `effective_from`, `profile`, `days_off`; null when none.","x-description-ar":"تغيير ملف مجدول: `effective_from` و`profile` و`days_off`؛ null إن لم يوجد.","nullable":true}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/attendances/pause":{"post":{"summary":"Start a break","operationId":"attendances.pause","tags":["Attendance"],"description":"Pauses the token owner's tracked work day now: the break starts and stops counting as work time, like the\nPause button of the QHR app. Only for employees whose attendance profile tracks breaks\n(`tracks_breaks: true` in `attendances.check_in_status`).\n\n**When to use:** when the person says they are going on a break. Resume with `attendances.resume`.\n\n**Prerequisites:** a tracked day in state `working` (`attendances.check_in_status`).\n\n**Side effects:** records the break; hours worked are counted net of breaks. Break time beyond the\nprofile's allowance can shorten the day and lead to a short-hours deduction.","x-summary-ar":"بدء استراحة","x-description-ar":"يوقف يوم العمل المتتبَّع لصاحب الرمز الآن: تبدأ الاستراحة ولا تُحسب من وقت العمل، مثل زر «استراحة» في تطبيق\nQHR. فقط للموظفين الذين يتتبع ملف حضورهم الاستراحات (`tracks_breaks: true` في `attendances.check_in_status`).\n\n**متى تستخدمه:** عندما يقول الشخص إنه ذاهب إلى استراحة. للعودة استخدم `attendances.resume`.\n\n**المتطلبات:** يوم متتبَّع حالته `working` (`attendances.check_in_status`).\n\n**الآثار الجانبية:** تُسجَّل الاستراحة وتُحسب ساعات العمل بعد خصمها. الاستراحة الأطول من المسموح في الملف قد\nتُنقص اليوم وتؤدي إلى خصم ساعات ناقصة.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The day's status, now paused.","x-description-ar":"حالة اليوم، الآن في استراحة.","content":{"application/json":{"example":{"checked_in":true,"check_in_at":"2026-11-02T06:02:00Z","check_out_at":null,"already_checked_in_via":"app","device_name":null,"geo_fencing":null,"tracks_breaks":true,"state":"paused","ended_by":null,"ended_at":null,"as_of":"2026-11-02T09:30:00Z","worked_minutes":178,"break_minutes":10,"allowed_break_minutes":60,"current_period_started_at":null,"paused_since":"2026-11-02T09:20:00Z","breaks":[{"started_at":"2026-11-02T09:20:00Z","ended_at":null,"started_via":"app","ended_via":null,"started_device_name":null,"ended_device_name":null}],"last_event":{"source":"app","device_name":null,"at":"2026-11-02T09:20:00Z"}},"schema":{"$ref":"#/components/schemas/attendance_check_in_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The break was refused.","x-description-ar":"رُفضت الاستراحة.","x-codes":[{"code":"validation_failed","meaning":"Refused: breaks are not tracked on this profile, the employee has not checked in, the day is already paused or ended, or it is closed for payroll.","x-meaning-ar":"مرفوض: الملف لا يتتبع الاستراحات، أو لم يُسجَّل الحضور، أو اليوم في استراحة أو انتهى، أو مغلق للرواتب.","x-fix":"Read `error`, then check the day with `attendances.check_in_status` before trying again.","x-fix-ar":"اقرأ `error` ثم راجع اليوم عبر `attendances.check_in_status` قبل المحاولة مجدداً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Your day is already paused.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"latitude":{"type":"number","description":"The person's latitude, when their location fences check-in (`geo_fencing.requires_coordinates`).","x-description-ar":"خط عرض موقع الشخص، إن كان موقعه يقيّد الحضور (`geo_fencing.requires_coordinates`)."},"longitude":{"type":"number","description":"The person's longitude, with `latitude`.","x-description-ar":"خط طول موقع الشخص، مع `latitude`."}}},"example":{"latitude":24.7136,"longitude":46.6753}}},"required":true,"description":"Where the person is, when their location requires it. Send `{}` otherwise."}}},"/attendances/resume":{"post":{"summary":"End a break and resume work","operationId":"attendances.resume","tags":["Attendance"],"description":"Ends the token owner's running break now and resumes the tracked work day, like the Resume button of the QHR\napp.\n\n**When to use:** when the person says they are back from their break.\n\n**Prerequisites:** a tracked day in state `paused` (`attendances.check_in_status`), started with\n`attendances.pause`. Resuming is fenced like a check-in: send `latitude` and `longitude` when required.\n\n**Side effects:** closes the break; work time counts again.","x-summary-ar":"إنهاء الاستراحة واستئناف العمل","x-description-ar":"ينهي الاستراحة الجارية لصاحب الرمز الآن ويستأنف يوم العمل المتتبَّع، مثل زر «استئناف» في تطبيق QHR.\n\n**متى تستخدمه:** عندما يقول الشخص إنه عاد من استراحته.\n\n**المتطلبات:** يوم متتبَّع حالته `paused` (`attendances.check_in_status`) بدأ عبر `attendances.pause`. الاستئناف\nمقيَّد بالموقع مثل الحضور: أرسل `latitude` و`longitude` عند الحاجة.\n\n**الآثار الجانبية:** تُغلق الاستراحة ويعود احتساب وقت العمل.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The day's status, working again.","x-description-ar":"حالة اليوم، يعمل من جديد.","content":{"application/json":{"example":{"checked_in":true,"check_in_at":"2026-11-02T06:02:00Z","check_out_at":null,"already_checked_in_via":"app","device_name":null,"geo_fencing":null,"tracks_breaks":true,"state":"working","ended_by":null,"ended_at":null,"as_of":"2026-11-02T09:30:00Z","worked_minutes":178,"break_minutes":20,"allowed_break_minutes":60,"current_period_started_at":"2026-11-02T09:40:00Z","paused_since":null,"breaks":[{"started_at":"2026-11-02T09:20:00Z","ended_at":"2026-11-02T09:40:00Z","started_via":"app","ended_via":"app","started_device_name":null,"ended_device_name":null}],"last_event":{"source":"app","device_name":null,"at":"2026-11-02T09:40:00Z"}},"schema":{"$ref":"#/components/schemas/attendance_check_in_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"Resuming was refused.","x-description-ar":"رُفض الاستئناف.","x-codes":[{"code":"validation_failed","meaning":"Refused: the day is not paused, breaks are not tracked, the day ended, or the location is not allowed.","x-meaning-ar":"مرفوض: اليوم ليس في استراحة، أو الاستراحات غير متتبَّعة، أو انتهى اليوم، أو الموقع غير مسموح.","x-fix":"Read `error`, then check the day with `attendances.check_in_status` before trying again.","x-fix-ar":"اقرأ `error` ثم راجع اليوم عبر `attendances.check_in_status` قبل المحاولة مجدداً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Your day is not paused.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"latitude":{"type":"number","description":"The person's latitude, when their location fences check-in (`geo_fencing.requires_coordinates`).","x-description-ar":"خط عرض موقع الشخص، إن كان موقعه يقيّد الحضور (`geo_fencing.requires_coordinates`)."},"longitude":{"type":"number","description":"The person's longitude, with `latitude`.","x-description-ar":"خط طول موقع الشخص، مع `latitude`."}}},"example":{"latitude":24.7136,"longitude":46.6753}}},"required":true,"description":"Where the person is, when their location requires it. Send `{}` otherwise."}}},"/attendances/weekly_summary":{"get":{"summary":"Get my hours worked this week","operationId":"attendances.weekly_summary","tags":["Attendance"],"description":"Returns the hours the token owner has worked in the current week (Sunday to Saturday) against the hours\ntheir schedule requires, the number of days worked, and the hours of each day. A day still in progress\ncounts the time worked so far. Days off, holidays and approved leave require 0 hours. Future days are null.\n\n**When to use:** to answer \"how many hours have I done this week?\" or \"am I short this week?\". For another\nweek, or day-by-day detail, use `attendances.my_history`.\n\n**Prerequisites:** a token created by a user linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"عرض ساعات عملي هذا الأسبوع","x-description-ar":"يعرض الساعات التي عملها صاحب الرمز في الأسبوع الحالي (من الأحد إلى السبت) مقابل الساعات التي يتطلبها جدوله،\nوعدد أيام العمل، وساعات كل يوم. اليوم الجاري يُحسب بما عُمل حتى الآن. أيام الراحة والعطل الرسمية والإجازات\nالمعتمدة تتطلب 0 ساعة. الأيام القادمة null.\n\n**متى تستخدمه:** للإجابة عن \"كم ساعة عملت هذا الأسبوع؟\" أو \"هل عندي نقص هذا الأسبوع؟\". لأسبوع آخر أو\nلتفاصيل كل يوم استخدم `attendances.my_history`.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"This week's hours.","x-description-ar":"ساعات هذا الأسبوع.","content":{"application/json":{"example":{"hours_worked":15.5,"target_hours":40.0,"days_worked":2,"days":{"sunday":8.0,"monday":7.5,"tuesday":null,"wednesday":null,"thursday":null,"friday":null,"saturday":null}},"schema":{"type":"object","properties":{"hours_worked":{"type":"number","description":"Hours worked this week.","x-description-ar":"ساعات العمل هذا الأسبوع."},"target_hours":{"type":"number","description":"Hours the schedule requires this week.","x-description-ar":"الساعات التي يتطلبها الجدول هذا الأسبوع."},"days_worked":{"type":"integer","description":"Days with any time worked.","x-description-ar":"الأيام التي فيها وقت عمل."},"days":{"type":"object","description":"Hours per weekday, `sunday` … `saturday`; null for days still to come.","x-description-ar":"الساعات لكل يوم `sunday` … `saturday`؛ null للأيام القادمة.","additionalProperties":{"type":"number","nullable":true}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/attendances/{id}/adjust":{"patch":{"summary":"Correct a direct report's attendance day","operationId":"attendances.adjust","tags":["Attendance"],"description":"Lets a manager set the check-in and/or check-out time of one day of an employee who reports directly to\nthem, with a reason, and on a break-tracking day replace its breaks. QHR recomputes the hours worked and\nthe day's status (present, late…) from the new times; those sides are marked `manual`.\n\n**When to use:** when a team member forgot to check in or out, or a device missed a scan. The employee's\nown route to the same result is a justification (`time_incidents.submit_justification`).\n\n**Prerequisites:** the day's id. A missed check-in or check-out leaves an incident in the manager's queue,\n`time_incidents.team_list`, whose rows carry the day as `attendance.record_id`; HR finds any day as `id` in\n`attendance_log.records`. The token's owner must be the employee's direct manager; any other day answers 404.\nDays on approved leave and future days cannot be adjusted.\n\n**Side effects:** the change and its reason are kept in the record's audit trail, deductions for the day are\nrecalculated, and the employee is emailed what changed. Not offered to Claude, because it rewrites another\nperson's working time, which feeds payroll.","x-summary-ar":"تصحيح يوم حضور لأحد المرؤوسين","x-description-ar":"يتيح للمدير تحديد وقت الحضور و/أو الانصراف ليوم واحد لموظف يتبع له مباشرةً مع ذكر السبب، واستبدال استراحات\nاليوم إن كان يتتبعها. يعيد QHR حساب ساعات العمل وحالة اليوم (حاضر، متأخر…) من الأوقات الجديدة، ويُعلَّم هذان\nالطرفان `manual`.\n\n**متى تستخدمه:** عندما ينسى أحد أعضاء الفريق تسجيل الحضور أو الانصراف، أو يفوّت جهاز بصمة. الطريق المقابل\nللموظف نفسه هو تقديم مبرر (`time_incidents.submit_justification`).\n\n**المتطلبات:** رقم اليوم. نسيان الحضور أو الانصراف يترك مخالفة في قائمة المدير `time_incidents.team_list`،\nوتحمل صفوفها رقم اليوم في `attendance.record_id`؛ وتجد الموارد البشرية أي يوم في `id` ضمن\n`attendance_log.records`. يجب أن يكون صاحب الرمز المدير المباشر للموظف؛ أي يوم آخر يُرجع 404. لا يمكن تعديل\nأيام الإجازات المعتمدة ولا الأيام القادمة.\n\n**الآثار الجانبية:** يُحفظ التغيير وسببه في سجل تدقيق اليوم، وتُعاد حساب خصومات اليوم، ويصل الموظفَ بريد بما\nتغيّر. لا يُعرض على Claude لأنه يعيد كتابة وقت عمل شخص آخر، وهو ما تعتمد عليه الرواتب.","x-access":"write","x-permission":{"key":"attendance/adjust_team","label":"Adjust team attendance","x-label-ar":"تعديل حضور الفريق"},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_record_id"}],"responses":{"200":{"description":"The corrected day.","x-description-ar":"اليوم بعد التصحيح.","content":{"application/json":{"example":{"id":58190,"status":"present","date":"2026-11-01","check_in_at":"2026-11-01T06:00:00Z","check_out_at":"2026-11-01T14:00:00Z","hours_worked":8.0,"check_in_source":"manual","check_out_source":"manual","check_in_device":null,"check_out_device":null,"incidents":[],"tracks_breaks":false,"day_state":null,"ended_by":null,"break_minutes":null,"breaks":[]},"schema":{"$ref":"#/components/schemas/attendance_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The correction was refused.","x-description-ar":"رُفض التصحيح.","x-codes":[{"code":"validation_failed","meaning":"Refused: no reason, a time in the future or not valid, a future day, the employee is on approved leave that day, breaks sent for a day that does not track them or breaks outside the new times, or the day changed meanwhile.","x-meaning-ar":"مرفوض: لا يوجد سبب، أو وقت في المستقبل أو غير صحيح، أو يوم قادم، أو الموظف في إجازة معتمدة ذلك اليوم، أو استراحات ليوم لا يتتبعها أو خارج الأوقات الجديدة، أو تغيّر اليوم في الأثناء.","x-fix":"Fix what `error` names and send again; on approved leave, cancel the leave first.","x-fix-ar":"صحّح ما يذكره `error` وأعد الإرسال؛ وفي حالة الإجازة المعتمدة ألغِ الإجازة أولاً."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Please provide a reason for the adjustment.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"check_in_at":{"type":"string","description":"New check-in time, ISO 8601 (UTC or with an offset). Leave out to keep it.","x-description-ar":"وقت الحضور الجديد بصيغة ISO 8601 (UTC أو مع فرق التوقيت). اتركه للإبقاء عليه.","format":"date-time"},"check_out_at":{"type":"string","description":"New check-out time, ISO 8601. Leave out to keep it.","x-description-ar":"وقت الانصراف الجديد بصيغة ISO 8601. اتركه للإبقاء عليه.","format":"date-time"},"reason":{"type":"string","description":"Why the day is corrected; emailed to the employee and kept in the audit trail.","x-description-ar":"سبب التصحيح؛ يُرسل للموظف بالبريد ويُحفظ في سجل التدقيق."},"breaks":{"type":"array","description":"Tracked days only: the day's complete list of breaks, replacing the current one. Each break needs a start and an end inside the check-in and check-out, without overlaps.","x-description-ar":"الأيام المتتبَّعة فقط: القائمة الكاملة لاستراحات اليوم، تحل محل الحالية. كل استراحة تحتاج بداية ونهاية بين الحضور والانصراف دون تداخل.","items":{"type":"object","properties":{"started_at":{"type":"string","description":"Break start, ISO 8601.","x-description-ar":"بداية الاستراحة ISO 8601.","format":"date-time"},"ended_at":{"type":"string","description":"Break end, ISO 8601.","x-description-ar":"نهاية الاستراحة ISO 8601.","format":"date-time"}}}}}},"example":{"check_in_at":"2026-11-01T06:00:00Z","check_out_at":"2026-11-01T14:00:00Z","reason":"The gate device was offline in the morning."}}},"required":true,"description":"The new times and the reason."}}},"/attendances/{id}/justification_context":{"get":{"summary":"Get one of my days with its deductions","operationId":"attendances.justification_context","tags":["Attendance"],"description":"Returns one of the token owner's attendance days with everything needed to explain it: the times, the\nschedule that applied (shift start and end, grace period, target hours), each deduction the day produced\n(late arrival, early leave, short hours…) with its minutes, review status, the reason already given, and\nwhether a reason can still be given (`can_justify`, `justify_deadline`, `days_left`, or `blocked_reason`:\n`corrections_disabled`, `window_expired`, `already_decided`, `payroll_locked`), and the hourly permissions\non that day.\n\n**When to use:** before `time_incidents.submit_justification`, to see whether a deduction can still be explained and\nuntil when, or to answer \"why was I marked late on Monday?\".\n\n**Prerequisites:** the day's `id` from `attendances.my_history`. Only the owner's own days; any other id\nanswers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض أحد أيامي مع خصوماته","x-description-ar":"يعرض يوماً من أيام حضور صاحب الرمز مع كل ما يلزم لتبريره: الأوقات، والجدول المطبّق (بداية الوردية ونهايتها\nوفترة السماح والساعات المستهدفة)، وكل خصم نتج عن اليوم (تأخير، خروج مبكر، ساعات ناقصة…) مع دقائقه وحالة\nمراجعته والمبرر المقدَّم، وهل ما زال تقديم مبرر ممكناً (`can_justify` و`justify_deadline` و`days_left`، أو\n`blocked_reason`: `corrections_disabled` أو `window_expired` أو `already_decided` أو `payroll_locked`)،\nوطلبات الاستئذان في ذلك اليوم.\n\n**متى تستخدمه:** قبل `time_incidents.submit_justification` لمعرفة هل ما زال تبرير الخصم ممكناً وحتى متى، أو للإجابة عن\n\"لماذا سُجّلت متأخراً يوم الاثنين؟\".\n\n**المتطلبات:** رقم `id` اليوم من `attendances.my_history`. أيام صاحب الرمز فقط؛ أي رقم آخر يُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_record_id"}],"responses":{"200":{"description":"The day, its schedule, its deductions and permissions.","x-description-ar":"اليوم وجدوله وخصوماته وطلبات الاستئذان فيه.","content":{"application/json":{"example":{"attendance_record":{"id":58231,"date":"2026-11-02","status":"late","check_in_at":"2026-11-02T06:22:00Z","check_out_at":"2026-11-02T14:05:00Z","check_in_source":"app","check_out_source":"device","hours_worked":7.72},"attendance_profile":{"id":3,"name":"Morning","work_start_time":"09:00","work_end_time":"17:00","daily_target_hours":8.0,"grace_period_enabled":true,"grace_period_minutes":15,"correction_requests_enabled":true,"correction_request_limit_days":7,"day_type":"working","shift_start":"09:00","shift_end":"17:00","flexible":false,"scheduled_hours":8.0},"incidents":[{"id":912,"kind":"late","minutes":22,"hours":0.37,"status":"pending","review":{"decision":null,"decided_by":null,"decided_at":null,"note":null},"justification":null,"can_justify":true,"blocked_reason":null,"justify_deadline":"2026-11-09","days_left":7}],"permissions":[]},"schema":{"type":"object","properties":{"attendance_record":{"type":"object","description":"The day: `id`, `date`, `status`, `check_in_at`, `check_out_at` (UTC), the source of each, `hours_worked`.","x-description-ar":"اليوم: `id` و`date` و`status` و`check_in_at` و`check_out_at` (UTC) ومصدر كل منهما و`hours_worked`."},"attendance_profile":{"type":"object","description":"The schedule that applied: profile `id` and `name`, `work_start_time`, `work_end_time`, `daily_target_hours`, grace period, whether reasons may be given (`correction_requests_enabled`) and for how many days, and the day's own `shift_start`, `shift_end`, `flexible`, `scheduled_hours`.","x-description-ar":"الجدول المطبّق: `id` الملف و`name` و`work_start_time` و`work_end_time` و`daily_target_hours` وفترة السماح، وهل يُسمح بتقديم المبررات (`correction_requests_enabled`) ولكم يوم، وبيانات اليوم نفسه `shift_start` و`shift_end` و`flexible` و`scheduled_hours`."},"incidents":{"type":"array","description":"The day's deductions.","x-description-ar":"خصومات اليوم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Time incident id, for `time_incidents.submit_justification`.","x-description-ar":"رقم المخالفة، لـ `time_incidents.submit_justification`."},"kind":{"type":"string","description":"`absence`, `late`, `early_leave`, `short_hours` or `incomplete`.","x-description-ar":"`absence` غياب، `late` تأخير، `early_leave` خروج مبكر، `short_hours` ساعات ناقصة، `incomplete` غير مكتمل."},"minutes":{"type":"integer","description":"Minutes the deduction is about.","x-description-ar":"دقائق الخصم."},"hours":{"type":"number","description":"The same in hours.","x-description-ar":"المدة نفسها بالساعات."},"status":{"type":"string","description":"`pending`, `deducted` or `ignored`.","x-description-ar":"`pending` قيد المراجعة، `deducted` خُصم، `ignored` تم تجاهله."},"review":{"type":"object","description":"`decision`, `decided_by` (`id`, `name`), `decided_at`, `note`.","x-description-ar":"`decision` القرار، `decided_by` من قرر (`id` و`name`)، `decided_at` وقته، `note` ملاحظة."},"justification":{"type":"object","description":"The reason given: `reason`, `submitted_at`, `conflicted`; null if none.","x-description-ar":"المبرر المقدَّم: `reason` و`submitted_at` و`conflicted`؛ null إن لم يوجد.","nullable":true},"can_justify":{"type":"boolean","description":"True when a reason can be given or changed now.","x-description-ar":"صحيح إن أمكن تقديم مبرر أو تعديله الآن."},"blocked_reason":{"type":"string","description":"Why not: `corrections_disabled`, `window_expired`, `already_decided` or `payroll_locked`.","x-description-ar":"سبب المنع: `corrections_disabled` أو `window_expired` أو `already_decided` أو `payroll_locked`.","nullable":true},"justify_deadline":{"type":"string","description":"Last date to give a reason.","x-description-ar":"آخر تاريخ لتقديم المبرر.","format":"date","nullable":true},"days_left":{"type":"integer","description":"Days left until the deadline.","x-description-ar":"الأيام المتبقية حتى الموعد.","nullable":true}}}},"permissions":{"type":"array","description":"Approved and pending hourly permissions that day: `id`, `kind`, `status`, `start_time`, `end_time`.","x-description-ar":"طلبات الاستئذان المعتمدة والمعلقة ذلك اليوم: `id` و`kind` و`status` و`start_time` و`end_time`.","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no attendance.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يوجد له حضور.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/audit_logs":{"get":{"summary":"List audit log entries","operationId":"audit_logs.list","tags":["Audit log"],"description":"Returns the company's audit trail, newest first: one entry per record created, updated or deleted\n(employees, salaries, leave requests, roles…), with who did it, when, and the fields that changed. For an\nupdate, each changed field holds `[old value, new value]`; for a create or delete, the record's values.\n\nFilters (all optional, combine freely): the record type (`q[resource_type_eq]`), the action\n(`q[action_eq]`), the person who made the change (`q[user_name_cont]`), a field that changed\n(`q[changed_attributes_cont]`) and a date range (`q[timestamp_gteq]` / `q[timestamp_lteq]`, whole days).\n\n**When to use:** to answer \"who changed Khalid's salary?\", \"what was deleted last week?\" or \"what did\nSara change today?\".\n\n**Prerequisites:** none. The record types and field names the filters accept come from `audit_logs.meta`.\nThe log covers the whole company, so it needs \"View audit logs\" (normally admins only).\n\n**Side effects:** none. Up to 100 entries per page.","x-summary-ar":"عرض سجل التدقيق","x-description-ar":"يعرض سجل التدقيق في الشركة، الأحدث أولاً: قيد لكل سجل أُنشئ أو عُدّل أو حُذف (الموظفون والرواتب وطلبات\nالإجازة والأدوار…)، مع من قام بذلك ومتى والحقول التي تغيّرت. في التعديل يحمل كل حقل متغيّر\n`[القيمة القديمة، القيمة الجديدة]`، وفي الإنشاء أو الحذف قيم السجل.\n\nعوامل التصفية (كلها اختيارية ويمكن الجمع بينها): نوع السجل (`q[resource_type_eq]`)، والإجراء\n(`q[action_eq]`)، والشخص الذي أجرى التغيير (`q[user_name_cont]`)، وحقل تغيّر (`q[changed_attributes_cont]`)،\nونطاق تاريخ (`q[timestamp_gteq]` / `q[timestamp_lteq]`، بأيام كاملة).\n\n**متى تستخدمه:** للإجابة عن \"من غيّر راتب خالد؟\" أو \"ما الذي حُذف الأسبوع الماضي؟\" أو \"ما الذي غيّرته\nسارة اليوم؟\".\n\n**المتطلبات:** لا شيء. أنواع السجلات وأسماء الحقول التي تقبلها عوامل التصفية من `audit_logs.meta`. يغطي\nالسجل الشركة كلها، لذلك يحتاج صلاحية «عرض سجل التدقيق» (عادةً لمسؤولي النظام فقط).\n\n**الآثار الجانبية:** لا شيء. حتى ١٠٠ قيد في الصفحة.","x-access":"read","x-permission":{"key":"audit_logs/view","label":"View audit logs","x-label-ar":"عرض سجلات التدقيق"},"x-feature":"audit_logs","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[resource_type_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this record type, exactly as `audit_logs.meta` lists it (e.g. `Employee`, `Salary`).","x-description-ar":"نوع سجل محدد فقط، كما يرد في `audit_logs.meta` تماماً (مثل `Employee` و`Salary`).","example":"Employee"},{"name":"q[action_eq]","in":"query","required":false,"schema":{"type":"string","enum":["create","update","destroy"]},"description":"Only this action: `create`, `update` or `destroy` (deleted).","x-description-ar":"إجراء محدد فقط: `create` (إنشاء) أو `update` (تعديل) أو `destroy` (حذف).","example":"update"},{"name":"q[user_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Only changes made by a QHR user whose full name contains this text. Changes made by the system (imports, scheduled jobs) have no user and never match.","x-description-ar":"التغييرات التي أجراها مستخدم في QHR يحتوي اسمه الكامل على هذا النص فقط. التغييرات التي يجريها النظام (الاستيراد والمهام المجدولة) بلا مستخدم ولا تطابق أبداً.","example":"Sara"},{"name":"q[changed_attributes_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Only entries where this exact field changed, a field name from `audit_logs.meta` (e.g. `job_title`).","x-description-ar":"القيود التي تغيّر فيها هذا الحقل بالضبط فقط، باسم حقل من `audit_logs.meta` (مثل `job_title`).","example":"job_title"},{"name":"q[timestamp_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"From this day (YYYY-MM-DD), inclusive.","x-description-ar":"من هذا اليوم (YYYY-MM-DD) شاملاً.","example":"2026-11-01"},{"name":"q[timestamp_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Up to this day (YYYY-MM-DD), inclusive.","x-description-ar":"حتى هذا اليوم (YYYY-MM-DD) شاملاً.","example":"2026-11-30"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e ascend|descend`, where field is `created_at`, `action` or `auditable_type`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e ascend|descend`، والحقل `created_at` أو `action` أو `auditable_type`. الأحدث أولاً إن لم يُرسل.","example":"created_at ascend"}],"responses":{"200":{"description":"A page of audit log entries.","x-description-ar":"صفحة من قيود سجل التدقيق.","content":{"application/json":{"example":{"records":[{"id":5120,"action":"update","auditable_type":"Employee","audited_changes":{"job_title":["Accountant","Senior Accountant"]},"user_name":"Sara Ahmed","user_image":null,"created_at":"2026-11-24T09:15:02Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"The entries on this page.","x-description-ar":"القيود في هذه الصفحة.","items":{"type":"object","required":["id","action","auditable_type","audited_changes","user_name","created_at"],"properties":{"id":{"type":"integer","description":"Entry id.","x-description-ar":"رقم القيد."},"action":{"type":"string","description":"What happened: `create`, `update` or `destroy`.","x-description-ar":"ما حدث: `create` أو `update` أو `destroy`."},"auditable_type":{"type":"string","description":"Type of the record that changed.","x-description-ar":"نوع السجل الذي تغيّر."},"audited_changes":{"type":"object","description":"Changed fields. On `update` each holds `[old, new]`; on `create` and `destroy` the record's value.","x-description-ar":"الحقول المتغيّرة. في `update` يحمل كل حقل `[القديمة، الجديدة]`، وفي `create` و`destroy` قيمة السجل."},"user_name":{"type":"string","description":"Who made the change; empty when the system did.","x-description-ar":"من أجرى التغيير؛ فارغ إن أجراه النظام.","nullable":true},"user_image":{"type":"string","description":"Always empty; kept for the web app.","x-description-ar":"فارغ دائماً؛ مُبقى لتطبيق الويب.","nullable":true},"created_at":{"type":"string","description":"When it happened.","x-description-ar":"وقت حدوثه.","format":"date-time"}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/audit_logs/meta":{"get":{"summary":"List the record types and fields in the audit log","operationId":"audit_logs.meta","tags":["Audit log"],"description":"Returns every record type that has at least one entry in the audit log, alphabetically, each with its\nfield names. These are the values `audit_logs.list` accepts in `q[resource_type_eq]` and\n`q[changed_attributes_cont]`.\n\n**When to use:** before filtering `audit_logs.list`, to turn \"salary changes\" or \"job title changes\" into\nthe exact type and field names.\n\n**Prerequisites:** none. Needs \"View audit logs\".\n\n**Side effects:** none.","x-summary-ar":"عرض أنواع السجلات وحقولها في سجل التدقيق","x-description-ar":"يعرض كل نوع سجل له قيد واحد على الأقل في سجل التدقيق، مرتبةً أبجدياً، ومع كل نوع أسماء حقوله. هذه هي\nالقيم التي يقبلها `audit_logs.list` في `q[resource_type_eq]` و`q[changed_attributes_cont]`.\n\n**متى تستخدمه:** قبل تصفية `audit_logs.list`، لتحويل \"تغييرات الرواتب\" أو \"تغييرات المسمى الوظيفي\" إلى\nاسم النوع والحقل بالضبط.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية «عرض سجل التدقيق».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"audit_logs/view","label":"View audit logs","x-label-ar":"عرض سجلات التدقيق"},"x-feature":"audit_logs","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Record types and their fields.","x-description-ar":"أنواع السجلات وحقولها.","content":{"application/json":{"example":{"data":{"Employee":["created_at","department_id","email","first_name","id","job_title","last_name","updated_at"],"Salary":["basic_salary_amount","created_at","employee_id","id","start_date","status","updated_at"]}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"One key per record type; its value is the type's field names, alphabetically.","x-description-ar":"مفتاح لكل نوع سجل، وقيمته أسماء حقول النوع مرتبةً أبجدياً.","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/custodies":{"get":{"summary":"List custody records","operationId":"custodies.list","tags":["Custody"],"description":"Returns the company's custody records — which employee holds which asset, its serial and value — newest\nfirst. With no status filter only assets held right now are listed; send `q[status_eq]` for returned ones,\nones being deducted from salary, or fully recovered ones.\n\n**When to use:** to answer \"who has which laptop?\", \"what does Ahmed hold?\" or \"what is still being\ndeducted?\", and to find a custody `id` for the other custody operations. For totals only,\n`custodies.stat_cards` is lighter.\n\n**Prerequisites:** none. Category and item ids for the filters come from `custody_categories.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض قائمة العهد","x-description-ar":"يعرض سجلات العهد في الشركة — أي موظف يحمل أي أصل ورقمه التسلسلي وقيمته — الأحدث أولاً. بدون تصفية\nبالحالة لا تظهر إلا الأصول التي في العهدة الآن؛ أرسل `q[status_eq]` لعرض المُعادة أو التي يُستقطع ثمنها من\nالراتب أو التي اكتمل استردادها.\n\n**متى تستخدمه:** للإجابة عن \"من يحمل أي حاسوب؟\" أو \"ما الذي في عهدة أحمد؟\" أو \"ما الذي ما زال يُستقطع؟\"،\nولمعرفة رقم `id` العهدة الذي تحتاجه عمليات العهد الأخرى. للأرقام الإجمالية فقط، `custodies.stat_cards` أخف.\n\n**المتطلبات:** لا شيء. أرقام الفئات والأصناف للتصفية من `custody_categories.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ سجلاً في الصفحة.","x-access":"read","x-permission":{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["held","returned","deducting","deducted"]},"description":"Only this status. `held` when no status is sent.","x-description-ar":"حالة محددة فقط. `held` إن لم تُرسل حالة.","example":"deducting"},{"name":"q[search_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Holder's name or employee number, the custody reference or the serial contains.","x-description-ar":"اسم الحامل أو رقمه الوظيفي أو مرجع العهدة أو الرقم التسلسلي يحتوي على.","example":"Ahmed"},{"name":"q[custody_category_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this category (id from `custody_categories.list`).","x-description-ar":"فئة محددة فقط (الرقم من `custody_categories.list`).","example":2},{"name":"q[custody_item_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this item (id from `custody_categories.list`).","x-description-ar":"صنف محدد فقط (الرقم من `custody_categories.list`).","example":7},{"name":"q[employee_department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only holders in this department (id from `employees.meta_data`).","x-description-ar":"الحاملون في هذا القسم فقط (الرقم من `employees.meta_data`).","example":4},{"name":"q[employee_location_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only holders at this work location (id from `employees.meta_data`).","x-description-ar":"الحاملون في موقع العمل هذا فقط (الرقم من `employees.meta_data`).","example":3},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc` on `reference`, `assigned_on`, `value` or `created_at`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` على `reference` أو `assigned_on` أو `value` أو `created_at`. الأحدث أولاً إن لم يُرسل.","example":"value desc"}],"responses":{"200":{"description":"A page of custody records.","x-description-ar":"صفحة من سجلات العهد.","content":{"application/json":{"example":{"records":[{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/custody_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Hand an asset to an employee","operationId":"custodies.create","tags":["Custody"],"description":"Records that an asset from the catalogue was handed to an employee: the item, its serial, its value (the\nitem's default value when omitted) and the date, with the signed handover form. The custody starts as\n`held`, gets the next reference (`CUS-0042`), and keeps the category and item names as they are today.\n\n**When to use:** when HR gives an employee a laptop, phone, car or key. To move an asset someone already\nholds, use `custodies.transfer`.\n\n**Prerequisites:** `employee_id` from `custodies.employee_options` (active, no termination package);\n`custody_item_id` from `custody_categories.list` (an available item). Items with `serial_required` need a\n`serial` nobody else holds. Needs \"Manage custody\", and a token owner linked to an employee record.\n\n**Side effects:** the assignment, with the handover PDF and the acting HR employee, starts the custody's\nhistory; recorded in the audit log. No one is notified, and nothing is deducted from salary.\n\n**Not offered to Claude:** it uploads a signed PDF (multipart), which a chat cannot provide.","x-summary-ar":"تسليم أصل إلى موظف","x-description-ar":"يسجّل تسليم أصل من القائمة إلى موظف: الصنف ورقمه التسلسلي وقيمته (القيمة الافتراضية للصنف إن لم تُرسل)\nوالتاريخ، مع نموذج التسليم الموقَّع. تبدأ العهدة بحالة `held` وتأخذ المرجع التالي (`CUS-0042`)، وتحتفظ\nباسمي الفئة والصنف كما هما اليوم.\n\n**متى تستخدمه:** عندما تسلّم الموارد البشرية موظفاً حاسوباً أو جوالاً أو سيارة أو مفتاحاً. لنقل أصل يحمله\nشخص آخر استخدم `custodies.transfer`.\n\n**المتطلبات:** `employee_id` من `custodies.employee_options` (نشط وبلا مخالصة نهاية خدمة)، و`custody_item_id`\nمن `custody_categories.list` (صنف متاح). الأصناف التي عليها `serial_required` تحتاج `serial` لا يحمله غيره.\nتحتاج «إدارة العهد»، وأن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يبدأ سجل العهدة بالتسليم مع نموذج التسليم وموظف الموارد البشرية المنفّذ، ويُسجَّل في سجل\nالتدقيق. لا يُبلَّغ أحد ولا يُستقطع شيء من الراتب.\n\n**غير متاح لـ Claude:** يتطلب رفع ملف PDF موقَّع (multipart)، وهذا لا يتوفر في المحادثة.","x-access":"write","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"requestBody":{"required":true,"description":"The new custody and its signed handover form.","x-description-ar":"العهدة الجديدة ونموذج التسليم الموقَّع.","content":{"multipart/form-data":{"schema":{"type":"object","required":["employee_id","custody_item_id","assigned_on","document"],"properties":{"employee_id":{"type":"integer","description":"Who receives it (id from `custodies.employee_options`).","x-description-ar":"المستلم (الرقم من `custodies.employee_options`).","example":1203},"custody_item_id":{"type":"integer","description":"The item (id from `custody_categories.list`).","x-description-ar":"الصنف (الرقم من `custody_categories.list`).","example":7},"serial":{"type":"string","maxLength":255,"description":"Serial number of the unit; required when the item has `serial_required`.","x-description-ar":"الرقم التسلسلي للوحدة؛ مطلوب إن كان على الصنف `serial_required`.","example":"C02XK1"},"value":{"type":"string","description":"Value of this unit; the item's `default_value` when omitted.","x-description-ar":"قيمة هذه الوحدة؛ القيمة الافتراضية للصنف إن لم تُرسل.","example":"8500.00"},"assigned_on":{"type":"string","format":"date","description":"Handover date, not in the future.","x-description-ar":"تاريخ التسليم، ليس في المستقبل.","example":"2026-11-20"},"document":{"type":"string","format":"binary","description":"The signed handover form, a PDF of at most 10 MB.","x-description-ar":"نموذج التسليم الموقَّع، ملف PDF لا يتجاوز ١٠ ميغابايت.","example":"handover.pdf"}}}}}},"responses":{"201":{"description":"The new custody record.","x-description-ar":"سجل العهدة الجديد.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null,"compensation_amount":null,"borne_by":null,"labor_law_cap":false,"amount_repaid":null,"outstanding":null,"settlement":null,"installments":[],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":true,"can_transfer":true,"can_settle":false,"settlement_blocker":null,"accounting_connected":false,"employee_termination_package":null}},"schema":{"$ref":"#/components/schemas/custody_record"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The asset cannot be handed over.","x-description-ar":"لا يمكن تسليم الأصل.","x-codes":[{"code":"employee_not_assignable","meaning":"The employee is not active, is serving notice, or has a termination package.","x-meaning-ar":"الموظف غير نشط أو في فترة الإشعار أو لديه مخالصة نهاية خدمة.","x-fix":"Choose someone from `custodies.employee_options`.","x-fix-ar":"اختر موظفاً من `custodies.employee_options`."},{"code":"item_unavailable","meaning":"The item does not exist or is switched off.","x-meaning-ar":"الصنف غير موجود أو موقوف.","x-fix":"Choose an available item from `custody_categories.list` (`for_assign=true`).","x-fix-ar":"اختر صنفاً متاحاً من `custody_categories.list` (`for_assign=true`)."},{"code":"serial_required","meaning":"The item needs a serial number.","x-meaning-ar":"الصنف يحتاج رقماً تسلسلياً.","x-fix":"Send `serial`.","x-fix-ar":"أرسل `serial`."},{"code":"serial_taken","meaning":"Another employee holds this serial; `custody_id` and `reference` name that custody.","x-meaning-ar":"موظف آخر يحمل هذا الرقم التسلسلي؛ ويحدد `custody_id` و`reference` تلك العهدة.","x-fix":"Check the serial, or take that custody back first with `custodies.return`.","x-fix-ar":"تأكد من الرقم التسلسلي، أو استلم تلك العهدة أولاً عبر `custodies.return`."},{"code":"date_in_future","meaning":"The date is after today in the company time zone.","x-meaning-ar":"التاريخ بعد اليوم بحسب المنطقة الزمنية للشركة.","x-fix":"Send today or an earlier date.","x-fix-ar":"أرسل تاريخ اليوم أو ما قبله."},{"code":"document_required","meaning":"The signed handover form is missing.","x-meaning-ar":"نموذج التسليم الموقَّع غير مرفق.","x-fix":"Attach it as `document`, a PDF.","x-fix-ar":"أرفقه في `document` بصيغة PDF."},{"code":"document_invalid","meaning":"The handover form is not a PDF, or is over 10 MB.","x-meaning-ar":"نموذج التسليم ليس PDF أو يتجاوز ١٠ ميغابايت.","x-fix":"Attach a PDF of at most 10 MB.","x-fix-ar":"أرفق ملف PDF لا يتجاوز ١٠ ميغابايت."},{"code":"employee_required","meaning":"The token owner is a user with no employee record; the operation records who acted, so it needs one.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي؛ والعملية تسجّل من قام بالإجراء فتحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."},{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Serial C02XK1 is already held by Ahmed Ali (CUS-0042)","error_code":"serial_taken","custody_id":311,"reference":"CUS-0042","code":"serial_taken"}}}}}}},"/custodies/employee_options":{"get":{"summary":"List employees who can receive custody","operationId":"custodies.employee_options","tags":["Custody"],"description":"Returns the employees an asset can be handed or transferred to — active, and with no termination package in\nprogress — alphabetically, with their number and department.\n\n**When to use:** to pick `employee_id` for `custodies.create` or `to_employee_id` for `custodies.transfer`;\nanyone not listed here would be refused. Send `exclude_id` with the current holder when transferring.\n\n**Prerequisites:** none. Needs \"Manage custody\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين يمكن تسليمهم عهدة","x-description-ar":"يعرض الموظفين الذين يمكن تسليمهم أصلاً أو نقله إليهم — النشطين وليس لديهم مخالصة نهاية خدمة جارية — مرتبين\nأبجدياً مع الرقم الوظيفي والقسم.\n\n**متى تستخدمه:** لاختيار `employee_id` في `custodies.create` أو `to_employee_id` في `custodies.transfer`؛ فمن\nلا يظهر هنا سيُرفض. أرسل `exclude_id` بالحامل الحالي عند النقل.\n\n**المتطلبات:** لا شيء. تحتاج «إدارة العهد».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[search]","in":"query","required":false,"schema":{"type":"string"},"description":"Name or employee number contains.","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على.","example":"Ahmed"},{"name":"exclude_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Leave this employee out (the current holder, when transferring).","x-description-ar":"استبعاد هذا الموظف (الحامل الحالي عند النقل).","example":1203},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Employees who can receive custody.","x-description-ar":"الموظفون الذين يمكن تسليمهم عهدة.","content":{"application/json":{"example":{"records":[{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"The employees.","x-description-ar":"الموظفون.","items":{"$ref":"#/components/schemas/custody_employee"}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/custodies/export":{"get":{"summary":"Download the custody list as a spreadsheet","operationId":"custodies.export","tags":["Custody"],"description":"Builds an Excel (`format=xlsx`) or CSV (`format=csv`) file of the rows `custodies.list` shows for the same\nfilters (held custody when no status is sent), with the columns you choose, headed in the requested\nlanguage. Up to 10,000 rows the file comes back in the response. Above that it is built in the background:\nthe answer is 202, and QHR emails the token owner when the file is ready to download from the export history\nin QHR. More than 20,000 rows is refused (`too_large`).\n\n**When to use:** to hand someone a file of the company's custody, e.g. for an asset count. To read the\nrecords, use `custodies.list`.\n\n**Prerequisites:** `columns[]` from `custodies.export_columns`. Needs \"Export HR data\" and \"View others'\ncustody\".\n\n**Side effects:** each export, refused ones included, is recorded in the company's export history and the\naudit log. One export of this list per user runs at a time (`export_in_progress`).\n\n**Not offered to Claude:** it returns a file, not JSON.","x-summary-ar":"تنزيل قائمة العهد في جدول بيانات","x-description-ar":"ينشئ ملف Excel (`format=xlsx`) أو CSV (`format=csv`) بالصفوف التي يعرضها `custodies.list` للمرشحات نفسها\n(العهد القائمة إن لم تُرسل حالة)، بالأعمدة التي تختارها وبعناوين بلغة الطلب. حتى ١٠٬٠٠٠ صف يعود الملف في\nالإجابة. وما زاد على ذلك يُبنى في الخلفية: تكون الإجابة 202، ويرسل QHR بريداً إلى صاحب الرمز حين يجهز الملف\nلتنزيله من سجل التصدير في QHR. ويُرفض ما يتجاوز ٢٠٬٠٠٠ صف (`too_large`).\n\n**متى تستخدمه:** لتسليم شخص ملفاً بعهد الشركة، مثلاً لجرد الأصول. لقراءة السجلات استخدم `custodies.list`.\n\n**المتطلبات:** `columns[]` من `custodies.export_columns`. تحتاج «تصدير بيانات الموارد البشرية» و«عرض عهد\nالآخرين».\n\n**الآثار الجانبية:** يُسجَّل كل تصدير، بما فيه المرفوض، في سجل التصدير في الشركة وفي سجل التدقيق. يعمل تصدير\nواحد لهذه القائمة لكل مستخدم في الوقت نفسه (`export_in_progress`).\n\n**غير متاح لـ Claude:** يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"}]},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format, `xlsx` or `csv`. Anything else, or none, answers 400 `bad_format`.","x-description-ar":"صيغة الملف، `xlsx` أو `csv`. وأي قيمة أخرى أو عدم الإرسال يُرجع 400 `bad_format`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"description":"The columns, in order (`key` from `custodies.export_columns`).","x-description-ar":"الأعمدة بالترتيب (`key` من `custodies.export_columns`).","example":["reference","employee_name","item","serial","value"]},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["held","returned","deducting","deducted"]},"description":"Only this status, as in `custodies.list`.","x-description-ar":"حالة محددة فقط، كما في `custodies.list`.","example":"held"},{"name":"q[search_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Holder's name or number, reference or serial contains.","x-description-ar":"اسم الحامل أو رقمه أو المرجع أو الرقم التسلسلي يحتوي على.","example":"Ahmed"}],"responses":{"200":{"description":"The file, Excel or CSV as asked.","x-description-ar":"الملف، Excel أو CSV حسب الطلب.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows for one response: the file is being built in the background.","x-description-ar":"الصفوف أكثر من أن تعود في إجابة واحدة: يُبنى الملف في الخلفية.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{},"text/csv":{}}},"400":{"description":"The format or columns are not valid.","x-description-ar":"الصيغة أو الأعمدة غير صحيحة.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No column was sent.","x-meaning-ar":"لم يُرسل أي عمود.","x-fix":"Send `columns[]` from the export columns operation.","x-fix-ar":"أرسل `columns[]` من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A column is unknown or not visible to the caller.","x-meaning-ar":"عمود غير معروف أو غير مرئي للمستدعي.","x-fix":"Use only `key`s from the export columns operation.","x-fix-ar":"استخدم فقط مفاتيح `key` من عملية أعمدة التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Column salary is not available on this page.","error_code":"unknown_column","code":"unknown_column"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this list is already running.","x-description-ar":"يجري تصدير لهذه القائمة حالياً.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by this user is still running.","x-meaning-ar":"تصدير لهذه الصفحة من المستخدم نفسه ما زال جارياً.","x-fix":"Wait for it to finish, then try again.","x-fix-ar":"انتظر حتى ينتهي ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress"}}}},"422":{"description":"Nothing, or too much, to export.","x-description-ar":"لا شيء للتصدير، أو أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا شيء يطابق المرشحات.","x-fix":"Change or remove the filters.","x-fix-ar":"غيّر المرشحات أو أزلها."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` say how many.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويوضح `row_count` و`max_rows` العدد.","x-fix":"Narrow the filters.","x-fix-ar":"ضيّق المرشحات."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"25000 rows is above the 20000 row limit. Narrow the filters or the date range.","error_code":"too_large","code":"too_large","row_count":25000,"max_rows":20000}}}}}}},"/custodies/export/columns":{"get":{"summary":"List the columns of the custody export","operationId":"custodies.export_columns","tags":["Custody"],"description":"Returns the columns the custody spreadsheet export can contain — key, heading in the request language,\nwhether it is included by default, and its type — limited to what the caller may see.\n\n**When to use:** before `custodies.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs \"Export HR data\" and \"View others' custody\".\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير العهد","x-description-ar":"يعرض الأعمدة التي يمكن أن يحتويها ملف تصدير العهد — المفتاح والعنوان بلغة الطلب وهل يُضمَّن افتراضياً\nونوعه — في حدود ما يحق للمستدعي رؤيته.\n\n**متى تستخدمه:** قبل `custodies.export` لاختيار الأعمدة `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الموارد البشرية» و«عرض عهد الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"}]},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns.","x-description-ar":"الأعمدة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"value","label":"Value","default":true,"type":"money"}]},"schema":{"$ref":"#/components/schemas/custody_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/custodies/stat_cards":{"get":{"summary":"Get custody totals","operationId":"custodies.stat_cards","tags":["Custody"],"description":"Returns the figures above HR's custody list: how many assets employees hold and their total value, how many\nemployees hold at least one, how many custody records are being deducted from salary and how much those\nstill owe. Takes the same filters as `custodies.list` except the status.\n\n**When to use:** for \"how much company equipment is out?\" or \"how much is still to be recovered?\". For the\nrecords themselves use `custodies.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض إجماليات العهد","x-description-ar":"يعرض الأرقام التي تعلو قائمة العهد: عدد الأصول التي يحملها الموظفون وقيمتها الإجمالية، وعدد الموظفين الذين\nيحملون أصلاً واحداً على الأقل، وعدد العهد التي يُستقطع ثمنها من الراتب وما تبقى عليها. يقبل تصفيات\n`custodies.list` نفسها عدا الحالة.\n\n**متى تستخدمه:** لأسئلة مثل \"كم من معدات الشركة لدى الموظفين؟\" أو \"كم بقي للاسترداد؟\". للسجلات نفسها استخدم\n`custodies.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[custody_category_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this category.","x-description-ar":"فئة محددة فقط.","example":2},{"name":"q[employee_department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only holders in this department.","x-description-ar":"الحاملون في هذا القسم فقط.","example":4},{"name":"q[search_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Holder's name or number, reference or serial contains.","x-description-ar":"اسم الحامل أو رقمه أو المرجع أو الرقم التسلسلي يحتوي على.","example":"Ahmed"}],"responses":{"200":{"description":"The totals.","x-description-ar":"الإجماليات.","content":{"application/json":{"example":{"held_count":42,"held_value":"268500.00","held_employees_count":31,"deducting_count":2,"remaining_deduction":"4500.00","currency":"SAR"},"schema":{"$ref":"#/components/schemas/custody_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/custodies/{id}":{"get":{"summary":"Get one custody record in full","operationId":"custodies.show","tags":["Custody"],"description":"Returns one custody record with everything HR sees in its drawer: holder, asset, serial and value, how it\ncame back and what that cost, who pays, the salary-deduction schedule with what has been paid, any\nsettlement, its full history (timeline, newest first, with the signed handover PDFs) and what the caller may\ndo next (`can_return`, `can_transfer`, `can_settle`, `settlement_blocker`).\n\n**When to use:** for questions about one asset, and before `custodies.return`, `custodies.transfer` or\n`custodies.settle` to check it can be done.\n\n**Prerequisites:** the custody `id`, from `custodies.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض سجل عهدة كاملاً","x-description-ar":"يعرض سجل عهدة واحداً بكل ما تراه الموارد البشرية: الحامل والأصل ورقمه التسلسلي وقيمته، وكيف أُعيد وكم\nكلّف، ومن يتحمل التكلفة، وجدول الاستقطاع من الراتب مع ما دُفع منه، وأي تسوية، وسجله الكامل (الأحدث أولاً،\nمع نماذج التسليم الموقَّعة) وما يمكن للمستدعي فعله بعد ذلك (`can_return` و`can_transfer` و`can_settle`\nو`settlement_blocker`).\n\n**متى تستخدمه:** للأسئلة عن أصل بعينه، وقبل `custodies.return` أو `custodies.transfer` أو `custodies.settle`\nللتأكد من إمكان تنفيذها.\n\n**المتطلبات:** رقم `id` العهدة من `custodies.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_id"}],"responses":{"200":{"description":"The custody record.","x-description-ar":"سجل العهدة.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null,"compensation_amount":null,"borne_by":null,"labor_law_cap":false,"amount_repaid":null,"outstanding":null,"settlement":null,"installments":[],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":true,"can_transfer":true,"can_settle":false,"settlement_blocker":null,"accounting_connected":false,"employee_termination_package":null}},"schema":{"$ref":"#/components/schemas/custody_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/custodies/{id}/return":{"post":{"summary":"Take an asset back from an employee","operationId":"custodies.return","tags":["Custody"],"description":"Records that a held asset came back, its condition, and — when `damaged` or `lost` — what it cost and who\npays (`borne_by`).\n\n- `intact`, or damaged/lost at the **company's** cost: the custody becomes `returned` and is closed.\n- Damaged/lost at the **employee's** cost: the custody becomes `deducting` and a salary-deduction schedule is\n  created — `installments_count` months, or with `labor_law_cap` as many months as needed so that no month\n  takes more than five days' wage (basic + allowances). Payroll deducts the installments from the return\n  month on, each as a line on the payslip.\n\nPreview the schedule first with `custodies.return_preview`; it runs the same checks.\n\n**When to use:** when an employee hands an asset back, or it is reported damaged or lost.\n\n**Prerequisites:** the custody `id` from `custodies.list` (status `held`). An employee-paid return is refused\nwhile the employee is leaving or has a termination package (the package recovers the cost instead). Needs\n\"Manage custody\", and a token owner linked to an employee record.\n\n**Side effects:** the custody's status, the schedule and a `returned` history entry with the PDF and the\nacting HR employee are saved together; recorded in the audit log. No one is notified. A return is final:\nthere is no operation that edits or undoes it.\n\n**Not offered to Claude:** it is final, can schedule deductions from someone's salary, and uploads a signed\nPDF (multipart).","x-summary-ar":"استلام أصل من موظف","x-description-ar":"يسجّل عودة أصل كان في العهدة وحالته، وعند `damaged` أو `lost` تكلفته ومن يتحملها (`borne_by`).\n\n- `intact` سليماً، أو تالفاً/مفقوداً على حساب **الشركة**: تصبح العهدة `returned` وتُغلق.\n- تالفاً/مفقوداً على حساب **الموظف**: تصبح العهدة `deducting` ويُنشأ جدول استقطاع من الراتب — بعدد أشهر\n  `installments_count`، أو مع `labor_law_cap` بعدد الأشهر اللازم كي لا يتجاوز استقطاع أي شهر أجر خمسة أيام\n  (الأساسي مع البدلات). يستقطع مسير الرواتب الأقساط ابتداءً من شهر الإعادة، كل قسط بنداً في قسيمة الراتب.\n\nعاين الجدول أولاً عبر `custodies.return_preview`؛ فهي تجري التحققات نفسها.\n\n**متى تستخدمه:** عندما يعيد موظف أصلاً، أو يُبلَّغ عن تلفه أو فقده.\n\n**المتطلبات:** رقم `id` العهدة من `custodies.list` (بحالة `held`). تُرفض الإعادة على حساب الموظف إن كان مغادراً\nأو لديه مخالصة نهاية خدمة (فالمخالصة هي التي تسترد التكلفة). تحتاج «إدارة العهد»، وأن يكون صاحب الرمز\nمرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** تُحفظ معاً حالة العهدة والجدول ومُدخل `returned` في السجل مع النموذج وموظف الموارد البشرية\nالمنفّذ، ويُسجَّل ذلك في سجل التدقيق. لا يُبلَّغ أحد. الإعادة نهائية: لا توجد عملية تعدّلها أو تتراجع عنها.\n\n**غير متاح لـ Claude:** نهائية، وقد تجدول استقطاعات من راتب شخص، وتتطلب رفع ملف PDF موقَّع (multipart).","x-access":"write","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_id"}],"requestBody":{"required":true,"description":"The return and its signed handover form.","x-description-ar":"الإعادة ونموذج التسليم الموقَّع.","content":{"multipart/form-data":{"schema":{"type":"object","required":["returned_on","condition","document"],"properties":{"returned_on":{"type":"string","format":"date","description":"Return date; not in the future, not before `held_since`.","x-description-ar":"تاريخ الإعادة؛ ليس في المستقبل ولا قبل `held_since`.","example":"2026-11-05"},"condition":{"type":"string","enum":["intact","damaged","lost"],"description":"`intact`, `damaged` or `lost`.","x-description-ar":"`intact` سليم، `damaged` تالف، `lost` مفقود.","example":"damaged"},"compensation_amount":{"type":"string","description":"Damaged or lost only: the cost, at most the value. For `lost`, the full value when omitted.","x-description-ar":"للتالف أو المفقود فقط: التكلفة، ولا تتجاوز القيمة. للمفقود تُعتبر القيمة كاملة إن لم تُرسل.","example":"3000.00"},"borne_by":{"type":"string","enum":["company","employee"],"description":"Damaged or lost only: who pays, `company` or `employee`.","x-description-ar":"للتالف أو المفقود فقط: من يدفع، `company` الشركة أو `employee` الموظف.","example":"employee"},"installments_count":{"type":"integer","minimum":1,"maximum":120,"description":"Employee-paid only: number of monthly deductions, 1 to 120. Ignored with `labor_law_cap`.","x-description-ar":"على حساب الموظف فقط: عدد الاستقطاعات الشهرية من 1 إلى 120. يُتجاهل مع `labor_law_cap`.","example":3},"labor_law_cap":{"type":"boolean","description":"Employee-paid only: let QHR set the months so none takes more than five days' wage.","x-description-ar":"على حساب الموظف فقط: دع QHR يحدد الأشهر كي لا يتجاوز أي شهر أجر خمسة أيام.","example":false},"document":{"type":"string","format":"binary","description":"The signed handover form, a PDF of at most 10 MB.","x-description-ar":"نموذج التسليم الموقَّع، ملف PDF لا يتجاوز ١٠ ميغابايت.","example":"handover.pdf"}}}}}},"responses":{"200":{"description":"The custody record after the return.","x-description-ar":"سجل العهدة بعد الإعادة.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"deducting","installments_paid":0,"installments_count":3,"returned_on":"2026-11-05","condition":"damaged","compensation_amount":"3000.00","borne_by":"employee","labor_law_cap":false,"amount_repaid":"0.00","outstanding":"3000.00","settlement":null,"installments":[{"id":901,"sequence":1,"due_on":"2026-11-01","amount":"1000.00","currency":"SAR","status":"due","payroll":null},{"id":902,"sequence":2,"due_on":"2026-12-01","amount":"1000.00","currency":"SAR","status":"due","payroll":null},{"id":903,"sequence":3,"due_on":"2027-01-01","amount":"1000.00","currency":"SAR","status":"due","payroll":null}],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":false,"can_transfer":false,"can_settle":true,"settlement_blocker":null,"accounting_connected":false,"employee_termination_package":null}},"schema":{"$ref":"#/components/schemas/custody_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The asset cannot be taken back.","x-description-ar":"لا يمكن استلام الأصل.","x-codes":[{"code":"not_held","meaning":"The asset is no longer held by an employee (returned or being deducted).","x-meaning-ar":"الأصل لم يعد في عهدة موظف (أُعيد أو يُستقطع ثمنه).","x-fix":"Check its status with `custodies.show`.","x-fix-ar":"تحقق من حالته عبر `custodies.show`."},{"code":"date_in_future","meaning":"The date is after today in the company time zone.","x-meaning-ar":"التاريخ بعد اليوم بحسب المنطقة الزمنية للشركة.","x-fix":"Send today or an earlier date.","x-fix-ar":"أرسل تاريخ اليوم أو ما قبله."},{"code":"date_before_held_since","meaning":"The date is before the current holder received the asset.","x-meaning-ar":"التاريخ قبل استلام الحامل الحالي للأصل.","x-fix":"Send a date on or after `held_since`.","x-fix-ar":"أرسل تاريخاً في `held_since` أو بعده."},{"code":"condition_required","meaning":"`condition` is missing or not `intact`, `damaged` or `lost`.","x-meaning-ar":"`condition` مفقود أو ليس `intact` أو `damaged` أو `lost`.","x-fix":"Send one of the three.","x-fix-ar":"أرسل إحدى القيم الثلاث."},{"code":"document_required","meaning":"The signed handover form is missing.","x-meaning-ar":"نموذج التسليم الموقَّع غير مرفق.","x-fix":"Attach it as `document`, a PDF.","x-fix-ar":"أرفقه في `document` بصيغة PDF."},{"code":"document_invalid","meaning":"The handover form is not a PDF, or is over 10 MB.","x-meaning-ar":"نموذج التسليم ليس PDF أو يتجاوز ١٠ ميغابايت.","x-fix":"Attach a PDF of at most 10 MB.","x-fix-ar":"أرفق ملف PDF لا يتجاوز ١٠ ميغابايت."},{"code":"amount_required","meaning":"A damaged asset needs a compensation amount above zero.","x-meaning-ar":"الأصل التالف يحتاج مبلغ تعويض أكبر من صفر.","x-fix":"Send `compensation_amount`.","x-fix-ar":"أرسل `compensation_amount`."},{"code":"amount_exceeds_value","meaning":"The compensation is more than the custody value.","x-meaning-ar":"التعويض أكبر من قيمة العهدة.","x-fix":"Send at most the `value` shown by `custodies.show`.","x-fix-ar":"أرسل مبلغاً لا يتجاوز `value` الظاهرة في `custodies.show`."},{"code":"borne_by_required","meaning":"`borne_by` is missing or not `company` / `employee`.","x-meaning-ar":"`borne_by` مفقود أو ليس `company` أو `employee`.","x-fix":"Say who pays.","x-fix-ar":"حدّد من يدفع."},{"code":"employee_has_package","meaning":"The employee is leaving or has a termination package, so the cost cannot be recovered in installments.","x-meaning-ar":"الموظف مغادر أو لديه مخالصة نهاية خدمة، فلا يمكن استرداد التكلفة بالأقساط.","x-fix":"Return it at the company cost, or let the termination package recover it.","x-fix-ar":"أعِده على حساب الشركة، أو دع المخالصة تسترد التكلفة."},{"code":"installments_required","meaning":"No number of installments was given.","x-meaning-ar":"لم يُحدد عدد الأقساط.","x-fix":"Send `installments_count` (1 or more), or `labor_law_cap: true`.","x-fix-ar":"أرسل `installments_count` (1 أو أكثر)، أو `labor_law_cap: true`."},{"code":"installments_count_invalid","meaning":"More than 120 installments, or under 0.01 each.","x-meaning-ar":"أكثر من ١٢٠ قسطاً، أو أقل من 0.01 للقسط.","x-fix":"Choose fewer months.","x-fix-ar":"اختر عدد أشهر أقل."},{"code":"no_active_salary","meaning":"The labour-law cap needs the employee active salary, above zero.","x-meaning-ar":"حد نظام العمل يحتاج راتباً نشطاً للموظف أكبر من صفر.","x-fix":"Set the salary, or send `installments_count` instead of `labor_law_cap`.","x-fix-ar":"أدخل الراتب، أو أرسل `installments_count` بدلاً من `labor_law_cap`."},{"code":"employee_required","meaning":"The token owner is a user with no employee record; the operation records who acted, so it needs one.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي؛ والعملية تسجّل من قام بالإجراء فتحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The compensation cannot be more than the custody value (8500.00)","error_code":"amount_exceeds_value","code":"amount_exceeds_value"}}}}}}},"/custodies/{id}/return_preview":{"post":{"summary":"Preview the salary deductions of a return","operationId":"custodies.return_preview","tags":["Custody"],"description":"Works out, without saving anything, the salary-deduction schedule that `custodies.return` would create for\na damaged or lost asset the employee pays for: how many monthly installments, the regular and last amounts,\nthe first month, every row, and — with `labor_law_cap` — the monthly cap of five days' wage and the wage it\ncomes from. Deductions start with the payroll of the return month.\n\n**When to use:** before returning an asset at the employee's cost, to show them what will be deducted. It\nis a POST only because it takes the return's details; it saves nothing, so a read token may call it.\n\n**Prerequisites:** the custody `id` from `custodies.list` (it must be held). Needs \"Manage custody\".\n\n**Side effects:** none — nothing is saved, no one is notified.\n\n**Not offered to Claude:** the answer carries the employee's monthly wage (`monthly_wage`), which the\ncustody permission alone should not bring into a chat.","x-summary-ar":"معاينة استقطاعات الراتب عند إعادة عهدة","x-description-ar":"يحسب دون حفظ أي شيء جدول الاستقطاع من الراتب الذي سينشئه `custodies.return` لأصل تالف أو مفقود يتحمل\nالموظف ثمنه: عدد الأقساط الشهرية، والمبلغ المعتاد والأخير، والشهر الأول، وكل الأقساط، ومع `labor_law_cap`\nالحد الشهري بأجر خمسة أيام والأجر الذي حُسب منه. يبدأ الاستقطاع من مسير رواتب شهر الإعادة.\n\n**متى تستخدمه:** قبل إعادة أصل على حساب الموظف، لتوضيح ما سيُستقطع منه. هي من نوع POST فقط لأنها تستقبل\nتفاصيل الإعادة؛ ولا تحفظ شيئاً، لذا يمكن استدعاؤها برمز للقراءة.\n\n**المتطلبات:** رقم `id` العهدة من `custodies.list` (ويجب أن تكون في العهدة). تحتاج «إدارة العهد».\n\n**الآثار الجانبية:** لا شيء — لا يُحفظ شيء ولا يُبلَّغ أحد.\n\n**لا يُعرض على Claude:** تتضمن الإجابة الأجر الشهري للموظف (`monthly_wage`)، ولا ينبغي أن تكفي صلاحية\nالعهد وحدها لإظهاره في محادثة.","x-access":"read","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_id"}],"responses":{"200":{"description":"The schedule the return would create.","x-description-ar":"الجدول الذي ستنشئه الإعادة.","content":{"application/json":{"example":{"count":3,"per_installment":"1000.00","last_installment":"1000.00","monthly_cap":null,"monthly_wage":null,"first_due_on":"2026-11-01","schedule":[{"sequence":1,"due_on":"2026-11-01","amount":"1000.00"},{"sequence":2,"due_on":"2026-12-01","amount":"1000.00"},{"sequence":3,"due_on":"2027-01-01","amount":"1000.00"}],"currency":"SAR"},"schema":{"type":"object","properties":{"count":{"type":"integer","description":"Number of monthly installments.","x-description-ar":"عدد الأقساط الشهرية."},"per_installment":{"type":"string","description":"Regular installment.","x-description-ar":"القسط المعتاد."},"last_installment":{"type":"string","description":"Last installment (absorbs the rounding).","x-description-ar":"القسط الأخير (يستوعب فرق التقريب)."},"monthly_cap":{"type":"string","description":"Five days' wage, with `labor_law_cap`; else null.","x-description-ar":"أجر خمسة أيام مع `labor_law_cap`؛ وإلا null.","nullable":true},"monthly_wage":{"type":"string","description":"Basic salary plus allowances the cap is based on; else null.","x-description-ar":"الراتب الأساسي مع البدلات الذي بُني عليه الحد؛ وإلا null.","nullable":true},"first_due_on":{"type":"string","description":"Month of the first deduction.","x-description-ar":"شهر أول استقطاع.","format":"date"},"schedule":{"type":"array","description":"Every installment.","x-description-ar":"كل الأقساط.","items":{"type":"object","properties":{"sequence":{"type":"integer","description":"Installment number.","x-description-ar":"رقم القسط."},"due_on":{"type":"string","description":"Payroll month.","x-description-ar":"شهر المسير.","format":"date"},"amount":{"type":"string","description":"Amount.","x-description-ar":"المبلغ."}}}},"currency":{"type":"string","description":"Currency (the holder's pay currency).","x-description-ar":"العملة (عملة راتب الحامل)."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"No schedule can be shown.","x-description-ar":"لا يمكن عرض جدول.","x-codes":[{"code":"not_held","meaning":"The asset is no longer held by an employee (returned or being deducted).","x-meaning-ar":"الأصل لم يعد في عهدة موظف (أُعيد أو يُستقطع ثمنه).","x-fix":"Check its status with `custodies.show`.","x-fix-ar":"تحقق من حالته عبر `custodies.show`."},{"code":"date_in_future","meaning":"The date is after today in the company time zone.","x-meaning-ar":"التاريخ بعد اليوم بحسب المنطقة الزمنية للشركة.","x-fix":"Send today or an earlier date.","x-fix-ar":"أرسل تاريخ اليوم أو ما قبله."},{"code":"date_before_held_since","meaning":"The date is before the current holder received the asset.","x-meaning-ar":"التاريخ قبل استلام الحامل الحالي للأصل.","x-fix":"Send a date on or after `held_since`.","x-fix-ar":"أرسل تاريخاً في `held_since` أو بعده."},{"code":"condition_required","meaning":"`condition` is missing or not `intact`, `damaged` or `lost`.","x-meaning-ar":"`condition` مفقود أو ليس `intact` أو `damaged` أو `lost`.","x-fix":"Send one of the three.","x-fix-ar":"أرسل إحدى القيم الثلاث."},{"code":"not_employee_paid","meaning":"Only a damaged or lost asset the employee pays for has a schedule.","x-meaning-ar":"الجدول فقط لأصل تالف أو مفقود يتحمل الموظف ثمنه.","x-fix":"Send `condition` `damaged` or `lost` and `borne_by: employee`.","x-fix-ar":"أرسل `condition` بقيمة `damaged` أو `lost` و`borne_by: employee`."},{"code":"amount_required","meaning":"A damaged asset needs a compensation amount above zero.","x-meaning-ar":"الأصل التالف يحتاج مبلغ تعويض أكبر من صفر.","x-fix":"Send `compensation_amount`.","x-fix-ar":"أرسل `compensation_amount`."},{"code":"amount_exceeds_value","meaning":"The compensation is more than the custody value.","x-meaning-ar":"التعويض أكبر من قيمة العهدة.","x-fix":"Send at most the `value` shown by `custodies.show`.","x-fix-ar":"أرسل مبلغاً لا يتجاوز `value` الظاهرة في `custodies.show`."},{"code":"borne_by_required","meaning":"`borne_by` is missing or not `company` / `employee`.","x-meaning-ar":"`borne_by` مفقود أو ليس `company` أو `employee`.","x-fix":"Say who pays.","x-fix-ar":"حدّد من يدفع."},{"code":"employee_has_package","meaning":"The employee is leaving or has a termination package, so the cost cannot be recovered in installments.","x-meaning-ar":"الموظف مغادر أو لديه مخالصة نهاية خدمة، فلا يمكن استرداد التكلفة بالأقساط.","x-fix":"Return it at the company cost, or let the termination package recover it.","x-fix-ar":"أعِده على حساب الشركة، أو دع المخالصة تسترد التكلفة."},{"code":"installments_required","meaning":"No number of installments was given.","x-meaning-ar":"لم يُحدد عدد الأقساط.","x-fix":"Send `installments_count` (1 or more), or `labor_law_cap: true`.","x-fix-ar":"أرسل `installments_count` (1 أو أكثر)، أو `labor_law_cap: true`."},{"code":"installments_count_invalid","meaning":"More than 120 installments, or under 0.01 each.","x-meaning-ar":"أكثر من ١٢٠ قسطاً، أو أقل من 0.01 للقسط.","x-fix":"Choose fewer months.","x-fix-ar":"اختر عدد أشهر أقل."},{"code":"no_active_salary","meaning":"The labour-law cap needs the employee active salary, above zero.","x-meaning-ar":"حد نظام العمل يحتاج راتباً نشطاً للموظف أكبر من صفر.","x-fix":"Set the salary, or send `installments_count` instead of `labor_law_cap`.","x-fix-ar":"أدخل الراتب، أو أرسل `installments_count` بدلاً من `labor_law_cap`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Installments apply only to a damaged or lost item the employee pays for","error_code":"not_employee_paid","code":"not_employee_paid"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["returned_on","condition","borne_by"],"properties":{"returned_on":{"type":"string","description":"Return date; not in the future, not before `held_since`.","x-description-ar":"تاريخ الإعادة؛ ليس في المستقبل ولا قبل `held_since`.","format":"date"},"condition":{"type":"string","description":"`damaged` or `lost`.","x-description-ar":"`damaged` تالف أو `lost` مفقود.","enum":["intact","damaged","lost"]},"compensation_amount":{"type":"string","description":"Cost to recover, at most the value. For `lost`, the full value when omitted.","x-description-ar":"التكلفة المطلوب استردادها، لا تتجاوز القيمة. للمفقود تُعتبر القيمة كاملة إن لم تُرسل."},"borne_by":{"type":"string","description":"`employee` (a schedule exists only then).","x-description-ar":"`employee` (الجدول لا يوجد إلا عندها).","enum":["company","employee"]},"installments_count":{"type":"integer","description":"Number of months, 1 to 120. Ignored with `labor_law_cap`.","x-description-ar":"عدد الأشهر من 1 إلى 120. يُتجاهل مع `labor_law_cap`."},"labor_law_cap":{"type":"boolean","description":"Let QHR set the months so no month takes more than five days' wage (needs an active salary).","x-description-ar":"دع QHR يحدد عدد الأشهر بحيث لا يتجاوز استقطاع أي شهر أجر خمسة أيام (يحتاج راتباً نشطاً)."}}},"example":{"returned_on":"2026-11-05","condition":"damaged","compensation_amount":"3000.00","borne_by":"employee","installments_count":3}}},"required":true,"description":"The return being considered."}}},"/custodies/{id}/settle":{"post":{"summary":"Settle a custody balance paid in cash","operationId":"custodies.settle","tags":["Custody"],"description":"Records that the employee paid the rest of a damage or loss cost in cash. The whole `outstanding` balance is\nsettled: the custody becomes `deducted`, and the installments payroll has not yet taken are cancelled, so\nnothing more is deducted from the employee's salary. Installments already deducted stay as they are.\n\n**When to use:** when an employee repays a `deducting` custody early, outside payroll. A custody claimed by\na termination package is settled by that package, not here.\n\n**Prerequisites:** the custody `id` from `custodies.list` (status `deducting`, `can_settle` true in\n`custodies.show`). Refused while a payroll run holds an unpaid installment of it (`installment_in_flight`):\nfinish or revert that run first. Needs \"Manage custody\", and a token owner linked to an employee record.\n\n**Side effects:** a `settled` history entry with the amount, reason and acting HR employee; recorded in the\naudit log. No payment record is created and nothing is sent to Qoyod accounting — a connected company books\nthe cash by hand (`accounting_connected`). No one is notified. A settlement cannot be undone.\n\n**Not offered to Claude:** it records money received and cancels salary deductions, and cannot be undone.","x-summary-ar":"تسوية رصيد عهدة دُفع نقداً","x-description-ar":"يسجّل أن الموظف دفع نقداً ما تبقى من تكلفة التلف أو الفقد. يُسوّى رصيد `outstanding` كاملاً: تصبح العهدة\n`deducted`، وتُلغى الأقساط التي لم يستقطعها مسير الرواتب بعد، فلا يُستقطع من راتب الموظف شيء آخر. وتبقى\nالأقساط المستقطعة سابقاً كما هي.\n\n**متى تستخدمه:** عندما يسدد الموظف عهدة بحالة `deducting` مبكراً خارج مسير الرواتب. العهدة التي ضمّتها مخالصة\nنهاية خدمة تُسوّى بالمخالصة لا هنا.\n\n**المتطلبات:** رقم `id` العهدة من `custodies.list` (بحالة `deducting`، و`can_settle` صحيح في\n`custodies.show`). تُرفض ما دام في مسير رواتب قسط منها لم يُدفع (`installment_in_flight`): أكمل ذلك المسير أو\nتراجع عنه أولاً. تحتاج «إدارة العهد»، وأن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يُضاف إلى السجل مُدخل `settled` بالمبلغ والسبب وموظف الموارد البشرية المنفّذ، ويُسجَّل في\nسجل التدقيق. لا يُنشأ سجل دفعة ولا يُرسل شيء إلى محاسبة قيود — الشركة المرتبطة تقيّد المبلغ النقدي يدوياً\n(`accounting_connected`). لا يُبلَّغ أحد. لا يمكن التراجع عن التسوية.\n\n**غير متاح لـ Claude:** يسجّل استلام مال ويلغي استقطاعات من الراتب، ولا يمكن التراجع عنه.","x-access":"write","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_id"}],"responses":{"200":{"description":"The custody record, settled.","x-description-ar":"سجل العهدة بعد التسوية.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"deducted","installments_paid":0,"installments_count":3,"returned_on":"2026-11-05","condition":"damaged","compensation_amount":"3000.00","borne_by":"employee","labor_law_cap":false,"amount_repaid":"0.00","outstanding":"0.00","settlement":{"amount":"3000.00","date":"2026-11-20","source":"cash","reason":"Paid the remaining balance in cash at the finance office.","termination_package":null},"installments":[],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":false,"can_transfer":false,"can_settle":false,"settlement_blocker":null,"accounting_connected":false,"employee_termination_package":null}},"schema":{"$ref":"#/components/schemas/custody_record"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The balance cannot be settled.","x-description-ar":"لا يمكن تسوية الرصيد.","x-codes":[{"code":"claimed_by_package","meaning":"A termination package recovers this balance.","x-meaning-ar":"مخالصة نهاية خدمة تسترد هذا الرصيد.","x-fix":"Leave it to the package.","x-fix-ar":"اتركه للمخالصة."},{"code":"not_deducting","meaning":"The custody is not being deducted, so there is nothing to settle.","x-meaning-ar":"العهدة لا يُستقطع ثمنها، فلا شيء للتسوية.","x-fix":"Check its status with `custodies.show`.","x-fix-ar":"تحقق من حالتها عبر `custodies.show`."},{"code":"nothing_outstanding","meaning":"Payroll has already recovered the whole balance.","x-meaning-ar":"استرد مسير الرواتب الرصيد كاملاً.","x-fix":"Nothing to do.","x-fix-ar":"لا حاجة لأي إجراء."},{"code":"installment_in_flight","meaning":"A payroll run holds an unpaid installment of this custody.","x-meaning-ar":"في مسير رواتب قسط غير مدفوع من هذه العهدة.","x-fix":"Finish or revert that payroll run first.","x-fix-ar":"أكمل ذلك المسير أو تراجع عنه أولاً."},{"code":"date_in_future","meaning":"The date is after today in the company time zone.","x-meaning-ar":"التاريخ بعد اليوم بحسب المنطقة الزمنية للشركة.","x-fix":"Send today or an earlier date.","x-fix-ar":"أرسل تاريخ اليوم أو ما قبله."},{"code":"date_before_returned_on","meaning":"The settlement date is before the return.","x-meaning-ar":"تاريخ التسوية قبل تاريخ الإعادة.","x-fix":"Send a date on or after `returned_on`.","x-fix-ar":"أرسل تاريخاً في `returned_on` أو بعده."},{"code":"reason_required","meaning":"The settlement has no reason.","x-meaning-ar":"التسوية بلا سبب.","x-fix":"Send `reason`.","x-fix-ar":"أرسل `reason`."},{"code":"employee_required","meaning":"The token owner is a user with no employee record; the operation records who acted, so it needs one.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي؛ والعملية تسجّل من قام بالإجراء فتحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"CUS-0042 is not being deducted, so there is nothing to settle","error_code":"not_deducting","code":"not_deducting"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["settlement_date","reason"],"properties":{"settlement_date":{"type":"string","description":"Day the cash was received; not in the future, not before the return.","x-description-ar":"يوم استلام المبلغ النقدي؛ ليس في المستقبل ولا قبل الإعادة.","format":"date"},"reason":{"type":"string","description":"Why it is settled in cash.","x-description-ar":"سبب التسوية النقدية."}}},"example":{"settlement_date":"2026-11-20","reason":"Paid the remaining balance in cash at the finance office."}}},"required":true,"description":"The cash settlement."}}},"/custodies/{id}/transfer":{"post":{"summary":"Move an asset to another employee","operationId":"custodies.transfer","tags":["Custody"],"description":"Moves a held asset from its current holder to another employee on a date, with the signed handover form. It\nstays the same custody record — same reference, value and status; only the holder and `held_since` change.\n\n**When to use:** when an asset changes hands without coming back to the company first. To take it back,\nuse `custodies.return`.\n\n**Prerequisites:** the custody `id` from `custodies.list` (status `held`); `to_employee_id` from\n`custodies.employee_options` (send `exclude_id` = the current holder). Needs \"Manage custody\", and a token\nowner linked to an employee record.\n\n**Side effects:** a `transferred` entry, with the PDF, the previous and new holder and the acting HR\nemployee, is added to the history; recorded in the audit log. No one is notified.\n\n**Not offered to Claude:** it uploads a signed PDF (multipart), which a chat cannot provide.","x-summary-ar":"نقل أصل إلى موظف آخر","x-description-ar":"ينقل أصلاً في العهدة من حامله الحالي إلى موظف آخر بتاريخ محدد، مع نموذج التسليم الموقَّع. يبقى سجل العهدة\nنفسه — المرجع والقيمة والحالة ذاتها؛ ولا يتغير إلا الحامل و`held_since`.\n\n**متى تستخدمه:** عندما ينتقل الأصل من يد إلى يد دون أن يعود إلى الشركة أولاً. لاستلامه استخدم\n`custodies.return`.\n\n**المتطلبات:** رقم `id` العهدة من `custodies.list` (بحالة `held`)، و`to_employee_id` من\n`custodies.employee_options` (أرسل `exclude_id` بالحامل الحالي). تحتاج «إدارة العهد»، وأن يكون صاحب الرمز\nمرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يُضاف إلى السجل مُدخل `transferred` مع النموذج والحامل السابق والجديد وموظف الموارد\nالبشرية المنفّذ، ويُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.\n\n**غير متاح لـ Claude:** يتطلب رفع ملف PDF موقَّع (multipart)، وهذا لا يتوفر في المحادثة.","x-access":"write","x-permission":{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_id"}],"requestBody":{"required":true,"description":"The transfer and its signed handover form.","x-description-ar":"النقل ونموذج التسليم الموقَّع.","content":{"multipart/form-data":{"schema":{"type":"object","required":["to_employee_id","transferred_on","document"],"properties":{"to_employee_id":{"type":"integer","description":"The new holder (id from `custodies.employee_options`).","x-description-ar":"الحامل الجديد (الرقم من `custodies.employee_options`).","example":1310},"transferred_on":{"type":"string","format":"date","description":"Transfer date; not in the future, not before `held_since`.","x-description-ar":"تاريخ النقل؛ ليس في المستقبل ولا قبل `held_since`.","example":"2026-11-20"},"document":{"type":"string","format":"binary","description":"The signed handover form, a PDF of at most 10 MB.","x-description-ar":"نموذج التسليم الموقَّع، ملف PDF لا يتجاوز ١٠ ميغابايت.","example":"handover.pdf"}}}}}},"responses":{"200":{"description":"The custody record, with its new holder.","x-description-ar":"سجل العهدة مع حامله الجديد.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null,"compensation_amount":null,"borne_by":null,"labor_law_cap":false,"amount_repaid":null,"outstanding":null,"settlement":null,"installments":[],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":true,"can_transfer":true,"can_settle":false,"settlement_blocker":null,"accounting_connected":false,"employee_termination_package":null}},"schema":{"$ref":"#/components/schemas/custody_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The asset cannot be moved.","x-description-ar":"لا يمكن نقل الأصل.","x-codes":[{"code":"not_held","meaning":"The asset is no longer held by an employee (returned or being deducted).","x-meaning-ar":"الأصل لم يعد في عهدة موظف (أُعيد أو يُستقطع ثمنه).","x-fix":"Check its status with `custodies.show`.","x-fix-ar":"تحقق من حالته عبر `custodies.show`."},{"code":"same_employee","meaning":"The new holder is the current holder.","x-meaning-ar":"الحامل الجديد هو الحامل الحالي نفسه.","x-fix":"Choose a different employee.","x-fix-ar":"اختر موظفاً آخر."},{"code":"employee_not_assignable","meaning":"The employee is not active, is serving notice, or has a termination package.","x-meaning-ar":"الموظف غير نشط أو في فترة الإشعار أو لديه مخالصة نهاية خدمة.","x-fix":"Choose someone from `custodies.employee_options`.","x-fix-ar":"اختر موظفاً من `custodies.employee_options`."},{"code":"date_in_future","meaning":"The date is after today in the company time zone.","x-meaning-ar":"التاريخ بعد اليوم بحسب المنطقة الزمنية للشركة.","x-fix":"Send today or an earlier date.","x-fix-ar":"أرسل تاريخ اليوم أو ما قبله."},{"code":"date_before_held_since","meaning":"The date is before the current holder received the asset.","x-meaning-ar":"التاريخ قبل استلام الحامل الحالي للأصل.","x-fix":"Send a date on or after `held_since`.","x-fix-ar":"أرسل تاريخاً في `held_since` أو بعده."},{"code":"document_required","meaning":"The signed handover form is missing.","x-meaning-ar":"نموذج التسليم الموقَّع غير مرفق.","x-fix":"Attach it as `document`, a PDF.","x-fix-ar":"أرفقه في `document` بصيغة PDF."},{"code":"document_invalid","meaning":"The handover form is not a PDF, or is over 10 MB.","x-meaning-ar":"نموذج التسليم ليس PDF أو يتجاوز ١٠ ميغابايت.","x-fix":"Attach a PDF of at most 10 MB.","x-fix-ar":"أرفق ملف PDF لا يتجاوز ١٠ ميغابايت."},{"code":"employee_required","meaning":"The token owner is a user with no employee record; the operation records who acted, so it needs one.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي؛ والعملية تسجّل من قام بالإجراء فتحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose a different employee from the current holder","error_code":"same_employee","code":"same_employee"}}}}}}},"/custody_categories":{"get":{"summary":"List custody categories and their items","operationId":"custody_categories.list","tags":["Custody settings"],"description":"Returns every custody category — QHR's defaults first, then oldest first — each with its items (by name),\ntheir default value, whether a serial is required, whether they are available, and how many employees hold\neach now. Also returns `icons`, the icon keys a category may use. Not paginated.\n\n**When to use:** to find `custody_item_id` for `custodies.create`, category and item ids for the\n`custodies.list` filters, or to answer \"what kinds of assets do we hand out?\". With `for_assign=true` only\navailable items are listed, and categories left empty are dropped.\n\n**Prerequisites:** none. Any of \"View others' custody\", \"Manage custody\" or \"Custody settings\" is enough.\n\n**Side effects:** none.","x-summary-ar":"عرض فئات العهد وأصنافها","x-description-ar":"يعرض كل فئات العهد — الافتراضية أولاً ثم الأقدم — مع أصناف كل فئة (مرتبة بالاسم) وقيمتها الافتراضية وهل يلزمها\nرقم تسلسلي وهل هي متاحة وعدد من يحملها الآن. ويعيد أيضاً `icons`، مفاتيح الأيقونات المتاحة للفئة. بلا صفحات.\n\n**متى تستخدمه:** لمعرفة `custody_item_id` لـ `custodies.create`، أو أرقام الفئات والأصناف لتصفية\n`custodies.list`، أو للإجابة عن \"ما أنواع الأصول التي نسلّمها؟\". مع `for_assign=true` تظهر الأصناف المتاحة فقط\nوتُحذف الفئات التي تبقى فارغة.\n\n**المتطلبات:** لا شيء. تكفي إحدى الصلاحيات «عرض عهد الآخرين» أو «إدارة العهد» أو «إعدادات العهد».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها","x-any-of":[{"key":"custody/view_others","label":"View every employee's custody, its details and stats","x-label-ar":"عرض عهد جميع الموظفين وتفاصيلها وإحصائياتها"},{"key":"custody/manage_custody","label":"Assign, transfer, return and settle custody","x-label-ar":"تسليم العهد ونقلها واستلامها وتسويتها"},{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"}]},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"for_assign","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` lists only available items and drops categories left with none.","x-description-ar":"`true` يعرض الأصناف المتاحة فقط ويحذف الفئات التي لا يبقى فيها صنف.","example":true}],"responses":{"200":{"description":"The categories with their items.","x-description-ar":"الفئات مع أصنافها.","content":{"application/json":{"example":{"records":[{"id":2,"name":"Devices","name_en":"Devices","name_ar":"أجهزة","icon":"devices","is_default":true,"department":{"id":6,"name":"IT"},"items_count":1,"items":[{"id":7,"custody_category_id":2,"name":"MacBook Pro 14","serial_required":true,"available":true,"default_value":"8500.00","currency":"SAR","in_use":true,"held_custody_count":12}]}],"icons":["devices","vehicles","keys","phones","tools","other"]},"schema":{"type":"object","required":["records","icons"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/custody_category"},"description":"The categories.","x-description-ar":"الفئات."},"icons":{"type":"array","items":{"type":"string"},"description":"Icon keys a category may use.","x-description-ar":"مفاتيح الأيقونات المتاحة للفئة."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create a custody category","operationId":"custody_categories.create","tags":["Custody settings"],"description":"Adds a category to group assets under (e.g. \"Vehicles\"), with an English and/or Arabic name, an icon and,\nfor information, the department responsible.\n\n**When to use:** when the company starts handing out a new kind of asset. Add the assets themselves with\n`custody_items.create`.\n\n**Prerequisites:** `department_id` from `employees.meta_data` (optional). Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log. Nothing else.\n\n**Not offered to Claude:** it changes company configuration, which an admin should do in QHR.","x-summary-ar":"إنشاء فئة عهد","x-description-ar":"يضيف فئة تُجمَّع تحتها الأصول (مثل \"مركبات\")، باسم إنجليزي و/أو عربي وأيقونة، وللعلم القسم المسؤول.\n\n**متى تستخدمه:** عندما تبدأ الشركة بتسليم نوع جديد من الأصول. أضف الأصول نفسها عبر `custody_items.create`.\n\n**المتطلبات:** `department_id` من `employees.meta_data` (اختياري). تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا شيء غير ذلك.\n\n**غير متاح لـ Claude:** يغيّر إعدادات الشركة، وهذا يجريه مسؤول النظام من QHR.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new category.","x-description-ar":"الفئة الجديدة.","content":{"application/json":{"example":{"record":{"id":5,"name":"Vehicles","name_en":"Vehicles","name_ar":"مركبات","icon":"vehicles","is_default":false,"department":{"id":6,"name":"IT"},"items_count":0,"items":[]}},"schema":{"$ref":"#/components/schemas/custody_category_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["icon"],"properties":{"name_en":{"type":"string","description":"English name. At least one of `name_en` / `name_ar`; each unique.","x-description-ar":"الاسم بالإنجليزية. يلزم أحد `name_en` أو `name_ar` على الأقل؛ وكل منهما فريد."},"name_ar":{"type":"string","description":"Arabic name.","x-description-ar":"الاسم بالعربية."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة.","enum":["devices","vehicles","keys","phones","tools","other"]},"department_id":{"type":"integer","description":"Department responsible (information only), id from `employees.meta_data`.","x-description-ar":"القسم المسؤول (للعلم فقط)، الرقم من `employees.meta_data`.","nullable":true}}},"example":{"name_en":"Vehicles","name_ar":"مركبات","icon":"vehicles","department_id":6}}},"required":true,"description":"The new category."}}},"/custody_categories/{id}":{"patch":{"summary":"Update a custody category","operationId":"custody_categories.update","tags":["Custody settings"],"description":"Changes the fields you send — names, icon, department — and leaves the rest. Existing custody keeps the\ncategory name it was handed over under.\n\n**When to use:** to rename a category or change its icon or department.\n\n**Prerequisites:** the category `id` from `custody_categories.list`. Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log.\n\n**Not offered to Claude:** it changes company configuration, which an admin should do in QHR.","x-summary-ar":"تعديل فئة عهد","x-description-ar":"يعدّل الحقول المرسلة فقط — الأسماء والأيقونة والقسم — ويترك الباقي. تحتفظ العهد القائمة باسم الفئة الذي سُلّمت\nتحته.\n\n**متى تستخدمه:** لإعادة تسمية فئة أو تغيير أيقونتها أو قسمها.\n\n**المتطلبات:** رقم `id` الفئة من `custody_categories.list`. تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق.\n\n**غير متاح لـ Claude:** يغيّر إعدادات الشركة، وهذا يجريه مسؤول النظام من QHR.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_category_id"}],"responses":{"200":{"description":"The category.","x-description-ar":"الفئة.","content":{"application/json":{"example":{"record":{"id":2,"name":"Company laptops","name_en":"Company laptops","name_ar":"أجهزة","icon":"devices","is_default":true,"department":{"id":6,"name":"IT"},"items_count":1,"items":[{"id":7,"custody_category_id":2,"name":"MacBook Pro 14","serial_required":true,"available":true,"default_value":"8500.00","currency":"SAR","in_use":true,"held_custody_count":12}]}},"schema":{"$ref":"#/components/schemas/custody_category_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name_en":{"type":"string","description":"English name. At least one of `name_en` / `name_ar`; each unique.","x-description-ar":"الاسم بالإنجليزية. يلزم أحد `name_en` أو `name_ar` على الأقل؛ وكل منهما فريد."},"name_ar":{"type":"string","description":"Arabic name.","x-description-ar":"الاسم بالعربية."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة.","enum":["devices","vehicles","keys","phones","tools","other"]},"department_id":{"type":"integer","description":"Department responsible (information only), id from `employees.meta_data`.","x-description-ar":"القسم المسؤول (للعلم فقط)، الرقم من `employees.meta_data`.","nullable":true}}},"example":{"name_en":"Company laptops"}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete an empty custody category","operationId":"custody_categories.delete","tags":["Custody settings"],"description":"Deletes a category that has no items. A category with items is refused; delete its unused items first\n(`custody_items.delete`) — items with custody can only be made unavailable, so such a category stays.\n\n**When to use:** to tidy up a category created by mistake or no longer used.\n\n**Prerequisites:** the category `id` from `custody_categories.list` (`items_count` 0). Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log. Permanent.\n\n**Not offered to Claude:** deletes are permanent.","x-summary-ar":"حذف فئة عهد فارغة","x-description-ar":"يحذف فئة لا أصناف فيها. وتُرفض الفئة التي فيها أصناف؛ احذف أصنافها غير المستخدمة أولاً (`custody_items.delete`)\n— والأصناف التي لها عهد يمكن إيقافها فقط، فتبقى فئتها.\n\n**متى تستخدمه:** لتنظيف فئة أُنشئت خطأً أو لم تعد مستخدمة.\n\n**المتطلبات:** رقم `id` الفئة من `custody_categories.list` (و`items_count` صفر). تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. الحذف نهائي.\n\n**غير متاح لـ Claude:** الحذف نهائي.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_category_id"}],"responses":{"200":{"description":"The deleted category's id.","x-description-ar":"رقم الفئة المحذوفة.","content":{"application/json":{"example":{"record":{"id":5}},"schema":{"$ref":"#/components/schemas/custody_deleted_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The category cannot be deleted.","x-description-ar":"لا يمكن حذف الفئة.","x-codes":[{"code":"category_has_items","meaning":"The category still has items.","x-meaning-ar":"ما زالت في الفئة أصناف.","x-fix":"Delete its unused items first; items with custody can only be made unavailable.","x-fix-ar":"احذف أصنافها غير المستخدمة أولاً؛ والأصناف التي لها عهد يمكن إيقافها فقط."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This category still has items and cannot be deleted. Delete its unused items first; items with custody records can only be made unavailable","error_code":"category_has_items","code":"category_has_items"}}}}}}},"/custody_items":{"post":{"summary":"Add an item to a custody category","operationId":"custody_items.create","tags":["Custody settings"],"description":"Adds a kind of asset (e.g. \"MacBook Pro 14\") to a category, with the value proposed at handover, whether a\nserial number is required, and whether it can be handed out now. One item per kind, not per unit: the unit\nis identified by the serial on each custody record.\n\n**When to use:** before handing out a new kind of asset with `custodies.create`.\n\n**Prerequisites:** `custody_category_id` from `custody_categories.list`. Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log.\n\n**Not offered to Claude:** it changes company configuration, which an admin should do in QHR.","x-summary-ar":"إضافة صنف إلى فئة عهد","x-description-ar":"يضيف نوعاً من الأصول (مثل \"MacBook Pro 14\") إلى فئة، مع القيمة المقترحة عند التسليم، وهل يلزمه رقم تسلسلي،\nوهل يمكن تسليمه الآن. صنف واحد لكل نوع لا لكل وحدة: الوحدة يحددها الرقم التسلسلي في كل سجل عهدة.\n\n**متى تستخدمه:** قبل تسليم نوع جديد من الأصول عبر `custodies.create`.\n\n**المتطلبات:** `custody_category_id` من `custody_categories.list`. تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق.\n\n**غير متاح لـ Claude:** يغيّر إعدادات الشركة، وهذا يجريه مسؤول النظام من QHR.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new item.","x-description-ar":"الصنف الجديد.","content":{"application/json":{"example":{"record":{"id":8,"custody_category_id":2,"name":"iPhone 15","serial_required":true,"available":true,"default_value":"4200.00","currency":"SAR","in_use":false,"held_custody_count":0}},"schema":{"$ref":"#/components/schemas/custody_item_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["custody_category_id","name","default_value"],"properties":{"custody_category_id":{"type":"integer","description":"Its category (id from `custody_categories.list`).","x-description-ar":"فئته (الرقم من `custody_categories.list`)."},"name":{"type":"string","description":"Item name, unique in its category (up to 255).","x-description-ar":"اسم الصنف، فريد داخل فئته (حتى ٢٥٥)."},"default_value":{"type":"string","description":"Value proposed at handover, 0 or more.","x-description-ar":"القيمة المقترحة عند التسليم، صفر أو أكثر."},"serial_required":{"type":"boolean","description":"Require a serial number at handover.","x-description-ar":"إلزام رقم تسلسلي عند التسليم."},"available":{"type":"boolean","description":"Offer it for new handovers.","x-description-ar":"إتاحته للتسليمات الجديدة."}}},"example":{"custody_category_id":2,"name":"iPhone 15","default_value":"4200.00","serial_required":true,"available":true}}},"required":true,"description":"The new item."}}},"/custody_items/{id}":{"patch":{"summary":"Update a custody item","operationId":"custody_items.update","tags":["Custody settings"],"description":"Changes the fields you send — name, default value, serial requirement, availability — and leaves the rest.\n`available: false` stops new handovers of it; custody already handed out is not touched (it keeps the name\nand value it was handed over with). An item cannot move to another category.\n\n**When to use:** to correct an item, change its default value, or retire it from new handovers (an item with\ncustody cannot be deleted).\n\n**Prerequisites:** the item `id` from `custody_categories.list`. Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log.\n\n**Not offered to Claude:** it changes company configuration, which an admin should do in QHR.","x-summary-ar":"تعديل صنف عهدة","x-description-ar":"يعدّل الحقول المرسلة فقط — الاسم والقيمة الافتراضية وإلزام الرقم التسلسلي والإتاحة — ويترك الباقي.\n`available: false` يوقف تسليمه من جديد؛ ولا تتأثر العهد المسلَّمة (تحتفظ بالاسم والقيمة اللذين سُلّمت بهما).\nلا يمكن نقل الصنف إلى فئة أخرى.\n\n**متى تستخدمه:** لتصحيح صنف أو تغيير قيمته الافتراضية أو إيقافه عن التسليمات الجديدة (فالصنف الذي له عهد لا\nيُحذف).\n\n**المتطلبات:** رقم `id` الصنف من `custody_categories.list`. تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق.\n\n**غير متاح لـ Claude:** يغيّر إعدادات الشركة، وهذا يجريه مسؤول النظام من QHR.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_item_id"}],"responses":{"200":{"description":"The item.","x-description-ar":"الصنف.","content":{"application/json":{"example":{"record":{"id":7,"custody_category_id":2,"name":"MacBook Pro 14","serial_required":true,"available":false,"default_value":"8500.00","currency":"SAR","in_use":true,"held_custody_count":12}},"schema":{"$ref":"#/components/schemas/custody_item_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The item cannot be saved.","x-description-ar":"لا يمكن حفظ الصنف.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Default value must be greater than or equal to 0","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Item name, unique in its category (up to 255).","x-description-ar":"اسم الصنف، فريد داخل فئته (حتى ٢٥٥)."},"default_value":{"type":"string","description":"Value proposed at handover, 0 or more.","x-description-ar":"القيمة المقترحة عند التسليم، صفر أو أكثر."},"serial_required":{"type":"boolean","description":"Require a serial number at handover.","x-description-ar":"إلزام رقم تسلسلي عند التسليم."},"available":{"type":"boolean","description":"Offer it for new handovers.","x-description-ar":"إتاحته للتسليمات الجديدة."}}},"example":{"available":false}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete an unused custody item","operationId":"custody_items.delete","tags":["Custody settings"],"description":"Deletes an item no custody record has ever named. An item with custody, in any status, is refused: make it\nunavailable with `custody_items.update` instead.\n\n**When to use:** to remove an item created by mistake.\n\n**Prerequisites:** the item `id` from `custody_categories.list` (`in_use` false). Needs \"Custody settings\".\n\n**Side effects:** recorded in the audit log. Permanent.\n\n**Not offered to Claude:** deletes are permanent.","x-summary-ar":"حذف صنف عهدة غير مستخدم","x-description-ar":"يحذف صنفاً لم يرد في أي سجل عهدة. ويُرفض الصنف الذي له عهد بأي حالة: أوقفه بدلاً من ذلك عبر\n`custody_items.update`.\n\n**متى تستخدمه:** لإزالة صنف أُنشئ خطأً.\n\n**المتطلبات:** رقم `id` الصنف من `custody_categories.list` (و`in_use` خطأ). تحتاج «إعدادات العهد».\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. الحذف نهائي.\n\n**غير متاح لـ Claude:** الحذف نهائي.","x-access":"write","x-permission":{"key":"custody/settings","label":"Configure custody categories and items","x-label-ar":"إعداد فئات العهد وأصنافها"},"x-feature":"custody","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/custody_item_id"}],"responses":{"200":{"description":"The deleted item's id.","x-description-ar":"رقم الصنف المحذوف.","content":{"application/json":{"example":{"record":{"id":8}},"schema":{"$ref":"#/components/schemas/custody_deleted_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The item cannot be deleted.","x-description-ar":"لا يمكن حذف الصنف.","x-codes":[{"code":"item_has_custody","meaning":"Custody records name this item.","x-meaning-ar":"توجد سجلات عهد لهذا الصنف.","x-fix":"Make it unavailable instead with `custody_items.update` (`available: false`).","x-fix-ar":"أوقفه بدلاً من ذلك عبر `custody_items.update` (`available: false`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This item has custody records and cannot be deleted. Make it unavailable instead","error_code":"item_has_custody","code":"item_has_custody"}}}}}}},"/dashboard/approvals_history":{"get":{"summary":"List leave requests that have been decided","operationId":"dashboard.approvals_history","tags":["Dashboard"],"description":"Returns leave requests that are no longer pending (approved, rejected, cancelled or revoked), most\nrecently changed first, with who asked, the dates, days charged, the leave type, the outcome and when it\nwas decided. An HR or admin role sees the whole company; a manager-type role sees their direct reports'\nrequests plus any request they decided themselves.\n\n**When to use:** for \"what did I approve last week?\" or \"was Sara's leave approved?\". For requests still\nwaiting, use `dashboard.pending_approvals`.\n\n**Prerequisites:** the token owner must have an employee record. Needs \"View approvals history\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الإجازة التي بُتّ فيها","x-description-ar":"يعرض طلبات الإجازة التي لم تعد معلّقة (معتمدة أو مرفوضة أو ملغاة أو مسحوبة)، الأحدث تغييراً أولاً، مع مقدّم\nالطلب والتواريخ والأيام المحتسبة ونوع الإجازة والنتيجة ووقت البت فيه. يرى دور الموارد البشرية أو مسؤول\nالنظام الشركة كلها، ويرى الدور من نوع مدير طلبات مرؤوسيه المباشرين وأي طلب بتّ فيه بنفسه.\n\n**متى تستخدمه:** للإجابة عن \"ما الذي اعتمدته الأسبوع الماضي؟\" أو \"هل اعتُمدت إجازة سارة؟\". للطلبات التي ما\nزالت تنتظر استخدم `dashboard.pending_approvals`.\n\n**المتطلبات:** يجب أن يكون لصاحب الرمز سجل موظف. يحتاج صلاحية «عرض سجل الموافقات».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"dashboard/approvals_history","label":"View approvals history","x-label-ar":"عرض سجل الموافقات"},"x-feature":"dashboard","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of decided leave requests.","x-description-ar":"صفحة من طلبات الإجازة التي بُتّ فيها.","content":{"application/json":{"example":{"records":[{"id":790,"employee_id":41,"employee_name":"Sara Ahmed","employee_image":null,"start_date":"2026-11-16","end_date":"2026-11-17","balance":"2.0","status":"approved","leave_type_name":"Annual leave","resolved_at":"2026-11-10 08:20:00 UTC"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/dashboard_resolved_approval_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner has no employee record.","x-description-ar":"ليس لصاحب الرمز سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token owner has no employee record (e.g. the owner or an accountant), and this widget works from the approver's own employee record.","x-meaning-ar":"ليس لصاحب الرمز سجل موظف (مثل المالك أو المحاسب)، وهذا العنصر يعتمد على سجل الموظف الخاص بالمعتمِد.","x-fix":"Use a token created by someone with an employee record, or link this user to an employee in QHR.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف، أو اربط هذا المستخدم بموظف في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/dashboard/pending_approvals":{"get":{"summary":"List leave requests waiting for my decision","operationId":"dashboard.pending_approvals","tags":["Dashboard"],"description":"Returns the leave requests the token owner can decide now, oldest first, each with who asked, the dates,\ndays charged, the leave type, the stage it is at, who holds it and how long it has waited. For an HR or\nadmin role this is the company's HR queue (including requests whose managers are all away); for a\nmanager-type role, the requests waiting at their stage, including ones escalated to them because a\nmanager below is on leave. A request to cancel an approved leave appears too, with\n`pending_cancellation: true`.\n\nWhen the company has Requests and the caller may use them, a `tickets` object also gives the number of\nrequests (not leave) waiting for the caller's approval and the five oldest. A caller who may decide\nrequests but not leave gets an empty leave list and the `tickets` object.\n\n**When to use:** for \"what is waiting for me?\" or \"do I have leave to approve?\". To act on a row, use its\n`id` with the leave request operations (e.g. `leave_requests.show`).\n\n**Prerequisites:** the token owner must have an employee record. Needs \"View pending approvals\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الإجازة التي تنتظر قراري","x-description-ar":"يعرض طلبات الإجازة التي يستطيع صاحب الرمز البت فيها الآن، الأقدم أولاً، ولكل طلب مقدّمه وتواريخه والأيام\nالمحتسبة ونوع الإجازة ومرحلته ومن بيده القرار ومدة انتظاره. لدور الموارد البشرية أو مسؤول النظام هي قائمة\nالموارد البشرية في الشركة (ومنها الطلبات التي غاب كل مديريها)، وللدور من نوع مدير الطلبات المنتظرة في\nمرحلته، ومنها ما صُعّد إليه لأن مديراً أدنى منه في إجازة. ويظهر أيضاً طلب إلغاء إجازة معتمدة مع\n`pending_cancellation: true`.\n\nإن كانت ميزة الطلبات مفعّلة للشركة ويحق لصاحب الرمز استخدامها، يتضمن الرد كائن `tickets` بعدد الطلبات (غير\nالإجازات) التي تنتظر موافقته وأقدم خمسة منها. ومن يحق له البت في الطلبات دون الإجازات تصله قائمة إجازات\nفارغة مع كائن `tickets`.\n\n**متى تستخدمه:** للإجابة عن \"ما الذي ينتظرني؟\" أو \"هل لدي إجازات لأعتمدها؟\". للتعامل مع صف استخدم رقم\n`id` الخاص به في عمليات طلبات الإجازة (مثل `leave_requests.show`).\n\n**المتطلبات:** يجب أن يكون لصاحب الرمز سجل موظف. يحتاج صلاحية «عرض الموافقات المعلقة».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"dashboard/view_pending_approvals","label":"View pending approvals","x-label-ar":"عرض الطلبات المعلّقة بانتظار الموافقة"},"x-feature":"dashboard","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of leave requests awaiting a decision.","x-description-ar":"صفحة من طلبات الإجازة المنتظرة.","content":{"application/json":{"example":{"records":[{"id":815,"employee_id":41,"employee_name":"Sara Ahmed","employee_image":null,"start_date":"2026-12-06","end_date":"2026-12-08","balance":"3.0","status":"pending","leave_type_name":"Annual leave","pending_cancellation":false,"current_stage":"awaiting_hr","current_approver_name":"HR","escalated":false,"escalated_from_name":null,"escalated_to_hr":false,"days_pending":2,"days_at_current_stage":2}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"tickets":{"type":"object","description":"Requests (not leave) waiting for the caller's approval. Only when the company has Requests and the caller may use them.","x-description-ar":"الطلبات (غير الإجازات) التي تنتظر موافقة صاحب الرمز. تظهر فقط إن كانت ميزة الطلبات مفعّلة للشركة ويحق له استخدامها.","properties":{"count":{"type":"integer","description":"How many are waiting.","x-description-ar":"عدد الطلبات المنتظرة."},"records":{"type":"array","items":{"type":"object"},"description":"The five oldest, as request rows (reference, subject, type, requester, due date, stage).","x-description-ar":"أقدم خمسة، كصفوف طلبات (الرقم المرجعي والعنوان والنوع ومقدّم الطلب وتاريخ الاستحقاق والمرحلة)."}}},"records":{"type":"array","items":{"$ref":"#/components/schemas/dashboard_pending_approval"},"description":"The leave requests on this page.","x-description-ar":"طلبات الإجازة في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner has no employee record.","x-description-ar":"ليس لصاحب الرمز سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token owner has no employee record (e.g. the owner or an accountant), and this widget works from the approver's own employee record.","x-meaning-ar":"ليس لصاحب الرمز سجل موظف (مثل المالك أو المحاسب)، وهذا العنصر يعتمد على سجل الموظف الخاص بالمعتمِد.","x-fix":"Use a token created by someone with an employee record, or link this user to an employee in QHR.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف، أو اربط هذا المستخدم بموظف في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/dashboard/people_on_leave":{"get":{"summary":"List who is on leave (older path of people_on_leave.list)","operationId":"dashboard.people_on_leave","tags":["Dashboard"],"description":"The older path of `people_on_leave.list`: same parameters, same rows, same rules. Each row is one approved leave request that overlaps the window: who, first and last day, and the day they are\nback. Leave of people who have left the company is not shown, and nothing says why someone is away (no leave type,\nreason or balance). Ordered by start date.\n\nWho you see depends on the token owner's role: a **manager-type role** sees their direct reports only (and,\nwith a window, their own leave too); **any other role** sees everyone in the company. Without `from` / `to` the\nanswer is for today and leaves out the token owner's own leave; with them it includes it.\n\n**When to use:** only if you already call it. New integrations should use `people_on_leave.list`; this\npath will be removed once the web app stops using it. Not offered to Claude, which uses\n`people_on_leave.list` instead.\n\n**Prerequisites:** none. Anyone in the company may call it.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض من في إجازة (المسار القديم لـ people_on_leave.list)","x-description-ar":"المسار القديم لـ `people_on_leave.list`: المعاملات نفسها والصفوف نفسها والقواعد نفسها.\nكل صف طلب إجازة معتمد يتقاطع مع الفترة: من، وأول يوم وآخر يوم، ويوم العودة. لا تظهر إجازات من غادروا الشركة، ولا\nيُذكر سبب الغياب (لا نوع إجازة ولا سبب ولا رصيد). مرتبة حسب تاريخ البداية.\n\nيعتمد من تراهم على دور صاحب الرمز: **الدور من نوع مدير** يرى مرؤوسيه المباشرين فقط (ومع تحديد فترة يرى إجازته هو\nأيضاً)، و**أي دور آخر** يرى كل من في الشركة. بدون `from` / `to` تكون الإجابة عن اليوم ولا تشمل إجازة صاحب الرمز\nنفسه، ومعهما تشملها.\n\n**متى تستخدمه:** فقط إن كنت تستدعيه أصلاً. على التكاملات الجديدة استخدام `people_on_leave.list`، وسيُزال\nهذا المسار حين يتوقف تطبيق الويب عن استخدامه. لا يُعرض على Claude الذي يستخدم `people_on_leave.list` بدلاً\nمنه.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/dashboard_from"},{"$ref":"#/components/parameters/dashboard_to"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of people on leave.","x-description-ar":"صفحة ممن هم في إجازة.","content":{"application/json":{"example":{"records":[{"id":812,"employee_id":41,"employee_name":"Sara Ahmed","employee_image":null,"start_date":"2026-11-23","end_date":"2026-11-27","back_on":"2026-11-28"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/dashboard_people_on_leave_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The date window is not valid.","x-description-ar":"الفترة الزمنية غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"The date window is not valid: only one of `from` / `to` was sent, `to` is before `from`, or the window is longer than 90 days.","x-meaning-ar":"الفترة غير صحيحة: أُرسل أحد `from` / `to` دون الآخر، أو `to` قبل `from`، أو الفترة أطول من ٩٠ يوماً.","x-fix":"Send both dates, `to` on or after `from`, at most 90 days apart (inclusive); split a longer period into several calls.","x-fix-ar":"أرسل التاريخين، و`to` في يوم `from` أو بعده، بفترة لا تزيد عن ٩٠ يوماً شاملةً؛ وقسّم الفترة الأطول على عدة استدعاءات."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The date range cannot be longer than 90 days","code":"validation_failed"}}}}}}},"/dashboard/stats":{"get":{"summary":"Get the company's headcount and leave figures","operationId":"dashboard.stats","tags":["Dashboard"],"description":"Returns four figures for the dashboard: employees still working here (active or on notice), those whose\njoining date is 30 days ago or later — the last 30 days plus hires already entered with a future start\ndate — leave requests waiting for the caller's decision, and how many people are on\napproved leave today. \"Waiting for a decision\" is the same queue `dashboard.pending_approvals` lists:\nthe whole company's HR queue for an HR or admin role, or only the requests the caller may decide for a\nmanager-type role.\n\n**When to use:** for \"how many employees do we have?\", \"how many joined this month?\" or \"how many are\noff today?\". For the names behind a figure use `employees.list`, `dashboard.pending_approvals` or\n`people_on_leave.list`.\n\n**Prerequisites:** none. Needs \"View HR statistics\".\n\n**Side effects:** none.","x-summary-ar":"عرض أرقام الموظفين والإجازات في الشركة","x-description-ar":"يعرض أربعة أرقام للوحة المعلومات: الموظفون الذين ما زالوا على رأس العمل (نشطون أو في فترة الإشعار)، ومن\nيقع تاريخ التحاقهم خلال آخر ٣٠ يوماً أو في المستقبل (أي يشمل من أُدخلوا بتاريخ التحاق لم يحن بعد)، وطلبات الإجازة التي تنتظر قرار صاحب الرمز، وعدد من هم في إجازة معتمدة اليوم.\n\"تنتظر القرار\" هي القائمة نفسها التي يعرضها `dashboard.pending_approvals`: قائمة الموارد البشرية للشركة كلها\nلدور الموارد البشرية أو مسؤول النظام، أو الطلبات التي يحق لصاحب الرمز البت فيها فقط للدور من نوع مدير.\n\n**متى تستخدمه:** للإجابة عن \"كم موظفاً لدينا؟\" أو \"كم انضم هذا الشهر؟\" أو \"كم شخصاً غائب اليوم؟\". لمعرفة\nالأسماء خلف أي رقم استخدم `employees.list` أو `dashboard.pending_approvals` أو `people_on_leave.list`.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية «عرض إحصاءات الموارد البشرية».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"dashboard/view_stats","label":"View HR statistics","x-label-ar":"عرض إحصائيات الموارد البشرية"},"x-feature":"dashboard","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The figures.","x-description-ar":"الأرقام.","content":{"application/json":{"example":{"data":{"total_employees":42,"new_employees":3,"pending_approvals":5,"on_leave":2}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The four figures.","x-description-ar":"الأرقام الأربعة.","required":["total_employees","new_employees","pending_approvals","on_leave"],"properties":{"total_employees":{"type":"integer","description":"Employees still working here (active or on notice).","x-description-ar":"الموظفون الذين ما زالوا على رأس العمل (نشطون أو في فترة الإشعار)."},"new_employees":{"type":"integer","description":"Of those, how many have a joining date 30 days ago or later. Future hires already entered are counted too.","x-description-ar":"منهم، من يقع تاريخ التحاقهم خلال آخر ٣٠ يوماً أو في المستقبل؛ فيُحسب أيضاً من أُدخلوا بتاريخ التحاق لم يحن بعد."},"pending_approvals":{"type":"integer","description":"Leave requests waiting for the caller's decision.","x-description-ar":"طلبات الإجازة التي تنتظر قرار صاحب الرمز."},"on_leave":{"type":"integer","description":"People on approved leave today.","x-description-ar":"عدد من هم في إجازة معتمدة اليوم."}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/dashboard/upcoming_holidays":{"get":{"summary":"List upcoming public holidays for my country","operationId":"dashboard.upcoming_holidays","tags":["Dashboard"],"description":"Returns the public holidays from today on, soonest first, for the token owner's country of residence\n(from their employee record), limited to the holidays HR chose to show on the dashboard. A token owner\nwith no employee record, or no country of residence on it, gets an empty list.\n\n**When to use:** for \"when is the next public holiday?\" or \"is there a holiday next week?\". For the\ncompany's full holiday calendar across countries, use the holiday operations.\n\n**Prerequisites:** none. Anyone in the company may call it.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض العطل الرسمية القادمة لبلدي","x-description-ar":"يعرض العطل الرسمية من اليوم فصاعداً، الأقرب أولاً، لبلد إقامة صاحب الرمز (من سجله الوظيفي)، ويقتصر على العطل\nالتي اختارت الموارد البشرية إظهارها في لوحة المعلومات. ومن ليس له سجل موظف أو لا بلد إقامة في سجله تصله\nقائمة فارغة.\n\n**متى تستخدمه:** للإجابة عن \"متى العطلة الرسمية القادمة؟\" أو \"هل توجد عطلة الأسبوع القادم؟\". لتقويم العطل\nالكامل للشركة في كل الدول استخدم عمليات العطل.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of holidays.","x-description-ar":"صفحة من العطل.","content":{"application/json":{"example":{"records":[{"id":14,"name":"Founding Day","name_en":"Founding Day","name_ar":"يوم التأسيس","start_date":"2027-02-22","end_date":"2027-02-22","country":"SA","country_name":"Saudi Arabia","show_on_dashboard_for_assigned_users":true}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/dashboard_holiday_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/dashboard/updates":{"get":{"summary":"List team news: new joiners and work anniversaries","operationId":"dashboard.updates","tags":["Dashboard"],"description":"Returns the company's recent milestones, newest first: people who joined and work anniversaries from the\nlast 30 days, each with a ready-to-read sentence in the requested language.\n\n**When to use:** for \"who joined recently?\" or \"whose work anniversary is it?\".\n\n**Prerequisites:** none. Anyone in the company may call it.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض أخبار الفريق: المنضمون الجدد وذكرى سنوات العمل","x-description-ar":"يعرض مناسبات الشركة الأخيرة، الأحدث أولاً: المنضمون الجدد وذكرى سنوات العمل خلال آخر ٣٠ يوماً، ولكل منها\nجملة جاهزة للقراءة بلغة الطلب.\n\n**متى تستخدمه:** للإجابة عن \"من انضم مؤخراً؟\" أو \"من يحتفل بذكرى سنوات عمله؟\".\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of updates.","x-description-ar":"صفحة من الأخبار.","content":{"application/json":{"example":{"records":[{"id":63,"event_type":"work_anniversary","created_at":"2026-11-20 03:00:00 UTC","employee_id":41,"employee_name":"Sara Ahmed","employee_image":null,"text":"Sara Ahmed is celebrating 3 year(s) at Qoyod."}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/dashboard_update_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/department_tickets":{"get":{"summary":"List my department's requests","operationId":"department_tickets.list","tags":["Department requests"],"description":"Returns the requests the token owner's department handles once they are approved (open, being worked on\nand finished), plus any request assigned to the owner in another department. Requests still waiting for\napproval are never here. Latest activity first; up to 50 per page. Each row lists `available_actions`,\nwhat the owner may do on it now.\n\n**When to use:** to see the department's workload, find requests nobody has taken (`tab=unassigned`) or\nthe owner's own work (`tab=mine`). For the requests the owner submitted use `tickets.list`; HR's\ncompany-wide view is `hr_tickets.list`. Open one with `tickets.show`.\n\n**Prerequisites:** none. The token owner must be linked to an employee; their department is the one\nlisted. Filter ids come from `ticket_catalog.list` and `department_tickets.assignees`.\n\n**Side effects:** none.","x-summary-ar":"عرض طلبات قسمي","x-description-ar":"يعرض الطلبات التي ينفّذها قسم صاحب الرمز بعد اعتمادها (المفتوحة وقيد التنفيذ والمنتهية)، إضافة إلى أي طلب\nمسند إلى صاحب الرمز في قسم آخر. لا تظهر هنا الطلبات التي ما زالت بانتظار الاعتماد. الأحدث نشاطاً أولاً،\nحتى ٥٠ طلباً في الصفحة. يذكر كل صف `available_actions`، أي ما يستطيع صاحب الرمز فعله عليه الآن.\n\n**متى تستخدمه:** لمعرفة حجم عمل القسم، أو إيجاد الطلبات التي لم يستلمها أحد (`tab=unassigned`) أو عمل صاحب\nالرمز نفسه (`tab=mine`). للطلبات التي قدّمها صاحب الرمز استخدم `tickets.list`، ونظرة الموارد البشرية على\nمستوى الشركة هي `hr_tickets.list`. افتح أي طلب عبر `tickets.show`.\n\n**المتطلبات:** لا شيء. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف، وقسمه هو المعروض. أرقام التصفية من\n`ticket_catalog.list` و`department_tickets.assignees`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"tab","in":"query","required":false,"schema":{"type":"string","enum":["all","unassigned","mine"]},"description":"`all` (default), `unassigned` (open, nobody on them) or `mine` (assigned to the token owner).","x-description-ar":"`all` الكل (الافتراضي)، `unassigned` المفتوحة غير المستلمة، `mine` المسندة إلى صاحب الرمز.","example":"unassigned"},{"$ref":"#/components/parameters/department_ticket_overdue"},{"$ref":"#/components/parameters/department_ticket_q_ticket_type_ticket_category_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_ticket_type_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_priority_eq"},{"$ref":"#/components/parameters/department_ticket_q_assignee_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_assignee_id_null"},{"$ref":"#/components/parameters/department_ticket_q_status_eq"},{"$ref":"#/components/parameters/department_ticket_q_status_in"},{"$ref":"#/components/parameters/department_ticket_q_created_at_gteq"},{"$ref":"#/components/parameters/department_ticket_q_created_at_lteq"},{"$ref":"#/components/parameters/department_ticket_q_reference_or_subject_or_requester_name_cont"},{"$ref":"#/components/parameters/department_ticket_q_s"}],"responses":{"200":{"description":"A page of requests.","x-description-ar":"صفحة من الطلبات.","content":{"application/json":{"example":{"records":[{"id":3105,"reference":"TKT-000215","subject":"Laptop screen flickering","status":"open","priority":"high","target_days":3,"type":{"id":12,"name_en":"New device","name_ar":"جهاز جديد","name":"New device"},"category":{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":"2026-12-02","overdue":false,"last_activity_at":"2026-11-26T08:15:00Z","created_at":"2026-11-25T07:40:00Z","available_actions":["take","assign"]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/department_ticket_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/department_tickets/assignees":{"get":{"summary":"List the members of my department","operationId":"department_tickets.assignees","tags":["Department requests"],"description":"Returns the employed members of the token owner's department, by name: the people a department request can\nbe assigned to.\n\n**When to use:** to choose `assignee_id` for `department_tickets.bulk_assign`, or for the `assignee_id_eq`\nfilter of `department_tickets.list`. For one request, `tickets.assignee_options` also leaves out its\nrequester.\n\n**Prerequisites:** none. The token owner must be linked to an employee.\n\n**Side effects:** none.","x-summary-ar":"عرض أعضاء قسمي","x-description-ar":"يعرض أعضاء قسم صاحب الرمز الذين على رأس العمل مرتبين بالاسم: وهم من يمكن إسناد طلبات القسم إليهم.\n\n**متى تستخدمه:** لاختيار `assignee_id` في `department_tickets.bulk_assign`، أو لتصفية `assignee_id_eq` في\n`department_tickets.list`. ولطلب واحد، تستبعد `tickets.assignee_options` مقدّم الطلب أيضاً.\n\n**المتطلبات:** لا شيء. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The members.","x-description-ar":"الأعضاء.","content":{"application/json":{"example":{"records":[{"id":1207,"name":"Omar Khaled","department_name":"IT","label":"Omar Khaled - IT"},{"id":1211,"name":"Reem Nasser","department_name":"IT","label":"Reem Nasser - IT"}]},"schema":{"$ref":"#/components/schemas/department_ticket_assignees"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/department_tickets/bulk_accept":{"patch":{"summary":"Accept several requests assigned to me","operationId":"department_tickets.bulk_accept","tags":["Department requests"],"description":"The token owner accepts up to 50 requests that were assigned to them: each moves from `assigned` to\n`in_progress`, exactly as `tickets.accept` does one by one. A request not assigned to the owner, or no\nlonger `assigned`, fails on its own and is reported in `failed`.\n\n**When to use:** to start work on a batch from `department_tickets.list` with `tab=mine`. For one request\nuse `tickets.accept`.\n\n**Prerequisites:** ids from `department_tickets.list`. The token owner must be linked to an employee.\n\n**Side effects:** each change is logged in the request's activity. No one is notified.\n\n**Not offered to Claude:** a bulk change touching many requests at once; Claude uses `tickets.accept` one\nrequest at a time.","x-summary-ar":"قبول عدة طلبات مسندة إليّ","x-description-ar":"يقبل صاحب الرمز حتى ٥٠ طلباً أُسندت إليه: ينتقل كل منها من `assigned` إلى `in_progress`، تماماً كما تفعل\n`tickets.accept` لكل طلب على حدة. الطلب غير المسند إلى صاحب الرمز، أو الذي لم يعد `assigned`، يفشل وحده\nويُذكر في `failed`.\n\n**متى تستخدمه:** لبدء العمل على مجموعة من `department_tickets.list` مع `tab=mine`. لطلب واحد استخدم\n`tickets.accept`.\n\n**المتطلبات:** الأرقام من `department_tickets.list`. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُسجَّل كل تغيير في سجل نشاط الطلب. لا يُرسَل أي إشعار.\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس طلبات كثيرة دفعة واحدة؛ ويستخدم Claude `tickets.accept` لكل\nطلب على حدة.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3107],"failed":[{"id":3105,"error":"You can't do this on this request"}]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, a missing `assignee_id`, or (assign) requests of more than one department.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `assignee_id` ناقص، أو (في الإسناد) طلبات من أكثر من قسم.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/department_ticket_ids"},"example":{"ids":[3107]}}},"required":true,"description":"The requests to accept."}}},"/department_tickets/bulk_assign":{"patch":{"summary":"Assign several requests to one colleague","operationId":"department_tickets.bulk_assign","tags":["Department requests"],"description":"Assigns up to 50 requests to one member of their handling department, exactly as `tickets.assign` does one\nby one. All the requests must belong to the same department, or the whole batch is refused. Per request,\nthe token owner must be allowed to assign it: a department member can assign open requests, the current\nassignee can hand theirs over, HR can (re)assign any open, assigned or in-progress request. Assigning to\noneself is a take. The assignee can never be the requester.\n\n**When to use:** to share out a batch of the queue. For one request use `tickets.assign`.\n\n**Prerequisites:** ids from `department_tickets.list`; `assignee_id` from `department_tickets.assignees`.\nThe token owner must be linked to an employee.\n\n**Side effects:** the requester and the new assignee are notified (in QHR and by email). Each change is\nlogged in the request's activity.\n\n**Not offered to Claude:** a bulk change touching many requests and notifying many people at once; Claude\nuses `tickets.assign` one request at a time.","x-summary-ar":"إسناد عدة طلبات إلى زميل واحد","x-description-ar":"يُسند حتى ٥٠ طلباً إلى عضو واحد من القسم المنفّذ لها، تماماً كما تفعل `tickets.assign` لكل طلب على حدة. يجب\nأن تتبع كل الطلبات القسم نفسه وإلا رُفضت الدفعة كاملة. ولكل طلب يجب أن يُسمح لصاحب الرمز بإسناده: عضو القسم\nيُسند الطلبات المفتوحة، والمسند إليه حالياً يسلّم طلبه لغيره، والموارد البشرية تُسند أي طلب مفتوح أو مسند أو\nقيد التنفيذ. والإسناد إلى النفس استلام. ولا يكون المسند إليه مقدّمَ الطلب أبداً.\n\n**متى تستخدمه:** لتوزيع مجموعة من قائمة القسم. لطلب واحد استخدم `tickets.assign`.\n\n**المتطلبات:** الأرقام من `department_tickets.list`، و`assignee_id` من `department_tickets.assignees`. يجب\nأن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُشعَر مقدّم الطلب والمسند إليه الجديد (داخل QHR وبالبريد). ويُسجَّل كل تغيير في سجل\nنشاط الطلب.\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس طلبات كثيرة ويُشعر أشخاصاً كثيرين دفعة واحدة؛ ويستخدم Claude\n`tickets.assign` لكل طلب على حدة.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3105,3106],"failed":[]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, a missing `assignee_id`, or (assign) requests of more than one department.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `assignee_id` ناقص، أو (في الإسناد) طلبات من أكثر من قسم.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","assignee_id"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"minItems":1,"maxItems":50,"description":"Request ids, 1 to 50, from the list.","x-description-ar":"أرقام الطلبات، من ١ إلى ٥٠، من القائمة."},"assignee_id":{"type":"integer","description":"The colleague, from `department_tickets.assignees`.","x-description-ar":"الزميل، من `department_tickets.assignees`."}}},"example":{"ids":[3105,3106],"assignee_id":1211}}},"required":true,"description":"The requests and who gets them."}}},"/department_tickets/bulk_take":{"patch":{"summary":"Take several open requests","operationId":"department_tickets.bulk_take","tags":["Department requests"],"description":"The token owner takes up to 50 open requests of their department at once: each is assigned to them and\ngoes straight to `in_progress`, exactly as `tickets.take` does one by one. A request someone else took a\nmoment ago, the owner's own request, or one outside their department fails on its own and is reported\nin `failed`; the others still go through.\n\n**When to use:** to pick up a batch from `department_tickets.list` with `tab=unassigned`. For one request\nuse `tickets.take`.\n\n**Prerequisites:** ids from `department_tickets.list`. The token owner must be linked to an employee.\n\n**Side effects:** each requester is notified (in QHR and by email) that their request was assigned. Each\nchange is logged in the request's activity (`tickets.events`).\n\n**Not offered to Claude:** a bulk change touching many requests and notifying many people at once; Claude\nuses `tickets.take` one request at a time.","x-summary-ar":"استلام عدة طلبات مفتوحة","x-description-ar":"يستلم صاحب الرمز حتى ٥٠ طلباً مفتوحاً من قسمه دفعة واحدة: ينتقل كل منها إلى `in_progress` مسنداً إليه، تماماً كما\nتفعل `tickets.take` لكل طلب على حدة. الطلب الذي استلمه غيره قبل لحظات، أو الذي قدّمه صاحب الرمز نفسه، أو\nالذي لا يتبع قسمه، يفشل وحده ويُذكر في `failed`، وتمضي البقية.\n\n**متى تستخدمه:** لاستلام مجموعة من `department_tickets.list` مع `tab=unassigned`. لطلب واحد استخدم\n`tickets.take`.\n\n**المتطلبات:** الأرقام من `department_tickets.list`. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُشعَر كل مقدّم طلب (داخل QHR وبالبريد) بأن طلبه أُسند. ويُسجَّل كل تغيير في سجل نشاط\nالطلب (`tickets.events`).\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس طلبات كثيرة ويُشعر أشخاصاً كثيرين دفعة واحدة؛ ويستخدم Claude\n`tickets.take` لكل طلب على حدة.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3105],"failed":[{"id":3106,"error":"This request has already been taken"}]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, a missing `assignee_id`, or (assign) requests of more than one department.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `assignee_id` ناقص، أو (في الإسناد) طلبات من أكثر من قسم.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/department_ticket_ids"},"example":{"ids":[3105,3106]}}},"required":true,"description":"The requests to take."}}},"/department_tickets/stat_cards":{"get":{"summary":"Count my department's requests","operationId":"department_tickets.stat_cards","tags":["Department requests"],"description":"Returns four counts over the approved requests handled by the token owner's department: open (not\nfinished), unassigned, overdue, and resolved this week (sent for review or closed since the company's\nweek start). List filters never apply.\n\n**When to use:** for a quick \"how is my department doing\" answer. To see the requests behind a number use\n`department_tickets.list` (`tab=unassigned`, `overdue=true`).\n\n**Prerequisites:** none. The token owner must be linked to an employee.\n\n**Side effects:** none.","x-summary-ar":"إحصاء طلبات قسمي","x-description-ar":"يعرض أربعة أعداد عن الطلبات المعتمدة التي ينفّذها قسم صاحب الرمز: المفتوحة (لم تنتهِ)، وغير المستلمة،\nوالمتأخرة، والمنجزة هذا الأسبوع (أُرسلت للمراجعة أو أُغلقت منذ بداية أسبوع الشركة). لا تتأثر بتصفية القائمة.\n\n**متى تستخدمه:** لإجابة سريعة عن «كيف حال قسمي». لرؤية الطلبات وراء أي رقم استخدم\n`department_tickets.list` (`tab=unassigned` أو `overdue=true`).\n\n**المتطلبات:** لا شيء. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"open":9,"unassigned":3,"overdue":1,"resolved_this_week":4},"schema":{"$ref":"#/components/schemas/department_ticket_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no department.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فليس له قسم.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/departments":{"get":{"summary":"List departments","operationId":"departments.list","tags":["Departments"],"description":"Returns the company's departments, newest first, each with its English and Arabic name and how many\nemployees still work in it (active or on notice).\n\n**When to use:** to answer \"which departments do we have?\" or \"how many people are in Finance?\", or to find\nthe `id` for `department_id` when adding or updating an employee, or for `departments.update` and\n`departments.delete`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض قائمة الأقسام","x-description-ar":"يعرض أقسام الشركة، الأحدث إضافةً أولاً، لكل قسم اسمه بالعربية والإنجليزية وعدد الموظفين الذين ما زالوا\nيعملون فيه (نشطون أو في فترة الإشعار).\n\n**متى تستخدمه:** للإجابة عن \"ما أقسامنا؟\" أو \"كم شخصاً في المالية؟\"، أو لمعرفة رقم `id` المطلوب في\n`department_id` عند إضافة موظف أو تعديله، أو في `departments.update` و`departments.delete`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"department/view","label":"View departments","x-label-ar":"عرض الأقسام"},"x-feature":"department","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of departments.","x-description-ar":"صفحة من الأقسام.","content":{"application/json":{"example":{"records":[{"id":4,"name_en":"Finance","name_ar":"المالية","name":"Finance","active_employee_count":12}],"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/department"},"description":"The departments on this page.","x-description-ar":"الأقسام في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a department","operationId":"departments.create","tags":["Departments"],"description":"Adds a department with an English and an Arabic name. Both are required and each must be unique in the\ncompany.\n\n**When to use:** when the company opens a new department, before assigning employees to it.\n\n**Prerequisites:** none. Check `departments.list` first to avoid a name that already exists.\n\n**Side effects:** the department becomes a choice for `department_id` in the employee operations and in\n`employees.meta_data`. Not offered to Claude: it changes the company's structure, which an admin should do\ndeliberately.","x-summary-ar":"إضافة قسم","x-description-ar":"يضيف قسماً باسم بالإنجليزية وآخر بالعربية. الاسمان مطلوبان ويجب أن يكون كل منهما فريداً في الشركة.\n\n**متى تستخدمه:** عند افتتاح قسم جديد في الشركة، قبل إسناد موظفين إليه.\n\n**المتطلبات:** لا شيء. راجع `departments.list` أولاً لتجنب اسم موجود.\n\n**الآثار الجانبية:** يصبح القسم خياراً في `department_id` في عمليات الموظفين وفي `employees.meta_data`.\nلا يُعرض على Claude لأنه يغيّر هيكل الشركة، وهذا قرار يتخذه مسؤول النظام عن قصد.","x-access":"write","x-permission":{"key":"department/create","label":"Add a department","x-label-ar":"إضافة قسم"},"x-feature":"department","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new department.","x-description-ar":"القسم الجديد.","content":{"application/json":{"example":{"id":9,"name_en":"Sales","name_ar":"المبيعات","name":"Sales","active_employee_count":0},"schema":{"$ref":"#/components/schemas/department"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The department cannot be added.","x-description-ar":"لا يمكن إضافة القسم.","x-codes":[{"code":"validation_failed","meaning":"A name is missing, or another department already has it.","x-meaning-ar":"أحد الاسمين ناقص، أو يحمله قسم آخر.","x-fix":"Send both names, each different from every other department's.","x-fix-ar":"أرسل الاسمين، كلٌّ مختلف عن أسماء الأقسام الأخرى."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/department_create_input"},"example":{"department":{"name_en":"Sales","name_ar":"المبيعات"}}}},"required":true,"description":"The new department."}}},"/departments/{id}":{"patch":{"summary":"Rename a department","operationId":"departments.update","tags":["Departments"],"description":"Changes a department's English or Arabic name; a name you leave out stays as it is. Employees stay in the\ndepartment.\n\n**When to use:** to correct or rename a department.\n\n**Prerequisites:** the department's `id`, from `departments.list`.\n\n**Side effects:** the new name shows everywhere the department appears (employee records, lists, exports).\nNot offered to Claude: it changes the company's structure.","x-summary-ar":"تعديل اسم قسم","x-description-ar":"يغيّر اسم القسم بالإنجليزية أو بالعربية؛ والاسم الذي لا ترسله يبقى كما هو. يبقى الموظفون في القسم.\n\n**متى تستخدمه:** لتصحيح اسم قسم أو تغييره.\n\n**المتطلبات:** رقم `id` القسم من `departments.list`.\n\n**الآثار الجانبية:** يظهر الاسم الجديد في كل مكان يظهر فيه القسم (سجلات الموظفين والقوائم والتصدير). لا\nيُعرض على Claude لأنه يغيّر هيكل الشركة.","x-access":"write","x-permission":{"key":"department/edit","label":"Edit a department","x-label-ar":"تعديل قسم"},"x-feature":"department","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/department_id"}],"responses":{"200":{"description":"The department after the change.","x-description-ar":"القسم بعد التعديل.","content":{"application/json":{"example":{"id":4,"name_en":"Finance \u0026 Accounting","name_ar":"المالية","name":"Finance \u0026 Accounting","active_employee_count":12},"schema":{"$ref":"#/components/schemas/department"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The department cannot be renamed.","x-description-ar":"لا يمكن تعديل اسم القسم.","x-codes":[{"code":"validation_failed","meaning":"A name is missing, or another department already has it.","x-meaning-ar":"أحد الاسمين ناقص، أو يحمله قسم آخر.","x-fix":"Send both names, each different from every other department's.","x-fix-ar":"أرسل الاسمين، كلٌّ مختلف عن أسماء الأقسام الأخرى."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name ar has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/department_input"},"example":{"department":{"name_en":"Finance \u0026 Accounting"}}}},"required":true,"description":"The names to change."}},"delete":{"summary":"Delete a department","operationId":"departments.delete","tags":["Departments"],"description":"Deletes a department for good. Only an empty department can be deleted: one that still has employees\n(including those who left), request types or requests is refused with 422.\n\n**When to use:** to remove a department the company no longer has, after moving its employees elsewhere with\n`employees.update` (`department_id`).\n\n**Prerequisites:** the department's `id`, from `departments.list`.\n\n**Side effects:** the department disappears from every list of choices. It cannot be undone, so it is not\noffered to Claude.","x-summary-ar":"حذف قسم","x-description-ar":"يحذف القسم نهائياً. لا يُحذف إلا القسم الفارغ: القسم الذي ما زال له موظفون (بمن فيهم من غادروا) أو أنواع\nطلبات أو طلبات يُرفض حذفه برمز 422.\n\n**متى تستخدمه:** لإزالة قسم لم يعد موجوداً في الشركة، بعد نقل موظفيه إلى قسم آخر عبر `employees.update`\n(`department_id`).\n\n**المتطلبات:** رقم `id` القسم من `departments.list`.\n\n**الآثار الجانبية:** يختفي القسم من كل قوائم الخيارات. لا يمكن التراجع عنه، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"department/delete","label":"Remove a department","x-label-ar":"حذف قسم"},"x-feature":"department","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/department_id"}],"responses":{"204":{"description":"Deleted. No body.","x-description-ar":"حُذف. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The department is still in use.","x-description-ar":"القسم ما زال مستخدماً.","x-codes":[{"code":"validation_failed","meaning":"The department still has employees (current or former), request types or requests.","x-meaning-ar":"ما زال للقسم موظفون (حاليون أو سابقون) أو أنواع طلبات أو طلبات.","x-fix":"Move its employees to another department with `employees.update`, and its request types to another department, then try again.","x-fix-ar":"انقل موظفيه إلى قسم آخر عبر `employees.update`، وأنواع طلباته إلى قسم آخر، ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot delete record because dependent employees exist","code":"validation_failed"}}}}}}},"/document_settings":{"get":{"summary":"Get the document expiry settings","operationId":"document_settings.show","tags":["Documents"],"description":"Returns the company's document expiry settings: how many days before its expiry date a document counts\nas \"expiring soon\", whether QHR emails employees automatically about their expiring documents, and how\noften those reminders repeat.\n\n**When to use:** to explain why a document shows as `expiring_soon` in `documents.list`, or to check\nwhether employees are reminded automatically.\n\n**Prerequisites:** none.\n\n**Side effects:** none, except on a company that has never saved these settings: the first read\ncreates the settings with the defaults (30 days, weekly, automatic reminders off), and that creation is\nrecorded in the audit log.","x-summary-ar":"عرض إعدادات انتهاء المستندات","x-description-ar":"يعرض إعدادات انتهاء المستندات في الشركة: كم يوماً قبل تاريخ الانتهاء يُعدّ المستند \"قريب الانتهاء\"، وهل\nيرسل QHR للموظفين تلقائياً بريداً عن مستنداتهم القريبة من الانتهاء، وكل كم يوماً يتكرر التذكير.\n\n**متى تستخدمه:** لتفسير ظهور مستند بالحالة `expiring_soon` في `documents.list`، أو لمعرفة هل يُذكَّر\nالموظفون تلقائياً.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء، إلا في شركة لم تحفظ هذه الإعدادات من قبل: تُنشئ القراءة الأولى الإعدادات\nبقيمها الافتراضية (٣٠ يوماً، وتذكير أسبوعي، والتذكيرات التلقائية متوقفة)، ويُسجَّل إنشاؤها في سجل التدقيق.","x-access":"read","x-permission":{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة"},"x-feature":"document","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings.","x-description-ar":"الإعدادات.","content":{"application/json":{"example":{"id":1,"expiring_soon_window_days":30,"reminder_frequency_days":7,"automatic_reminders_enabled":true},"schema":{"$ref":"#/components/schemas/document_setting"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"patch":{"summary":"Change the document expiry settings","operationId":"document_settings.update","tags":["Documents"],"description":"Changes the company's document expiry settings; a field you leave out stays as it is.\n\n- `expiring_soon_window_days`: how many days before expiry a document is flagged \"expiring soon\" (and can\n  be reminded about).\n- `automatic_reminders_enabled`: QHR checks every morning and emails each employee about their documents\n  that are expiring soon and not muted.\n- `reminder_frequency_days`: how many days apart those reminders repeat for employees who can upload the\n  renewed copy themselves; others are reminded once per document.\n\n**When to use:** when HR wants earlier warnings (e.g. 60 days for iqamas) or wants to switch automatic\nreminders on or off.\n\n**Prerequisites:** none. Check the current values with `document_settings.show`.\n\n**Side effects:** applies to the whole company at once: every document's `expiry_state`, the expiry list\nand the next morning's reminder emails follow the new values. Recorded in the audit log. Not offered to\nClaude: it changes a company-wide setting that decides who gets emailed.","x-summary-ar":"تعديل إعدادات انتهاء المستندات","x-description-ar":"يغيّر إعدادات انتهاء المستندات في الشركة؛ والحقل الذي لا ترسله يبقى كما هو.\n\n- `expiring_soon_window_days`: كم يوماً قبل الانتهاء يُعلَّم المستند \"قريب الانتهاء\" (ويمكن التذكير به).\n- `automatic_reminders_enabled`: يفحص QHR كل صباح ويرسل لكل موظف بريداً عن مستنداته القريبة من الانتهاء\n  غير المكتومة.\n- `reminder_frequency_days`: كل كم يوماً يتكرر التذكير للموظفين الذين يستطيعون رفع النسخة المجددة\n  بأنفسهم؛ أما غيرهم فيُذكَّرون مرة واحدة لكل مستند.\n\n**متى تستخدمه:** عندما تريد الموارد البشرية تنبيهاً أبكر (مثل ٦٠ يوماً للإقامات) أو تشغيل التذكيرات\nالتلقائية أو إيقافها.\n\n**المتطلبات:** لا شيء. اعرض القيم الحالية عبر `document_settings.show`.\n\n**الآثار الجانبية:** ينطبق على الشركة كلها دفعة واحدة: تتبع القيمَ الجديدة حالةُ `expiry_state` لكل مستند\nوقائمةُ الانتهاء ورسائلُ التذكير في الصباح التالي. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر\nإعداداً على مستوى الشركة يحدد من يصله البريد.","x-access":"write","x-permission":{"key":"document/edit","label":"Rename \u0026 reorganise","x-label-ar":"إعادة التسمية وإعادة التنظيم"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings after the change.","x-description-ar":"الإعدادات بعد التعديل.","content":{"application/json":{"example":{"id":1,"expiring_soon_window_days":60,"reminder_frequency_days":7,"automatic_reminders_enabled":true},"schema":{"$ref":"#/components/schemas/document_setting"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The settings are not valid.","x-description-ar":"الإعدادات غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"A day count is not a whole number of 1 or more.","x-meaning-ar":"أحد عددي الأيام ليس عدداً صحيحاً لا يقل عن 1.","x-fix":"Send whole numbers of 1 or more.","x-fix-ar":"أرسل أعداداً صحيحة لا تقل عن 1."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Expiring soon window days must be greater than or equal to 1","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["document_setting"],"properties":{"document_setting":{"type":"object","description":"The settings. Both day counts are whole numbers of 1 or more.","x-description-ar":"الإعدادات. عدد الأيام في الحقلين عدد صحيح لا يقل عن 1.","properties":{"expiring_soon_window_days":{"type":"integer","description":"Days before expiry a document counts as expiring soon.","x-description-ar":"عدد الأيام قبل الانتهاء التي يُعدّ فيها المستند قريب الانتهاء.","minimum":1},"reminder_frequency_days":{"type":"integer","description":"Days between repeated automatic reminders.","x-description-ar":"عدد الأيام بين تذكيرين تلقائيين.","minimum":1},"automatic_reminders_enabled":{"type":"boolean","description":"Email employees automatically every morning.","x-description-ar":"إرسال بريد تلقائي للموظفين كل صباح."}}}}},"example":{"document_setting":{"expiring_soon_window_days":60,"automatic_reminders_enabled":true}}}},"required":true,"description":"The settings to change."}}},"/documents":{"get":{"summary":"List documents with an expiry date","operationId":"documents.list","tags":["Documents"],"description":"Returns the employees' documents that have an expiry date — iqamas, passports, licences, contracts,\ncertificates — newest upload first, each with its expiry state (`valid`, `expiring_soon`, `expired`),\nwhether HR has verified it and whose it is. Only the latest version of each document is listed, and\ndocuments with no expiry date are left out (see them per employee with `folders.list`).\n\n**When to use:** to answer \"whose documents expire this month?\", \"which iqamas have expired?\" or \"which\nuploads still need verifying?\". Filter with `q[expiry_date_gteq]` / `q[expiry_date_lteq]` for a date range,\n`q[expiry_date_lt]` set to today for expired ones, `q[verified_eq]=false` for unverified ones and\n`q[employee_name_cont]` for one person. The \"expiring soon\" window is in `document_settings.show`.\n\n**Prerequisites:** none. Admins see every employee's documents; anyone else sees their own and their\ndirect reports'.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض المستندات ذات تاريخ الانتهاء","x-description-ar":"يعرض مستندات الموظفين التي لها تاريخ انتهاء — الإقامات وجوازات السفر والرخص والعقود والشهادات — الأحدث\nرفعاً أولاً، ولكل مستند حالة انتهائه (`valid` ساري، `expiring_soon` ينتهي قريباً، `expired` منتهٍ)، وهل\nتحققت منه الموارد البشرية، ولمن هو. يظهر أحدث إصدار فقط من كل مستند، ولا تظهر المستندات التي بلا تاريخ\nانتهاء (اعرضها لكل موظف عبر `folders.list`).\n\n**متى تستخدمه:** للإجابة عن \"مستندات من تنتهي هذا الشهر؟\" أو \"أي الإقامات انتهت؟\" أو \"أي المستندات\nالمرفوعة لم يُتحقق منها بعد؟\". صفِّ بـ `q[expiry_date_gteq]` و`q[expiry_date_lteq]` لفترة زمنية، و\n`q[expiry_date_lt]` بتاريخ اليوم للمنتهية، و`q[verified_eq]=false` لغير المتحقق منها، و`q[employee_name_cont]`\nلشخص بعينه. مدة \"ينتهي قريباً\" موجودة في `document_settings.show`.\n\n**المتطلبات:** لا شيء. يرى مسؤول النظام مستندات جميع الموظفين، ويرى غيره مستنداته ومستندات مرؤوسيه\nالمباشرين.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة"},"x-feature":"document","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee's name contains (in the language of `Accept-Language`).","x-description-ar":"اسم الموظف يحتوي على (بلغة `Accept-Language`).","example":"Layla"},{"name":"q[expiry_date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires on or after this date.","x-description-ar":"ينتهي في هذا التاريخ أو بعده.","example":"2027-03-01"},{"name":"q[expiry_date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires on or before this date.","x-description-ar":"ينتهي في هذا التاريخ أو قبله.","example":"2027-03-31"},{"name":"q[expiry_date_gt]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires after this date.","x-description-ar":"ينتهي بعد هذا التاريخ.","example":"2027-03-01"},{"name":"q[expiry_date_lt]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires before this date. Send today's date for the expired documents.","x-description-ar":"ينتهي قبل هذا التاريخ. أرسل تاريخ اليوم لعرض المستندات المنتهية.","example":"2027-02-27"},{"name":"q[verified_eq]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` for verified documents only, `false` for the ones HR has not checked yet.","x-description-ar":"`true` للمتحقق منها فقط، و`false` لما لم تتحقق منه الموارد البشرية بعد.","example":false},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`, on `expiry_date`, `title`, `verified`, `employee_name` or `created_at`. Newest upload first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` على `expiry_date` أو `title` أو `verified` أو `employee_name` أو `created_at`. الأحدث رفعاً أولاً إن لم يُرسل.","example":"expiry_date asc"}],"responses":{"200":{"description":"A page of documents.","x-description-ar":"صفحة من المستندات.","content":{"application/json":{"example":{"records":[{"id":512,"title":"Iqama","expiry_date":"2027-03-01","expiry_state":"expiring_soon","verified":true,"reminders_enabled":true,"version_number":1,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"}],"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/document_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Upload a document to an employee's folder","operationId":"documents.create","tags":["Documents"],"description":"Uploads a file (PDF, JPEG or PNG, up to 10 MB) into one of an employee's folders, with a name and,\nfor papers that expire (iqama, passport, licence, contract), an expiry date. Send it as\n`multipart/form-data`.\n\n**When to use:** to file a new document on an employee's profile. To replace the file of an existing\ndocument, or renew one that is expiring, use `documents.update` instead so its history is kept.\n\n**Prerequisites:** the folder's `id` from `folders.list` (the employee's `id` from `employees.list`). You\ncan only upload to the folders of employees you can see (admins: everyone; others: themselves and their\ndirect reports). Always send the folder: a document without one is not shown anywhere and is cleared\nwithin the hour.\n\n**Side effects:** a document uploaded by someone other than the folder's owner (e.g. HR) is marked\nverified; one an employee uploads to their own folder waits for HR to verify it. With an expiry date it\nappears in `documents.list` and in the expiry reminders. Recorded in the audit log. Not offered to\nClaude: it uploads a file.","x-summary-ar":"رفع مستند إلى مجلد موظف","x-description-ar":"يرفع ملفاً (PDF أو JPEG أو PNG، حتى ١٠ ميجابايت) إلى أحد مجلدات الموظف، باسم، وبتاريخ انتهاء للأوراق\nالتي تنتهي صلاحيتها (الإقامة والجواز والرخصة والعقد). أرسله بصيغة `multipart/form-data`.\n\n**متى تستخدمه:** لحفظ مستند جديد في ملف الموظف. لاستبدال ملف مستند موجود أو تجديد مستند قارب على\nالانتهاء، استخدم `documents.update` حتى يبقى سجله محفوظاً.\n\n**المتطلبات:** رقم `id` المجلد من `folders.list` (ورقم `id` الموظف من `employees.list`). لا ترفع إلا إلى\nمجلدات الموظفين الذين تستطيع رؤيتهم (مسؤول النظام: الجميع؛ وغيره: نفسه ومرؤوسوه المباشرون). أرسل المجلد\nدائماً: المستند بلا مجلد لا يظهر في أي مكان ويُحذف خلال ساعة.\n\n**الآثار الجانبية:** المستند الذي يرفعه شخص غير صاحب المجلد (مثل الموارد البشرية) يُعلَّم متحققاً منه،\nوالذي يرفعه الموظف في مجلده ينتظر تحقق الموارد البشرية. إن كان له تاريخ انتهاء يظهر في `documents.list`\nوفي تذكيرات الانتهاء. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يرفع ملفاً.","x-access":"write","x-permission":{"key":"document/create","label":"Upload files \u0026 create folders","x-label-ar":"رفع ملفات وإنشاء مجلدات"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new document.","x-description-ar":"المستند الجديد.","content":{"application/json":{"example":{"id":513,"title":"Passport","expiry_date":"2031-06-30","expiry_state":"valid","verified":true,"reminders_enabled":true,"version_number":1,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"passport.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"},"schema":{"$ref":"#/components/schemas/document"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The document cannot be saved.","x-description-ar":"لا يمكن حفظ المستند.","x-codes":[{"code":"validation_failed","meaning":"The name is missing, or the file is not a PDF, JPEG or PNG, or is larger than 10 MB.","x-meaning-ar":"الاسم ناقص، أو الملف ليس PDF أو JPEG أو PNG، أو حجمه أكبر من ١٠ ميجابايت.","x-fix":"Send a name and a PDF, JPEG or PNG file of 10 MB or less.","x-fix-ar":"أرسل اسماً وملف PDF أو JPEG أو PNG لا يتجاوز ١٠ ميجابايت."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"File must be a PDF, JPG, or PNG","errors":["File must be a PDF, JPG, or PNG"],"code":"validation_failed"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","required":["attachment[title]","attachment[file]"],"properties":{"attachment[title]":{"type":"string","description":"The document's name, e.g. \"Iqama\".","x-description-ar":"اسم المستند، مثل «الإقامة»."},"attachment[file]":{"type":"string","description":"The file: PDF, JPEG or PNG, up to 10 MB.","x-description-ar":"الملف: PDF أو JPEG أو PNG، بحد أقصى ١٠ ميجابايت.","format":"binary"},"attachment[expiry_date]":{"type":"string","description":"When the document expires (YYYY-MM-DD). Leave out for a document that does not expire; it then does not appear in `documents.list`.","x-description-ar":"تاريخ انتهاء المستند (YYYY-MM-DD). لا ترسله لمستند لا ينتهي؛ وعندها لا يظهر في `documents.list`.","format":"date"},"attachment[attachable_type]":{"type":"string","description":"Always `Folder`.","x-description-ar":"دائماً `Folder`.","enum":["Folder"]},"attachment[attachable_id]":{"type":"integer","description":"The folder to file it in, from `folders.list`.","x-description-ar":"المجلد الذي يُحفظ فيه، من `folders.list`."}}},"example":{"attachment[title]":"Passport","attachment[file]":"(binary: passport.pdf)","attachment[expiry_date]":"2031-06-30","attachment[attachable_type]":"Folder","attachment[attachable_id]":31}}},"required":true,"description":"The document, as multipart form fields."}}},"/documents/export":{"get":{"summary":"Download the Documents list as Excel or CSV","operationId":"documents.export","tags":["Documents"],"description":"Builds a spreadsheet of the same documents `documents.list` returns for the same filters — documents with an\nexpiry date, latest version only — with the columns you pick. Choose the file type with `format=xlsx` (Excel)\nor `format=csv`.\n\n**When to use:** to hand HR or a government-relations officer a file of expiring or expired documents.\nFor questions about a few documents, `documents.list` is lighter.\n\n**Prerequisites:** at least one column key from `documents.export_columns` in `columns[]`. Needs the HR\ndata export permission as well as viewing documents. You only get the employees you can see.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000\ndocuments the file comes straight back; above that the answer is `202` and the file is built in the\nbackground and emailed to you when ready. At most 20,000 rows, and one Documents export at a time per\nperson. Not offered to Claude: it returns a file, not JSON.","x-summary-ar":"تنزيل قائمة المستندات بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بالمستندات نفسها التي يعيدها `documents.list` بالمرشحات نفسها — المستندات ذات تاريخ\nالانتهاء، وأحدث إصدار فقط — بالأعمدة التي تختارها. اختر نوع الملف بـ `format=xlsx` (Excel) أو\n`format=csv`.\n\n**متى تستخدمه:** لتسليم الموارد البشرية أو مسؤول العلاقات الحكومية ملفاً بالمستندات القريبة من الانتهاء\nأو المنتهية. للأسئلة عن عدد قليل من المستندات، `documents.list` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `documents.export_columns` في `columns[]`. تحتاج صلاحية تصدير\nبيانات الموارد البشرية إضافة إلى عرض المستندات. لا يشمل الملف إلا الموظفين الذين تستطيع رؤيتهم.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ مستند يعود الملف\nمباشرة؛ وما زاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويُرسل إليك بالبريد عند جاهزيته. الحد\nالأقصى ٢٠٬٠٠٠ صف، وتصدير واحد للمستندات في الوقت نفسه لكل شخص. لا يُعرض على Claude لأنه يعيد ملفاً لا\nJSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة"}]},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `documents.export_columns`, in the order you want them. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `documents.export_columns` بالترتيب الذي تريده. كرر المعامل لكل عمود.","example":["employee_name","title","expiry_date","expiry_state"]},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee's name contains.","x-description-ar":"اسم الموظف يحتوي على.","example":"Layla"},{"name":"q[expiry_date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires on or after this date.","x-description-ar":"ينتهي في هذا التاريخ أو بعده.","example":"2027-03-01"},{"name":"q[expiry_date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires on or before this date.","x-description-ar":"ينتهي في هذا التاريخ أو قبله.","example":"2027-03-31"},{"name":"q[expiry_date_gt]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires after this date.","x-description-ar":"ينتهي بعد هذا التاريخ.","example":"2027-03-01"},{"name":"q[expiry_date_lt]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Expires before this date (today's date: the expired ones).","x-description-ar":"ينتهي قبل هذا التاريخ (تاريخ اليوم: المنتهية).","example":"2027-02-27"},{"name":"q[verified_eq]","in":"query","required":false,"schema":{"type":"boolean"},"description":"Verified (`true`) or not yet verified (`false`) only.","x-description-ar":"المتحقق منها (`true`) أو غير المتحقق منها بعد (`false`) فقط.","example":false},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Row order, `\u003cfield\u003e asc|desc` (as in `documents.list`). Newest upload first when omitted.","x-description-ar":"ترتيب الصفوف بالشكل `\u003cfield\u003e asc|desc` (كما في `documents.list`). الأحدث رفعاً أولاً إن لم يُرسل.","example":"expiry_date asc"}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked with `format`).","x-description-ar":"الملف (`xlsx` أو `csv` حسب `format`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many documents to build now: the export is queued and emailed when ready.","x-description-ar":"المستندات أكثر من أن يُنشأ ملفها فوراً: أُدرج التصدير في الانتظار ويُرسل بالبريد عند جاهزيته.","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"type":"object","description":"The queued export.","x-description-ar":"التصدير المنتظر.","properties":{"id":{"type":"integer","description":"Export id.","x-description-ar":"رقم التصدير."},"status":{"type":"string","description":"`queued`, then `processing`, then `ready`.","x-description-ar":"`queued` ثم `processing` ثم `ready`."},"total_records":{"type":"integer","description":"Documents being exported.","x-description-ar":"عدد المستندات الجاري تصديرها."},"filename":{"type":"string","description":"The file's name.","x-description-ar":"اسم الملف."}}}}},"example":{"export":{"id":77,"page":"attachments","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2027-02-27.xlsx","error_code":null,"created_at":"2027-02-27T10:00:00+03:00","snapshot_at":"2027-02-27T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` غير موجود أو ليس `xlsx` ولا `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل أي `columns[]`.","x-fix":"Send at least one key from `documents.export_columns`.","x-fix-ar":"أرسل مفتاحاً واحداً على الأقل من `documents.export_columns`."},{"code":"unknown_column","meaning":"A column key is not one of `documents.export_columns`.","x-meaning-ar":"أحد مفاتيح الأعمدة ليس من `documents.export_columns`.","x-fix":"Use only the keys `documents.export_columns` returns.","x-fix-ar":"استخدم المفاتيح التي يعيدها `documents.export_columns` فقط."},{"code":"bad_filters","meaning":"A filter value (`q[...]`) cannot be read.","x-meaning-ar":"قيمة أحد المرشحات (`q[...]`) لا يمكن قراءتها.","x-fix":"Send dates as YYYY-MM-DD and sorts as `\u003cfield\u003e asc|desc`.","x-fix-ar":"أرسل التواريخ بالشكل YYYY-MM-DD والترتيب بالشكل `\u003cfield\u003e asc|desc`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"A Documents export of yours is already running.","x-description-ar":"يوجد تصدير مستندات خاص بك قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"Your previous Documents export is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق للمستندات ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for its email, then export again.","x-fix-ar":"انتظر بريده ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"No document matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي مستند.","x-fix":"Widen or remove the filters.","x-fix-ar":"وسّع المرشحات أو أزلها."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters, e.g. a shorter expiry date range.","x-fix-ar":"ضيّق المرشحات، مثل فترة انتهاء أقصر."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/documents/export/columns":{"get":{"summary":"List the columns of the Documents export","operationId":"documents.export_columns","tags":["Documents"],"description":"Returns the columns the Documents spreadsheet can contain — employee, employee number, document, expiry\ndate, status, verified, version, reminders, file name, upload date — with their label in the requested\nlanguage and whether they are picked by default.\n\n**When to use:** before `documents.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs the HR data export permission as well as viewing documents.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير المستندات","x-description-ar":"يعرض الأعمدة التي يمكن أن يحتويها ملف المستندات — الموظف والرقم الوظيفي والمستند وتاريخ الانتهاء والحالة\nوالتحقق والإصدار والتذكيرات واسم الملف وتاريخ الرفع — مع تسمية كل عمود بلغة الطلب، وهل هو مختار افتراضياً.\n\n**متى تستخدمه:** قبل `documents.export` لاختيار قيم `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. تحتاج صلاحية تصدير بيانات الموارد البشرية إضافة إلى عرض المستندات.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة"}]},"x-feature":"document","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The available columns.","x-description-ar":"الأعمدة المتاحة.","content":{"application/json":{"example":{"columns":[{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"title","label":"Document","default":true,"type":"string"},{"key":"expiry_date","label":"Expiry Date","default":true,"type":"date"},{"key":"version_number","label":"Version","default":false,"type":"integer"}]},"schema":{"type":"object","required":["columns"],"properties":{"columns":{"type":"array","description":"Columns, in file order.","x-description-ar":"الأعمدة بترتيبها في الملف.","items":{"type":"object","properties":{"key":{"type":"string","description":"What to send in `columns[]`.","x-description-ar":"القيمة التي ترسلها في `columns[]`."},"label":{"type":"string","description":"Column heading in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Picked by default in the web app.","x-description-ar":"مختار افتراضياً في تطبيق الويب."},"type":{"type":"string","description":"Value type: `string`, `date`, `datetime`, `enum`, `boolean`, `integer`.","x-description-ar":"نوع القيمة: `string` أو `date` أو `datetime` أو `enum` أو `boolean` أو `integer`."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/documents/{id}":{"patch":{"summary":"Update, renew, verify or mute a document","operationId":"documents.update","tags":["Documents"],"description":"Changes a document. Send only the fields you change, as `multipart/form-data` (a JSON body\n`{ \"attachment\": { … } }` works too when no file is sent):\n\n- **Correct it:** `title`, `expiry_date`, or move it to another folder (`attachable_id`).\n- **Verify it:** `verified=true` once HR has checked an employee's upload.\n- **Mute it:** `reminders_enabled=false` stops expiry reminders for every version of the document;\n  `true` turns them back on.\n- **Renew it:** send a new `file` with the new `expiry_date` for a document that is expiring soon or has\n  expired. QHR keeps the old one as a previous version and answers `201` with the new version (new `id`,\n  `version_number` + 1). For a document that is not expiring, a new file simply replaces the old one\n  (`200`).\n\n**When to use:** after an employee renews their iqama or passport, to approve an upload, or to stop\nreminders for a document that will not be renewed (e.g. the employee is leaving).\n\n**Prerequisites:** the document's `id`, from `documents.list` or `folders.list`; a new folder's `id` from\n`folders.list`. A folder id that does not exist, or a target that is not a folder, is refused with\n`422`.\n\n**Side effects:** a new expiry date in the future resets the reminder schedule. A renewal is verified\nwhen uploaded by someone other than the folder's owner. Recorded in the audit log. Not offered to Claude:\nit can upload a file and replace an employee's official papers.","x-summary-ar":"تعديل مستند أو تجديده أو اعتماده أو كتم تذكيراته","x-description-ar":"يعدّل المستند. أرسل الحقول التي تغيّرها فقط بصيغة `multipart/form-data` (ويصلح جسم JSON بالشكل\n`{ \"attachment\": { … } }` إن لم ترسل ملفاً):\n\n- **التصحيح:** `title` أو `expiry_date`، أو النقل إلى مجلد آخر (`attachable_id`).\n- **الاعتماد:** `verified=true` بعد أن تتحقق الموارد البشرية من مستند رفعه الموظف.\n- **كتم التذكيرات:** `reminders_enabled=false` يوقف تذكيرات الانتهاء لكل إصدارات المستند، و`true` يعيدها.\n- **التجديد:** أرسل `file` جديداً مع `expiry_date` الجديد لمستند قارب على الانتهاء أو انتهى. يحتفظ QHR\n  بالقديم كإصدار سابق ويعيد `201` مع الإصدار الجديد (رقم `id` جديد، و`version_number` + 1). أما المستند\n  غير القريب من الانتهاء فيحل الملف الجديد محل القديم ببساطة (`200`).\n\n**متى تستخدمه:** بعد أن يجدد الموظف إقامته أو جوازه، أو لاعتماد مستند مرفوع، أو لإيقاف تذكيرات مستند لن\nيُجدد (كأن يكون الموظف مغادراً).\n\n**المتطلبات:** رقم `id` المستند من `documents.list` أو `folders.list`، ورقم `id` المجلد الجديد من\n`folders.list`. يُرفض برمز `422` رقم مجلد غير موجود أو هدف ليس مجلداً.\n\n**الآثار الجانبية:** تاريخ الانتهاء الجديد في المستقبل يعيد جدول التذكيرات من البداية. يكون التجديد\nمتحققاً منه إذا رفعه شخص غير صاحب المجلد. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه قد يرفع ملفاً\nويستبدل أوراق الموظف الرسمية.","x-access":"write","x-permission":{"key":"document/edit","label":"Rename \u0026 reorganise","x-label-ar":"إعادة التسمية وإعادة التنظيم"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/document_id"}],"responses":{"200":{"description":"The document after the change.","x-description-ar":"المستند بعد التعديل.","content":{"application/json":{"example":{"id":512,"title":"Iqama","expiry_date":"2027-03-01","expiry_state":"expiring_soon","verified":true,"reminders_enabled":false,"version_number":1,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"},"schema":{"$ref":"#/components/schemas/document"}}}},"201":{"description":"Renewed: the new current version.","x-description-ar":"جُدد: الإصدار الحالي الجديد.","content":{"application/json":{"example":{"id":640,"title":"Iqama","expiry_date":"2029-03-01","expiry_state":"valid","verified":true,"reminders_enabled":true,"version_number":2,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama-2029.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"},"schema":{"$ref":"#/components/schemas/document"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"409":{"description":"Someone renewed the document at the same moment.","x-description-ar":"جدّد شخص آخر المستند في اللحظة نفسها.","x-codes":[{"code":"conflict","meaning":"Another renewal of this document was saved at the same time.","x-meaning-ar":"حُفظ تجديد آخر لهذا المستند في الوقت نفسه.","x-fix":"Read the document again with `documents.versions`, then retry if still needed.","x-fix-ar":"اعرض المستند مجدداً عبر `documents.versions`، ثم أعد المحاولة إن لزم."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A newer version already exists; please retry.","errors":["A newer version already exists; please retry."],"code":"conflict"}}}},"422":{"description":"The change cannot be saved.","x-description-ar":"لا يمكن حفظ التعديل.","x-codes":[{"code":"validation_failed","meaning":"A renewal was sent without a new `expiry_date`, the name was emptied, the file is not a PDF, JPEG or PNG of 10 MB or less, or the target folder does not exist.","x-meaning-ar":"أُرسل تجديد بلا `expiry_date` جديد، أو أُفرغ الاسم، أو الملف ليس PDF أو JPEG أو PNG بحجم ١٠ ميجابايت أو أقل، أو المجلد الهدف غير موجود.","x-fix":"Send the new expiry date with the new file; keep a name; use a supported file; take the folder id from `folders.list`.","x-fix-ar":"أرسل تاريخ الانتهاء الجديد مع الملف الجديد، وأبقِ الاسم، واستخدم ملفاً مدعوماً، وخذ رقم المجلد من `folders.list`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"expiry_date is required when replacing an expiring or expired document","errors":["expiry_date is required when replacing an expiring or expired document"],"code":"validation_failed"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"attachment[title]":{"type":"string","description":"The document's name, e.g. \"Iqama\".","x-description-ar":"اسم المستند، مثل «الإقامة»."},"attachment[file]":{"type":"string","description":"The file: PDF, JPEG or PNG, up to 10 MB.","x-description-ar":"الملف: PDF أو JPEG أو PNG، بحد أقصى ١٠ ميجابايت.","format":"binary"},"attachment[expiry_date]":{"type":"string","description":"When the document expires (YYYY-MM-DD). Leave out for a document that does not expire; it then does not appear in `documents.list`.","x-description-ar":"تاريخ انتهاء المستند (YYYY-MM-DD). لا ترسله لمستند لا ينتهي؛ وعندها لا يظهر في `documents.list`.","format":"date"},"attachment[attachable_type]":{"type":"string","description":"Always `Folder`.","x-description-ar":"دائماً `Folder`.","enum":["Folder"]},"attachment[attachable_id]":{"type":"integer","description":"The folder to file it in, from `folders.list`.","x-description-ar":"المجلد الذي يُحفظ فيه، من `folders.list`."},"attachment[verified]":{"type":"boolean","description":"`true` to mark the document as checked by HR.","x-description-ar":"`true` لتعليم المستند متحققاً منه من الموارد البشرية."},"attachment[reminders_enabled]":{"type":"boolean","description":"`false` mutes expiry reminders for every version; `true` turns them back on.","x-description-ar":"`false` يكتم تذكيرات الانتهاء لكل الإصدارات، و`true` يعيدها."}}},"example":{"attachment[file]":"(binary: iqama-2029.pdf)","attachment[expiry_date]":"2029-03-01"}}},"required":true,"description":"The fields to change, as multipart form fields."}},"delete":{"summary":"Delete a document","operationId":"documents.delete","tags":["Documents"],"description":"Deletes a document and its file for good. Only the version you name is deleted; its other versions stay\n(see `documents.versions`).\n\n**When to use:** to remove a file uploaded by mistake. To stop reminders for a document that is no longer\nneeded, muting it with `documents.update` (`reminders_enabled=false`) keeps the record.\n\n**Prerequisites:** the document's `id`, from `documents.list`, `folders.list` or `documents.versions`.\n\n**Side effects:** the file is erased from storage and the deletion is recorded in the audit log. It cannot\nbe undone, so it is not offered to Claude.","x-summary-ar":"حذف مستند","x-description-ar":"يحذف المستند وملفه نهائياً. يُحذف الإصدار الذي تحدده فقط، وتبقى إصداراته الأخرى (انظر\n`documents.versions`).\n\n**متى تستخدمه:** لإزالة ملف رُفع بالخطأ. لإيقاف تذكيرات مستند لم يعد مطلوباً، كتمها عبر `documents.update`\n(`reminders_enabled=false`) يُبقي السجل.\n\n**المتطلبات:** رقم `id` المستند من `documents.list` أو `folders.list` أو `documents.versions`.\n\n**الآثار الجانبية:** يُمحى الملف من التخزين ويُسجَّل الحذف في سجل التدقيق. لا يمكن التراجع عنه، لذلك لا\nيُعرض على Claude.","x-access":"write","x-permission":{"key":"document/delete","label":"Delete files \u0026 folders","x-label-ar":"حذف الملفات والمجلدات"},"x-feature":"document","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/document_id"}],"responses":{"204":{"description":"Deleted. No body.","x-description-ar":"حُذف. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"}}}},"/documents/{id}/reminders":{"post":{"summary":"Email an employee a reminder that a document is expiring","operationId":"documents.send_reminder","tags":["Documents"],"description":"Emails the employee who owns the document, right away, that it is about to expire, with its name and\nexpiry date. If their role lets them upload documents, the email invites them to upload the renewed copy.\n\n**When to use:** to chase one employee about one document without waiting for the automatic reminders\n(`document_settings.show`). Only for a document that is expiring soon, whose reminders are not muted, and\nwhose employee has a QHR login.\n\n**Prerequisites:** the document's `id`, from `documents.list` (`expiry_state: expiring_soon`).\n\n**Side effects:** one email to the employee; the document's last-reminder date is set, so the automatic\nreminders count from now. Not offered to Claude: it sends an email on your behalf.","x-summary-ar":"إرسال تذكير بالبريد للموظف بقرب انتهاء مستند","x-description-ar":"يرسل فوراً بريداً إلى الموظف صاحب المستند بأن مستنده قارب على الانتهاء، مع اسمه وتاريخ انتهائه. وإن كان\nدوره يسمح له برفع المستندات، يدعوه البريد إلى رفع النسخة المجددة.\n\n**متى تستخدمه:** لمتابعة موظف بشأن مستند واحد دون انتظار التذكيرات التلقائية (`document_settings.show`).\nفقط لمستند قارب على الانتهاء، وتذكيراته غير مكتومة، ولصاحبه حساب دخول في QHR.\n\n**المتطلبات:** رقم `id` المستند من `documents.list` (`expiry_state: expiring_soon`).\n\n**الآثار الجانبية:** بريد واحد للموظف، ويُحدَّث تاريخ آخر تذكير للمستند فتُحسب التذكيرات التلقائية من الآن.\nلا يُعرض على Claude لأنه يرسل بريداً نيابة عنك.","x-access":"write","x-permission":{"key":"document/edit","label":"Rename \u0026 reorganise","x-label-ar":"إعادة التسمية وإعادة التنظيم"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/document_id"}],"responses":{"204":{"description":"Sent. No body.","x-description-ar":"أُرسل. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"No reminder can be sent for this document.","x-description-ar":"لا يمكن إرسال تذكير لهذا المستند.","x-codes":[{"code":"validation_failed","meaning":"Reminders are muted for the document, it is not expiring soon (already expired, or outside the window), or the employee has no QHR login email.","x-meaning-ar":"تذكيرات المستند مكتومة، أو أنه لا ينتهي قريباً (منتهٍ بالفعل أو خارج المدة)، أو ليس للموظف بريد دخول إلى QHR.","x-fix":"Unmute it with `documents.update`, renew an expired one instead, or invite the employee to QHR first.","x-fix-ar":"ألغِ الكتم عبر `documents.update`، أو جدّد المستند المنتهي بدلاً من التذكير، أو ادعُ الموظف إلى QHR أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This employee has no login email, so a reminder cannot be sent.","code":"validation_failed"}}}}}}},"/documents/{id}/versions":{"get":{"summary":"List a document's versions","operationId":"documents.versions","tags":["Documents"],"description":"Returns every version of a document, latest first. A new version is created when an expiring or expired\ndocument is renewed with a new file (`documents.update`); the older copies are kept with\n`current_version: false`, each with its own file, expiry date and verification.\n\n**When to use:** to see a document's history — e.g. \"when was Layla's iqama last renewed?\" — or to get an\nolder copy's file. Any version's `id` works.\n\n**Prerequisites:** the document's `id`, from `documents.list` or `folders.list`. You can only see the\nversions of documents belonging to employees you can see (admins: everyone; others: themselves and their\ndirect reports); anyone else's document answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض إصدارات مستند","x-description-ar":"يعرض كل إصدارات المستند، الأحدث أولاً. يُنشأ إصدار جديد عند تجديد مستند قارب على الانتهاء أو انتهى بملف\nجديد (`documents.update`)، وتُحفظ النسخ الأقدم مع `current_version: false`، ولكل منها ملفها وتاريخ\nانتهائها وحالة التحقق منها.\n\n**متى تستخدمه:** لمعرفة تاريخ المستند — مثل \"متى جُددت إقامة ليلى آخر مرة؟\" — أو للحصول على ملف نسخة\nأقدم. يصلح رقم `id` أي إصدار.\n\n**المتطلبات:** رقم `id` المستند من `documents.list` أو `folders.list`. لا ترى إلا إصدارات مستندات الموظفين\nالذين تستطيع رؤيتهم (مسؤول النظام: الجميع؛ وغيره: نفسه ومرؤوسوه المباشرون)، ومستند غيرهم يعود بالرمز 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة"},"x-feature":"document","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/document_id"}],"responses":{"200":{"description":"Every version, latest first.","x-description-ar":"كل الإصدارات، الأحدث أولاً.","content":{"application/json":{"example":[{"id":640,"title":"Iqama","expiry_date":"2029-03-01","expiry_state":"valid","verified":true,"reminders_enabled":true,"version_number":2,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama-renewed.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"},{"id":512,"title":"Iqama","expiry_date":"2027-03-01","expiry_state":"expired","verified":true,"reminders_enabled":true,"version_number":1,"current_version":false,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"}],"schema":{"type":"array","items":{"$ref":"#/components/schemas/document"}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/employees":{"get":{"summary":"List employees","operationId":"employees.list","tags":["Employees"],"description":"Returns the company's employees, newest first, with their job, department, status and QHR login status.\nLeavers are included; filter with `q[employment_status_eq]`.\n\n**When to use:** to browse or filter the people directory, or to find an employee's `id`, which the other\nemployee operations need. To look someone up by name, `employees.search` is lighter.\n\n**Prerequisites:** none. Ids for the department filter come from `employees.meta_data` (`departments`).\n\n**Side effects:** none. Up to 200 employees per page.","x-summary-ar":"عرض قائمة الموظفين","x-description-ar":"يعرض موظفي الشركة، الأحدث إضافةً أولاً، مع الوظيفة والقسم وحالة التوظيف وحالة الدخول إلى QHR. يشمل من\nغادروا؛ صفِّ بـ `q[employment_status_eq]`.\n\n**متى تستخدمه:** لتصفح دليل الموظفين أو تصفيته، أو لمعرفة رقم `id` الموظف الذي تحتاجه عمليات الموظفين\nالأخرى. للبحث عن شخص بالاسم، `employees.search` أخف.\n\n**المتطلبات:** لا شيء. أرقام الأقسام للتصفية من `employees.meta_data` (`departments`).\n\n**الآثار الجانبية:** لا شيء. حتى ٢٠٠ موظف في الصفحة.","x-access":"read","x-permission":{"key":"employee/view_employee","label":"View employees directory","x-label-ar":"عرض دليل الموظفين"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains (English or Arabic).","x-description-ar":"الاسم يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[employment_status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["active","notice_period","inactive"]},"description":"Only this employment status.","x-description-ar":"حالة توظيف محددة فقط.","example":"active"},{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department (id from `employees.meta_data`).","x-description-ar":"قسم محدد فقط (الرقم من `employees.meta_data`).","example":4},{"name":"q[manager_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only the direct reports of this employee id.","x-description-ar":"المرؤوسون المباشرون لهذا الموظف فقط.","example":88},{"name":"q[employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"name":"q[email_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Email contains.","x-description-ar":"البريد يحتوي على.","example":"@example.com"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`, e.g. `first_name asc`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`، مثل `first_name asc`. الأحدث أولاً إن لم يُرسل.","example":"first_name asc"}],"responses":{"200":{"description":"A page of employees.","x-description-ar":"صفحة من الموظفين.","content":{"application/json":{"example":{"records":[{"id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","employee_email":"sara@example.com","job_title":"Accountant","department":"Finance","employment_type":"Full time","manager_id":88,"status":"Active","status_key":"active","portal_access":"Activated","portal_access_key":"activated","start_date":"2024-03-01","residence_country":"Saudi Arabia","location_id":2,"location":"Riyadh HQ","additional_locations":[],"employee_image":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/employee_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add an employee","operationId":"employees.create","tags":["Employees"],"description":"Adds a new employee with their personal data, their contract (`employment_detail`) and, optionally, their\nstarting salary (`salary`). QHR gives them the next employee number.\n\n**When to use:** when someone joins the company. To add many people at once, use the employee import instead.\n\n**Prerequisites:** ids for `department_id`, `location_id`, `employment_type_id` and `attendance_setting_id`\nfrom `employees.meta_data`; `manager_id` from `employees.managers`. Check the email first with\n`employees.validate_email`.\n\n**Side effects:** with `invite_to_portal: true` the employee is emailed an invitation to sign in to QHR, with\nthe role `tenant_role_id`. If the email is the login of a company user with no employee record, that user is\nlinked to the new employee. The change is recorded in the audit log, and companies connected to Qoyod\naccounting get the employee synced there.\n\n**Not offered to Claude:** an invitation can grant any active role, Admin included, so adding an\nemployee is also a way of giving someone access to QHR.","x-summary-ar":"إضافة موظف","x-description-ar":"يضيف موظفاً جديداً ببياناته الشخصية وبيانات عقده (`employment_detail`)، واختيارياً راتبه عند البداية\n(`salary`). يعطيه QHR الرقم الوظيفي التالي.\n\n**متى تستخدمه:** عند انضمام شخص إلى الشركة. لإضافة عدد كبير دفعة واحدة استخدم استيراد الموظفين.\n\n**المتطلبات:** أرقام `department_id` و`location_id` و`employment_type_id` و`attendance_setting_id` من\n`employees.meta_data`، و`manager_id` من `employees.managers`. تحقق من البريد أولاً عبر\n`employees.validate_email`.\n\n**الآثار الجانبية:** مع `invite_to_portal: true` يصل الموظفَ بريد دعوة للدخول إلى QHR بالدور\n`tenant_role_id`. وإن كان البريد بريد دخول مستخدم في الشركة بلا سجل وظيفي، يُربط ذلك المستخدم بالموظف الجديد.\nيُسجَّل التغيير في سجل التدقيق، وتُزامَن بيانات الموظف مع محاسبة قيود للشركات المرتبطة بها.\n\n**لا يُعرض على Claude:** يمكن أن تمنح الدعوة أي دور نشط بما فيه مدير النظام، فإضافة موظف هي أيضاً طريقة\nلمنح شخص صلاحية الدخول إلى QHR.","x-access":"write","x-permission":{"key":"employee/create","label":"Add employees","x-label-ar":"إضافة موظفين"},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new employee, with their full record.","x-description-ar":"الموظف الجديد بسجله الكامل.","content":{"application/json":{"example":{"id":1203,"employee_no":"E-0042","employee_no_locked":false,"first_name":"Sara","last_name":"Ahmed","first_name_ar":"سارة","last_name_ar":"أحمد","full_name":"Sara Ahmed","gender":"female","date_of_birth":"1994-05-12","marital_status":"single","nationality":"SA","residence_country":"SA","national_id_number":"1234567890","national_id_issued_date":"2022-01-10","national_id_expiry_date":"2032-01-09","email":"sara@example.com","work_email":"sara@acme.example","work_phone_number":"+966501234567","home_phone_number":null,"address":"Riyadh","emergency_contact_name":"Huda Ahmed","emergency_contact_relationship":"Sister","emergency_contact_home_phone_number":null,"emergency_contact_mobile_phone_number":"+966509876543","job_title":"Accountant","department_id":4,"manager_id":88,"manager_name":"Omar Ali","location_id":2,"location_name":"Riyadh HQ","additional_locations":[],"last_working_day":null,"employment_status":"Active","employment_status_key":"active","portal_access":"Activated","portal_access_key":"activated","has_portal_access":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working","flexible":false,"scheduled_hours":8.0},"employment_detail":{"id":1203,"join_date":"2024-03-01","employment_type_id":1,"contract_type":"indefinite","contract_end_date":null,"iban":"SA0380000000608010167519","bank_code":"RJHI","attendance_setting_id":1},"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","start_date":"2024-03-01","currency":"SAR","benefits":[],"salary_deductions":[],"insurance_deductions":[]},"documents":[],"created_at":"2024-02-20 06:30:00 UTC","updated_at":"2026-11-01 07:00:00 UTC"},"schema":{"$ref":"#/components/schemas/employee"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The employee cannot be added.","x-description-ar":"لا يمكن إضافة الموظف.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"email_taken","meaning":"The email belongs to another employee or user in this company. `employee_id` and `tenant_user_id` say who.","x-meaning-ar":"البريد يخص موظفاً أو مستخدماً آخر في هذه الشركة. يوضح `employee_id` و`tenant_user_id` صاحبه.","x-fix":"Use another email, or open the employee named in `employee_id`.","x-fix-ar":"استخدم بريداً آخر، أو افتح سجل الموظف المذكور في `employee_id`."},{"code":"employee_inactive","meaning":"The email is a user's login, and the employee would be inactive, so they cannot be linked.","x-meaning-ar":"البريد هو بريد دخول مستخدم، والموظف غير نشط، فلا يمكن ربطهما.","x-fix":"Use another email, or make the employee active.","x-fix-ar":"استخدم بريداً آخر، أو اجعل الموظف نشطاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This email already belongs to a user in this organization.","code":"email_taken","employee_id":1203,"tenant_user_id":51}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee"],"properties":{"employee":{"type":"object","required":["personal_info","employment_detail"],"description":"The employee's data, in three blocks.","x-description-ar":"بيانات الموظف في ثلاث مجموعات.","properties":{"personal_info":{"$ref":"#/components/schemas/employee_personal_info"},"employment_detail":{"$ref":"#/components/schemas/employee_employment_detail_create"},"salary":{"$ref":"#/components/schemas/employee_salary_input"}}},"invite_to_portal":{"type":"boolean","description":"Email the employee an invitation to sign in to QHR.","x-description-ar":"إرسال دعوة للموظف بالبريد للدخول إلى QHR."},"tenant_role_id":{"type":"integer","description":"Role the invitation grants (any active role); the default employee role when omitted.","x-description-ar":"الدور الذي تمنحه الدعوة (أي دور نشط)؛ دور الموظف الافتراضي إن لم يُرسل."}}},"example":{"employee":{"personal_info":{"first_name":"Sara","last_name":"Ahmed","first_name_ar":"سارة","last_name_ar":"أحمد","email":"sara@example.com","gender":"female","date_of_birth":"1994-05-12","marital_status":"single","nationality":"SA","residence_country":"SA","national_id_number":"1234567890","national_id_issued_date":"2022-01-10","national_id_expiry_date":"2032-01-09","work_phone_number":"+966501234567","job_title":"Accountant","employment_status":"active","department_id":4},"employment_detail":{"join_date":"2024-03-01","employment_type_id":1,"attendance_setting_id":1,"contract_type":"indefinite"},"salary":{"basic_salary_amount":"9000.00","basic_salary_kind":"fixed","pay_frequency":"monthly","start_date":"2024-03-01"}},"invite_to_portal":false}}},"required":true,"description":"The new employee."}}},"/employees/bulk_updates":{"post":{"summary":"Upload an edited bulk-edit sheet to preview its changes","operationId":"employee_bulk_updates.create","tags":["Employee imports \u0026 bulk updates"],"description":"Uploads the bulk-edit sheet after editing it (`.xlsx` or `.csv`, at most 5 MB and 500 rows, with an\n`employee_no` column) and starts building its preview in the background. Nothing changes on any employee\nyet: the preview lists, per row, what would change, what is unchanged and what is invalid. The answer is\n`202` with the `bulk_update_id`.\n\n**When to use:** after editing the file from `employee_bulk_updates.export`. Any column can be left out;\nonly the columns present are compared.\n\n**Prerequisites:** the edited file. Follow the preview with `employee_bulk_updates.show` until `status` is\n`awaiting_confirmation`, then apply it with `employee_bulk_updates.confirm` or drop it with\n`employee_bulk_updates.cancel`.\n\n**Side effects:** stores the uploaded rows until the bulk edit is confirmed, cancelled, or 24 hours pass.\n\n**Not offered to Claude:** it is a file upload, and the start of a change to many employees at once.","x-summary-ar":"رفع ملف التعديل الجماعي بعد تعديله لمعاينة تغييراته","x-description-ar":"يرفع ملف التعديل الجماعي بعد تعديله (`.xlsx` أو `.csv`، بحد أقصى ٥ ميغابايت و٥٠٠ صف، وفيه عمود\n`employee_no`) ويبدأ بناء معاينته في الخلفية. لا يتغير أي موظف بعد: تعرض المعاينة لكل صف ما الذي سيتغير وما\nبقي كما هو وما هو غير صالح. يكون الرد `202` مع `bulk_update_id`.\n\n**متى تستخدمه:** بعد تعديل الملف الناتج من `employee_bulk_updates.export`. يمكن حذف أي عمود؛ فلا تُقارن إلا\nالأعمدة الموجودة.\n\n**المتطلبات:** الملف بعد تعديله. تابع المعاينة عبر `employee_bulk_updates.show` إلى أن تصبح `status` هي\n`awaiting_confirmation`، ثم طبّقها عبر `employee_bulk_updates.confirm` أو تخلّص منها عبر\n`employee_bulk_updates.cancel`.\n\n**الآثار الجانبية:** تُحفظ صفوف الملف إلى أن يُؤكَّد التعديل أو يُلغى أو تمضي ٢٤ ساعة.\n\n**لا يُعرض على Claude:** لأنه رفع ملف، وبداية تغيير يطال عدداً كبيراً من الموظفين دفعة واحدة.","x-access":"write","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"202":{"description":"The file was accepted; the preview is being built.","x-description-ar":"قُبل الملف؛ وتُبنى المعاينة الآن.","content":{"application/json":{"example":{"bulk_update_id":42},"schema":{"type":"object","required":["bulk_update_id"],"properties":{"bulk_update_id":{"type":"integer","description":"The bulk edit's id, for `employee_bulk_updates.show`.","x-description-ar":"رقم التعديل الجماعي، لاستخدامه في `employee_bulk_updates.show`."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The file was refused.","x-description-ar":"رُفض الملف.","x-codes":[{"code":"validation_failed","meaning":"The file is over 5 MB or 500 rows, cannot be read, has no `employee_no` column, or has no rows.","x-meaning-ar":"الملف أكبر من ٥ ميغابايت أو ٥٠٠ صف، أو تتعذر قراءته، أو ليس فيه عمود `employee_no`، أو لا يحتوي على صفوف.","x-fix":"Start from `employee_bulk_updates.export`, keep `employee_no`, and stay within 500 rows.","x-fix-ar":"ابدأ من `employee_bulk_updates.export`، وأبقِ `employee_no`، ولا تتجاوز ٥٠٠ صف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The file is missing required columns: employee_no.","code":"validation_failed"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/employee_sheet_upload"}}},"required":true,"description":"The edited sheet, as the multipart field `file`."}}},"/employees/bulk_updates/export":{"post":{"summary":"Download selected employees as a bulk-edit spreadsheet","operationId":"employee_bulk_updates.export","tags":["Employee imports \u0026 bulk updates"],"description":"Returns an Excel sheet with one row per selected employee (by employee number) and their current values in\nevery column that can be bulk-edited: personal, job and contract data, bank details and, when the caller\nmay see salaries, salary and allowances. Up to 500 employees; ids the caller may not open are silently left\nout. It is a POST only because 500 ids do not fit a URL: nothing is changed or recorded, so a read-only\ntoken may call it.\n\n**When to use:** as the first step of a bulk edit. Edit the cells, keep `employee_no`, then upload the file\nwith `employee_bulk_updates.create`.\n\n**Prerequisites:** employee ids from `employees.list`.\n\n**Side effects:** none. Returns a file (`.xlsx`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل موظفين مختارين في ملف للتعديل الجماعي","x-description-ar":"يعيد ملف Excel فيه صف لكل موظف مختار (بالرقم الوظيفي) مع قيمه الحالية في كل عمود يمكن تعديله جماعياً:\nالبيانات الشخصية والوظيفية وبيانات العقد والبنك، والراتب والبدلات إن كان للمستدعي حق رؤية الرواتب. حتى ٥٠٠\nموظف؛ ويُستبعد دون تنبيه من لا يحق للمستدعي فتح ملفه. هو طلب POST فقط لأن ٥٠٠ رقم لا تتسع في الرابط: لا\nيتغير شيء ولا يُسجَّل شيء، لذلك يستطيع رمز القراءة فقط استدعاءه.\n\n**متى تستخدمه:** كخطوة أولى في التعديل الجماعي. عدّل الخلايا مع إبقاء `employee_no`، ثم ارفع الملف عبر\n`employee_bulk_updates.create`.\n\n**المتطلبات:** أرقام الموظفين من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`.xlsx`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The bulk-edit sheet.","x-description-ar":"ملف التعديل الجماعي.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"Too many employees.","x-description-ar":"عدد الموظفين أكبر من المسموح.","x-codes":[{"code":"validation_failed","meaning":"More than 500 ids were sent.","x-meaning-ar":"أُرسل أكثر من ٥٠٠ رقم.","x-fix":"Split the selection into several files of at most 500.","x-fix-ar":"قسّم الاختيار إلى عدة ملفات لا يزيد كل منها على ٥٠٠."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Select at most 500 employees to export.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","description":"Employee ids, at least one and at most 500.","x-description-ar":"أرقام الموظفين، من واحد إلى ٥٠٠.","items":{"type":"integer"}}}},"example":{"ids":[1203,1204]}}},"required":true,"description":"The employees to export."}}},"/employees/bulk_updates/{id}":{"get":{"summary":"Get a bulk edit's preview or outcome","operationId":"employee_bulk_updates.show","tags":["Employee imports \u0026 bulk updates"],"description":"Returns a bulk edit's status and, row by row, either its preview (before confirmation: what would change\nfrom what to what, what is unchanged, what is invalid and why) or its outcome (after: applied, failed,\nskipped). While awaiting confirmation it says when the preview expires (24 hours after the upload). Salary\nand allowance changes are shown only to a caller who may see salaries.\n\n**When to use:** after `employee_bulk_updates.create`, to show the user the changes before they confirm,\nand after `employee_bulk_updates.confirm`, to report what was applied.\n\n**Prerequisites:** the `bulk_update_id` returned by `employee_bulk_updates.create`. Employee imports have\ntheir own `employee_imports.show`; their ids are not found here.\n\n**Side effects:** none.","x-summary-ar":"عرض معاينة تعديل جماعي أو نتيجته","x-description-ar":"يعرض حالة التعديل الجماعي، ولكل صف إما معاينته (قبل التأكيد: ما الذي سيتغير ومن أي قيمة إلى أي قيمة، وما بقي\nكما هو، وما هو غير صالح ولماذا) أو نتيجته (بعد التأكيد: طُبّق أو فشل أو تُخطّي). أثناء انتظار التأكيد يذكر\nموعد انتهاء صلاحية المعاينة (بعد ٢٤ ساعة من الرفع). لا تظهر تغييرات الراتب والبدلات إلا لمن يحق له رؤية\nالرواتب.\n\n**متى تستخدمه:** بعد `employee_bulk_updates.create` لعرض التغييرات على المستخدم قبل أن يؤكدها، وبعد\n`employee_bulk_updates.confirm` للإبلاغ عما طُبّق.\n\n**المتطلبات:** `bulk_update_id` الذي يعيده `employee_bulk_updates.create`. لاستيراد الموظفين عملية خاصة به\n`employee_imports.show`، ولا توجد أرقامه هنا.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_bulk_update_id"}],"responses":{"200":{"description":"The bulk edit.","x-description-ar":"التعديل الجماعي.","content":{"application/json":{"example":{"id":42,"status":"awaiting_confirmation","progress":{"processed":2,"total":2},"expires_at":"2026-11-28T09:15:00Z","summary":{"changed":1,"unchanged":0,"invalid":1,"status_changes":0},"column_labels":{"job_title":"Job Title","department":"Department"},"results":[{"row":2,"employee_id":1203,"employee_no":"E-0101","name":"Sara Ahmed","status":"changed","changes":{"job_title":{"from":"Accountant","to":"Senior Accountant"}},"errors":[],"warnings":[]},{"row":3,"employee_id":null,"employee_no":"E-0999","name":null,"status":"invalid","changes":{},"errors":["Employee 'E-0999' was not found."],"warnings":[]}],"error":null},"schema":{"$ref":"#/components/schemas/employee_bulk_update_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"delete":{"summary":"Cancel a bulk edit that was not confirmed","operationId":"employee_bulk_updates.cancel","tags":["Employee imports \u0026 bulk updates"],"description":"Cancels a bulk edit whose preview is being built or awaits confirmation, and deletes the uploaded rows and\nthe preview (they hold national ids and bank details). No employee was changed, and none is. A bulk edit\nthat is being applied or has finished cannot be cancelled.\n\n**When to use:** when the preview shows the file is wrong. Fix the file and upload it again with\n`employee_bulk_updates.create`.\n\n**Prerequisites:** the `bulk_update_id` from `employee_bulk_updates.create`; its `status` in\n`employee_bulk_updates.show` must be `pending` or `awaiting_confirmation`.\n\n**Side effects:** the bulk edit becomes `cancelled` and its rows are wiped; uploading the same file again\nrecreates it. Not offered to Claude: it belongs to the file-upload flow, which Claude cannot start.","x-summary-ar":"إلغاء تعديل جماعي لم يُؤكَّد","x-description-ar":"يلغي تعديلاً جماعياً ما زالت معاينته تُبنى أو تنتظر التأكيد، ويحذف صفوف الملف المرفوع والمعاينة (ففيها أرقام\nهويات وبيانات بنكية). لم يتغير أي موظف ولن يتغير. لا يمكن إلغاء تعديل جماعي قيد التطبيق أو منتهٍ.\n\n**متى تستخدمه:** حين تُظهر المعاينة أن الملف خاطئ. صحّح الملف وارفعه من جديد عبر\n`employee_bulk_updates.create`.\n\n**المتطلبات:** `bulk_update_id` من `employee_bulk_updates.create`، ويجب أن تكون `status` في\n`employee_bulk_updates.show` إما `pending` أو `awaiting_confirmation`.\n\n**الآثار الجانبية:** يصبح التعديل الجماعي `cancelled` وتُمسح صفوفه؛ ورفع الملف نفسه مجدداً يعيد إنشاءه. لا\nيُعرض على Claude لأنه جزء من مسار رفع الملفات الذي لا يستطيع Claude بدءه.","x-access":"write","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_bulk_update_id"}],"responses":{"204":{"description":"Cancelled. No body.","x-description-ar":"أُلغي. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bulk edit can no longer be cancelled.","x-description-ar":"لم يعد ممكناً إلغاء التعديل الجماعي.","x-codes":[{"code":"validation_failed","meaning":"The bulk edit is being applied, has finished, failed, or was already cancelled.","x-meaning-ar":"التعديل الجماعي قيد التطبيق، أو انتهى، أو فشل، أو أُلغي من قبل.","x-fix":"Nothing to do: check its `status` with `employee_bulk_updates.show`.","x-fix-ar":"لا حاجة لأي إجراء: راجع حالته `status` عبر `employee_bulk_updates.show`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This bulk edit can no longer be cancelled.","code":"validation_failed"}}}}}}},"/employees/bulk_updates/{id}/confirm":{"post":{"summary":"Apply a previewed bulk edit","operationId":"employee_bulk_updates.confirm","tags":["Employee imports \u0026 bulk updates"],"description":"Applies a bulk edit whose preview is ready: in the background, every row the preview marked `changed` is\nwritten to its employee, column by column as previewed, through the same rules as editing a profile. A row\nwhose employee was edited after the preview was made is not overwritten; it fails and says so. The preview\nmust be confirmed within 24 hours of the upload; an expired one is cancelled and must be uploaded again.\n\n**When to use:** after the user has reviewed the preview from `employee_bulk_updates.show`\n(`awaiting_confirmation`) and agreed to it.\n\n**Prerequisites:** the `bulk_update_id` from `employee_bulk_updates.create`. Follow the outcome with\n`employee_bulk_updates.show` until `status` is `completed`.\n\n**Side effects:** changes many employees at once: personal, job, contract and bank data, employment status\n(an employee set to inactive stops having access), and salary and allowances when both the uploader and\nthe confirmer may manage salaries. Each change is recorded in the audit log under the confirmer, and leave\nbalances are recalculated where the rules require. It cannot be undone in one step, so it is not offered\nto Claude.","x-summary-ar":"تطبيق تعديل جماعي بعد معاينته","x-description-ar":"يطبّق تعديلاً جماعياً معاينته جاهزة: في الخلفية يُكتب كل صف وسمته المعاينة بـ `changed` في سجل موظفه، عموداً\nعموداً كما ظهر في المعاينة، وبالقواعد نفسها المتبعة في تعديل الملف الشخصي. والصف الذي عُدّل موظفه بعد بناء\nالمعاينة لا يُكتب فوقه، بل يفشل مع ذكر السبب. يجب التأكيد خلال ٢٤ ساعة من الرفع؛ والمعاينة المنتهية تُلغى\nويلزم رفع الملف من جديد.\n\n**متى تستخدمه:** بعد أن يراجع المستخدم المعاينة من `employee_bulk_updates.show` (`awaiting_confirmation`)\nويوافق عليها.\n\n**المتطلبات:** `bulk_update_id` من `employee_bulk_updates.create`. تابع النتيجة عبر\n`employee_bulk_updates.show` إلى أن تصبح `status` هي `completed`.\n\n**الآثار الجانبية:** يغيّر عدداً كبيراً من الموظفين دفعة واحدة: البيانات الشخصية والوظيفية وبيانات العقد\nوالبنك، وحالة التوظيف (الموظف الذي يصبح غير نشط يفقد صلاحية الدخول)، والراتب والبدلات إن كان لكلٍّ من الرافع\nوالمؤكِّد حق إدارة الرواتب. يُسجَّل كل تغيير في سجل التدقيق باسم المؤكِّد، وتُعاد حسابات أرصدة الإجازات حيث\nتقتضي القواعد. لا يمكن التراجع عنه بخطوة واحدة، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_bulk_update_id"}],"responses":{"202":{"description":"Confirmed; the changes are being applied. The body is empty.","x-description-ar":"أُكِّد التعديل؛ وتُطبَّق التغييرات الآن. الرد بلا محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bulk edit cannot be confirmed.","x-description-ar":"لا يمكن تأكيد التعديل الجماعي.","x-codes":[{"code":"validation_failed","meaning":"The preview expired (more than 24 hours since the upload; it is now cancelled), is still being built, or the bulk edit was already confirmed or cancelled.","x-meaning-ar":"انتهت صلاحية المعاينة (مضى أكثر من ٢٤ ساعة على الرفع، وقد أُلغيت الآن)، أو ما زالت تُبنى، أو سبق تأكيد التعديل الجماعي أو إلغاؤه.","x-fix":"Check `status` with `employee_bulk_updates.show`; wait for `awaiting_confirmation`, or upload the file again with `employee_bulk_updates.create`.","x-fix-ar":"راجع `status` عبر `employee_bulk_updates.show`؛ انتظر `awaiting_confirmation`، أو ارفع الملف من جديد عبر `employee_bulk_updates.create`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This preview has expired. Upload the file again.","code":"validation_failed"}}}}}}},"/employees/export":{"get":{"summary":"Export the employees list as Excel or CSV","operationId":"employees.export","tags":["Employees"],"description":"Builds a file of the employees list with the chosen columns and the same filters as `employees.list`, in\nthe format named by `format` (`xlsx` for Excel or `csv`; required). Up to 10,000\nemployees the file comes back straight away; above that (up to 20,000) the export is queued and the answer\nis `202` with the export record, and the file is emailed and listed in My exports when ready.\n\n**When to use:** to hand someone a spreadsheet of employees. To read employees as data, use\n`employees.list`.\n\n**Prerequisites:** column keys from `employees.export_columns`; filter ids from `employees.meta_data` and\n`employees.managers`. One export of this list per user may run at a time.\n\n**Side effects:** every attempt past the format and column checks (refused ones included) is recorded in My\nexports and in the audit log (who exported what, with which filters). Not offered to Claude: it returns a\nfile, not JSON.","x-summary-ar":"تصدير قائمة الموظفين بصيغة Excel أو CSV","x-description-ar":"يبني ملفاً لقائمة الموظفين بالأعمدة المختارة وبالمرشحات نفسها التي في `employees.list`. بالصيغة المحددة في\n`format` (`xlsx` لملف Excel أو `csv`؛ وهو مطلوب). حتى ١٠٬٠٠٠ موظف يعود الملف فوراً؛ وفوق ذلك (حتى\n٢٠٬٠٠٠) يُجدول التصدير ويكون الرد `202` مع سجل التصدير، ثم يُرسل الملف بالبريد ويظهر في \"تصديراتي\" عند\nجاهزيته.\n\n**متى تستخدمه:** لتسليم أحدهم جدولاً بالموظفين. لقراءة الموظفين كبيانات استخدم `employees.list`.\n\n**المتطلبات:** مفاتيح الأعمدة من `employees.export_columns`، وأرقام المرشحات من `employees.meta_data`\nو`employees.managers`. لا يجري للمستخدم الواحد إلا تصدير واحد لهذه القائمة في الوقت نفسه.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة تتجاوز فحص الصيغة والأعمدة، حتى المرفوضة، في \"تصديراتي\" وفي سجل\nالتدقيق (من صدّر ماذا وبأي مرشحات). لا يُعرض على Claude لأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"employee/view_employee","label":"View employees directory","x-label-ar":"عرض دليل الموظفين"}]},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `employees.export_columns`, in the order wanted. At least one.","x-description-ar":"مفاتيح الأعمدة من `employees.export_columns` بالترتيب المطلوب. واحد على الأقل.","example":["employee_no","employee_name","department"]},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains (English or Arabic).","x-description-ar":"الاسم يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[employment_status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["active","notice_period","inactive"]},"description":"Only this employment status.","x-description-ar":"حالة توظيف محددة فقط.","example":"active"},{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department (id from `employees.meta_data`).","x-description-ar":"قسم محدد فقط (الرقم من `employees.meta_data`).","example":4},{"name":"q[location_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this main work location (id from `employees.meta_data`).","x-description-ar":"موقع عمل رئيسي محدد فقط (الرقم من `employees.meta_data`).","example":2},{"name":"q[assigned_location_id]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees who may check in at this location, as main or additional location.","x-description-ar":"الموظفون الذين يمكنهم تسجيل الحضور في هذا الموقع فقط، رئيسياً كان أو إضافياً.","example":2},{"name":"q[manager_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only the direct reports of this employee id (from `employees.managers`).","x-description-ar":"المرؤوسون المباشرون لهذا الموظف فقط (الرقم من `employees.managers`).","example":88},{"name":"q[portal_access_eq]","in":"query","required":false,"schema":{"type":"string","enum":["not_invited","pending","activated","cancelled","expired"]},"description":"Only this QHR login status.","x-description-ar":"حالة دخول إلى QHR محددة فقط.","example":"activated"},{"name":"q[employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-01"},{"name":"q[job_title_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Job title contains.","x-description-ar":"المسمى الوظيفي يحتوي على.","example":"Accountant"},{"name":"q[email_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Email contains.","x-description-ar":"البريد يحتوي على.","example":"@example.com"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Row order, `\u003cfield\u003e asc|desc`, e.g. `first_name asc`. Newest first when omitted.","x-description-ar":"ترتيب الصفوف بالشكل `\u003cfield\u003e asc|desc`، مثل `first_name asc`. الأحدث أولاً إن لم يُرسل.","example":"first_name asc"},{"name":"filter_labels[]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Human descriptions of the filters, printed on the file's info sheet (at most 50).","x-description-ar":"وصف المرشحات للقارئ، يُطبع في ورقة المعلومات في الملف (٥٠ بحد أقصى).","example":["Department: Finance"]}],"responses":{"200":{"description":"The file (`.xlsx` or `.csv`, as asked).","x-description-ar":"الملف (`.xlsx` أو `.csv` حسب الطلب).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows to build at once: the export is queued.","x-description-ar":"الصفوف أكثر من أن تُبنى فوراً: جُدول التصدير.","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"type":"object","description":"The export record: `id`, `status` (`queued`), `total_records`, `filename`, `created_at`; `download_url` stays null until the file is ready.","x-description-ar":"سجل التصدير: `id` و`status` (`queued`) و`total_records` و`filename` و`created_at`؛ ويبقى `download_url` فارغاً null إلى أن يجهز الملف."}}},"example":{"export":{"id":77,"page":"employees","format":"xlsx","status":"queued","total_records":12400,"total_rows":null,"processed_rows":0,"filename":"QHR_Employees_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T08:00:00Z","snapshot_at":"2026-11-27T08:00:00Z","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The export request is not valid.","x-description-ar":"طلب التصدير غير صالح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` غير مرسل أو ليس `xlsx` ولا `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No column was sent in `columns[]`.","x-meaning-ar":"لم يُرسل أي عمود في `columns[]`.","x-fix":"Send at least one key from `employees.export_columns`.","x-fix-ar":"أرسل مفتاحاً واحداً على الأقل من `employees.export_columns`."},{"code":"unknown_column","meaning":"A column in `columns[]` is not one `employees.export_columns` offers you.","x-meaning-ar":"أحد أعمدة `columns[]` ليس مما يتيحه لك `employees.export_columns`.","x-fix":"Use only keys returned by `employees.export_columns`.","x-fix-ar":"استخدم فقط المفاتيح التي يعيدها `employees.export_columns`."},{"code":"bad_filters","meaning":"A `q[...]` filter value cannot be used.","x-meaning-ar":"قيمة أحد مرشحات `q[...]` غير صالحة.","x-fix":"Check the filter values (ids are numbers, statuses come from the listed values).","x-fix-ar":"راجع قيم المرشحات (الأرقام أرقام صحيحة، والحالات من القيم المذكورة)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","error_code":"bad_format","code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this list is already running.","x-description-ar":"يجري تصدير لهذه القائمة الآن.","x-codes":[{"code":"export_in_progress","meaning":"This user already has an employees export queued or being built; `export` is that export.","x-meaning-ar":"لدى هذا المستخدم تصدير للموظفين مجدول أو قيد البناء؛ و`export` هو ذلك التصدير.","x-fix":"Wait for that export to finish (My exports), then try again.","x-fix-ar":"انتظر انتهاء ذلك التصدير (تصديراتي)، ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress"}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو هو أكثر من المسموح.","x-codes":[{"code":"no_data","meaning":"The filters match no employee.","x-meaning-ar":"لا يطابق المرشحات أي موظف.","x-fix":"Loosen the filters.","x-fix-ar":"وسّع المرشحات."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` say by how much.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters and export in parts.","x-fix-ar":"ضيّق المرشحات وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/employees/export/columns":{"get":{"summary":"List the columns available for the employees export","operationId":"employees.export_columns","tags":["Employees"],"description":"Returns the columns the employees export can contain for this caller, in file order: each column's `key`,\nits heading in the requested language, its type, and whether the export dialog ticks it by default.\nColumns the caller may not see are left out.\n\n**When to use:** before `employees.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير الموظفين","x-description-ar":"يعرض الأعمدة التي يمكن أن يحتويها تصدير الموظفين لهذا المستدعي بترتيبها في الملف: مفتاح كل عمود `key`،\nوعنوانه بلغة الطلب، ونوعه، وهل تُحدده نافذة التصدير افتراضياً. لا تظهر الأعمدة التي لا يحق للمستدعي رؤيتها.\n\n**متى تستخدمه:** قبل `employees.export` لاختيار قيم `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"employee/view_employee","label":"View employees directory","x-label-ar":"عرض دليل الموظفين"}]},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The available columns.","x-description-ar":"الأعمدة المتاحة.","content":{"application/json":{"example":{"columns":[{"key":"employee_name","label":"Name","default":true,"type":"string"},{"key":"employee_no","label":"Employee ID","default":true,"type":"string"},{"key":"employee_email","label":"Email","default":false,"type":"string"}]},"schema":{"type":"object","required":["columns"],"properties":{"columns":{"type":"array","description":"The columns, in file order.","x-description-ar":"الأعمدة بترتيبها في الملف.","items":{"type":"object","properties":{"key":{"type":"string","description":"Value to send in `columns[]`.","x-description-ar":"القيمة التي تُرسل في `columns[]`."},"label":{"type":"string","description":"Column heading in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in the export dialog.","x-description-ar":"محدد افتراضياً في نافذة التصدير."},"type":{"type":"string","description":"Value type: `string`, `enum`, `date`…","x-description-ar":"نوع القيمة: `string` أو `enum` أو `date`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/import_template":{"get":{"summary":"Download the employee import spreadsheet","operationId":"employees.import_template","tags":["Employees"],"description":"Returns the Excel template for adding many employees at once: one row per employee, with the columns and\nallowed values QHR expects.\n\n**When to use:** to prepare a file for the employee import. Fill it in, then upload it with the import\noperations (People \u0026 organisation).\n\n**Prerequisites:** none. Any member of the company may download it.\n\n**Side effects:** none. Returns a file (`.xlsx`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل ملف استيراد الموظفين","x-description-ar":"يعيد قالب Excel لإضافة عدد كبير من الموظفين دفعة واحدة: صف لكل موظف، بالأعمدة والقيم المسموحة التي\nيتوقعها QHR.\n\n**متى تستخدمه:** لتجهيز ملف استيراد الموظفين. املأه ثم ارفعه عبر عمليات الاستيراد (الموظفون والمنظمة).\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة تنزيله.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`.xlsx`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The template file.","x-description-ar":"ملف القالب.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/imports":{"post":{"summary":"Import new employees from the filled template","operationId":"employee_imports.create","tags":["Employee imports \u0026 bulk updates"],"description":"Uploads the employee import template, filled in, to add up to 500 employees at once (one row each, at\nmost 5 MB). The file's shape is checked straight away: it must be the `.xlsx` template with its required\ncolumns and at least one employee row. The rows are then imported in the background; the answer is `202`\nwith the `import_id` to follow.\n\n**When to use:** to add many employees at once, for example when the company starts on QHR. For one person,\n`employees.create` is simpler.\n\n**Prerequisites:** the template from `employees.import_template`, filled in. Department, location and other\nchoices are written as the template's dropdowns offer them. Follow the import with `employee_imports.show`.\n\n**Side effects:** each valid row creates an employee (with salary and allowances when the caller may manage\nsalaries; otherwise those cells are ignored with a warning) and is recorded in the audit log; a row with a\nproblem is skipped and reported. Nobody is invited to QHR. Managers are linked by employee number once all\nrows are in.\n\n**Not offered to Claude:** it is a file upload that adds many employees at once, and the employees it\ncreates are not undone by cancelling anything.","x-summary-ar":"استيراد موظفين جدد من القالب بعد تعبئته","x-description-ar":"يرفع قالب استيراد الموظفين بعد تعبئته لإضافة حتى ٥٠٠ موظف دفعة واحدة (صف لكل موظف، بحد أقصى ٥ ميغابايت).\nيُفحص شكل الملف فوراً: يجب أن يكون قالب `.xlsx` بأعمدته المطلوبة وفيه صف موظف واحد على الأقل. ثم تُستورد\nالصفوف في الخلفية، ويكون الرد `202` مع `import_id` للمتابعة.\n\n**متى تستخدمه:** لإضافة عدد كبير من الموظفين دفعة واحدة، مثلاً عند بدء الشركة استخدام QHR. لشخص واحد،\n`employees.create` أبسط.\n\n**المتطلبات:** القالب من `employees.import_template` بعد تعبئته. تُكتب الأقسام والمواقع والخيارات الأخرى كما\nتعرضها القوائم المنسدلة في القالب. تابع الاستيراد عبر `employee_imports.show`.\n\n**الآثار الجانبية:** كل صف صحيح يضيف موظفاً (مع الراتب والبدلات إن كان للمستدعي حق إدارة الرواتب، وإلا\nتُتجاهل تلك الخلايا مع تنبيه) ويُسجَّل في سجل التدقيق؛ والصف الذي فيه مشكلة يُتخطى ويُذكر في النتائج. لا\nتُرسل دعوات دخول إلى QHR. يُربط المديرون بالرقم الوظيفي بعد إدخال كل الصفوف.\n\n**لا يُعرض على Claude:** لأنه رفع ملف يضيف عدداً كبيراً من الموظفين دفعة واحدة، ولا يُلغى ما أضافه بإلغاء\nأي شيء.","x-access":"write","x-permission":{"key":"employee/create","label":"Add employees","x-label-ar":"إضافة موظفين"},"x-feature":"employee","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"202":{"description":"The file was accepted; the import runs in the background.","x-description-ar":"قُبل الملف؛ ويجري الاستيراد في الخلفية.","content":{"application/json":{"example":{"import_id":31},"schema":{"type":"object","required":["import_id"],"properties":{"import_id":{"type":"integer","description":"The import's id, for `employee_imports.show`.","x-description-ar":"رقم الاستيراد، لاستخدامه في `employee_imports.show`."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The file was refused.","x-description-ar":"رُفض الملف.","x-codes":[{"code":"validation_failed","meaning":"The file is over 5 MB or 500 rows, is not a readable `.xlsx`, misses required columns, or has no employee rows.","x-meaning-ar":"الملف أكبر من ٥ ميغابايت أو ٥٠٠ صف، أو ليس ملف `.xlsx` مقروءاً، أو تنقصه أعمدة مطلوبة، أو لا يحتوي على صفوف موظفين.","x-fix":"Start again from `employees.import_template`, keep its columns, and split a large file.","x-fix-ar":"ابدأ من جديد بالقالب من `employees.import_template`، وأبقِ أعمدته، وقسّم الملف الكبير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The file is missing required columns: first_name_ar, last_name_ar, gender.","code":"validation_failed"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/employee_sheet_upload"}}},"required":true,"description":"The filled template, as the multipart field `file`."}}},"/employees/imports/{id}":{"get":{"summary":"Get an employee import's progress and results","operationId":"employee_imports.show","tags":["Employee imports \u0026 bulk updates"],"description":"Returns where an employee import is (`pending`, `processing`, `completed` or `failed`), how many rows are\ndone, how many employees were created and how many rows failed, and for each processed row its outcome\nwith the error and warning messages.\n\n**When to use:** after `employee_imports.create`, until `status` is `completed` or `failed`, then to tell\nthe user which rows to fix and upload again.\n\n**Prerequisites:** the `import_id` returned by `employee_imports.create`. Bulk updates have their own\n`employee_bulk_updates.show`; their ids are not found here.\n\n**Side effects:** none.","x-summary-ar":"عرض تقدّم استيراد الموظفين ونتائجه","x-description-ar":"يعرض أين وصل استيراد الموظفين (`pending` أو `processing` أو `completed` أو `failed`)، وعدد الصفوف المنجزة،\nوعدد الموظفين المضافين والصفوف التي فشلت، ولكل صف عولج نتيجته مع رسائل الأخطاء والتنبيهات.\n\n**متى تستخدمه:** بعد `employee_imports.create` إلى أن تصبح `status` إما `completed` أو `failed`، ثم لإخبار\nالمستخدم بالصفوف التي يصححها ويعيد رفعها.\n\n**المتطلبات:** `import_id` الذي يعيده `employee_imports.create`. للتعديل الجماعي عملية خاصة به\n`employee_bulk_updates.show`، ولا توجد أرقامه هنا.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"employee/view_employee","label":"View employees directory","x-label-ar":"عرض دليل الموظفين"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_import_id"}],"responses":{"200":{"description":"The import.","x-description-ar":"عملية الاستيراد.","content":{"application/json":{"example":{"id":31,"status":"completed","progress":{"processed":2,"total":2},"summary":{"created":1,"failed":1},"results":[{"row":2,"employee_no":"E-0101","name":"Sara Ahmed","status":"created","employee_id":1203,"errors":[],"warnings":[]},{"row":3,"employee_no":null,"name":"Omar","status":"failed","errors":["gender: 'M' is not one of the allowed options."],"warnings":[]}],"error":null},"schema":{"$ref":"#/components/schemas/employee_import_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/employees/incomplete_profiles":{"get":{"summary":"List employees whose profile is incomplete","operationId":"employees.incomplete_profiles","tags":["Employees"],"description":"Returns the employees missing data QHR needs — salary, IBAN, attendance profile, joining date, national ID,\nnationality, contract type, department, employment type, job title, email, work phone or gender — and for\neach one what is missing and why it matters. `counts` says how many employees miss anything (`total`) and\neach field (`by_field`).\n\n**When to use:** to build a to-do list for HR before running payroll or GOSI, or to answer \"whose data is\nincomplete?\". Narrow to one gap with `field`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 200 per page.","x-summary-ar":"عرض الموظفين الذين لم تكتمل ملفاتهم","x-description-ar":"يعرض الموظفين الذين تنقصهم بيانات يحتاجها QHR — الراتب أو الآيبان أو ملف الحضور أو تاريخ الالتحاق أو\nالهوية أو الجنسية أو نوع العقد أو القسم أو نوع التوظيف أو المسمى أو البريد أو هاتف العمل أو الجنس — ولكل\nموظف ما ينقصه ولماذا يهم. ويعطي `counts` عدد من ينقصهم أي شيء (`total`) وعدد من ينقصهم كل حقل (`by_field`).\n\n**متى تستخدمه:** لإعداد قائمة مهام للموارد البشرية قبل تشغيل الرواتب أو التأمينات، أو للإجابة عن \"من\nبياناته ناقصة؟\". اقصر النتائج على نقص واحد بـ `field`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٢٠٠ في الصفحة.","x-access":"read","x-permission":{"key":"employee/view_employee","label":"View employees directory","x-label-ar":"عرض دليل الموظفين"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"field","in":"query","required":false,"schema":{"type":"string","enum":["salary","bank_details","attendance_profile","join_date","national_id","nationality","contract_type","department","employment_type","job_title","email","work_phone_number","gender","date_of_birth","marital_status","residence_country"]},"description":"Only employees missing this field.","x-description-ar":"الموظفون الذين ينقصهم هذا الحقل فقط.","example":"bank_details"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Employees with missing data.","x-description-ar":"الموظفون الذين تنقصهم بيانات.","content":{"application/json":{"example":{"counts":{"total":1,"by_field":{"salary":0,"bank_details":1}},"records":[{"id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","department":"Finance","missing":[{"field":"bank_details","label":"Bank details (IBAN)","message":"Needed to pay this employee's salary by bank transfer."}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination","counts"],"properties":{"counts":{"type":"object","description":"`total`: employees missing anything; `by_field`: employees missing each field.","x-description-ar":"`total`: عدد من ينقصهم أي شيء؛ `by_field`: عدد من ينقصهم كل حقل.","properties":{"total":{"type":"integer","description":"Employees missing at least one field.","x-description-ar":"عدد الموظفين الذين ينقصهم حقل واحد على الأقل."},"by_field":{"type":"object","description":"Employees missing each field, by field key.","x-description-ar":"عدد الموظفين الذين ينقصهم كل حقل، حسب مفتاح الحقل.","additionalProperties":{"type":"integer"}}}},"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"missing":{"type":"array","description":"What is missing: `field`, `label` and the `message` explaining why it matters.","x-description-ar":"ما ينقص: `field` و`label` و`message` يشرح سبب أهميته.","items":{"type":"object"}}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"$ref":"#/components/responses/validation_failed"}}}},"/employees/invitations":{"get":{"summary":"List employees with their QHR login status","operationId":"employee_invitations.list","tags":["Employee invitations"],"description":"Returns every employee of the company (leavers included), newest first, with their email, the day they were\nlast invited and their QHR login status: `not_invited`, `pending` (invited, not accepted yet), `activated`,\n`cancelled` or `expired`.\n\n**When to use:** to answer \"who has not been invited yet?\" or \"whose invitation is still pending?\", or to\nfind the `id` for `employee_invitations.invite` and `employee_invitations.cancel`. Filter with\n`q[portal_access_eq]`.\n\n**Prerequisites:** none. Department ids for the filter come from `employees.meta_data`.\n\n**Side effects:** none. Up to 200 per page.","x-summary-ar":"عرض الموظفين مع حالة دخولهم إلى QHR","x-description-ar":"يعرض جميع موظفي الشركة (بمن فيهم من غادروا)، الأحدث إضافةً أولاً، مع البريد ويوم آخر دعوة وحالة الدخول إلى\nQHR: `not_invited` لم يُدعَ، `pending` دُعي ولم يقبل بعد، `activated` مفعّل، `cancelled` ملغى، `expired`\nانتهت الدعوة.\n\n**متى تستخدمه:** للإجابة عن \"من لم يُدعَ بعد؟\" أو \"من ما زالت دعوته معلّقة؟\"، أو لمعرفة رقم `id` المطلوب في\n`employee_invitations.invite` و`employee_invitations.cancel`. صفِّ بـ `q[portal_access_eq]`.\n\n**المتطلبات:** لا شيء. أرقام الأقسام للتصفية من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٢٠٠ في الصفحة.","x-access":"read","x-permission":{"key":"employee_invitation/view","label":"View invitation status","x-label-ar":"عرض حالة الدعوة"},"x-feature":"employee_invitation","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[portal_access_eq]","in":"query","required":false,"schema":{"type":"string","enum":["not_invited","pending","activated","cancelled","expired"]},"description":"Only this login status.","x-description-ar":"حالة دخول محددة فقط.","example":"pending"},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains (English or Arabic).","x-description-ar":"الاسم يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[email_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Email contains.","x-description-ar":"البريد يحتوي على.","example":"@example.com"},{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department (id from `employees.meta_data`).","x-description-ar":"قسم محدد فقط (الرقم من `employees.meta_data`).","example":4},{"name":"q[employment_status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["active","notice_period","inactive"]},"description":"Only this employment status.","x-description-ar":"حالة توظيف محددة فقط.","example":"active"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`, e.g. `first_name asc`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`، مثل `first_name asc`. الأحدث أولاً إن لم يُرسل.","example":"first_name asc"}],"responses":{"200":{"description":"A page of employees with their login status.","x-description-ar":"صفحة من الموظفين مع حالة دخولهم.","content":{"application/json":{"example":{"records":[{"id":1203,"invited_on":"02/11/2026","employee_name":"Sara Ahmed","employee_email":"sara@example.com","employee_image":null,"portal_access":"Pending","portal_access_key":"pending"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/employee_invitation_row"},"description":"The employees on this page.","x-description-ar":"الموظفون في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/leave_policies":{"get":{"summary":"List my leave balances","operationId":"employee_leave_policies.my_list","tags":["Employee leave policies"],"description":"Returns the leave policies the token's owner holds — only switched-on ones — each with this year's balance:\ndays granted (`accrued_days`), carried over from last year, taken, waiting for approval, and still\navailable (`available_balance` = `entitled_days` − `taken_days` − `pending_days`).\n\n**When to use:** to answer \"how much leave do I have left?\", or to find the `leave_policy_id` for a leave\nrequest. For the day-by-day history of one balance use `employee_leave_policies.my_statement`.\n\n**Prerequisites:** the token must belong to an employee (`me.show` → `employee_id`); a user with no\nemployee record gets 422 `employee_required`.\n\n**Side effects:** none.","x-summary-ar":"عرض أرصدة إجازاتي","x-description-ar":"يعرض سياسات الإجازة التي يحملها صاحب الرمز — المفعّلة فقط — ومع كل منها رصيد هذه السنة: الأيام الممنوحة\n(`accrued_days`)، والمرحَّلة من السنة الماضية، والمأخوذة، والتي تنتظر الاعتماد، والمتاحة\n(`available_balance` = `entitled_days` − `taken_days` − `pending_days`).\n\n**متى تستخدمه:** للإجابة عن «كم بقي لي من الإجازات؟»، أو لمعرفة `leave_policy_id` لطلب إجازة. للسجل التفصيلي\nلحركات رصيد واحد استخدم `employee_leave_policies.my_statement`.\n\n**المتطلبات:** يجب أن يخص الرمز موظفاً (`me.show` ← `employee_id`)؛ والمستخدم بلا سجل وظيفي يحصل على 422\nبالرمز `employee_required`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"My leave policies and balances.","x-description-ar":"سياسات إجازتي وأرصدتها.","content":{"application/json":{"example":{"records":[{"id":12,"name":"Annual Leave — Staff","duration":21.0,"available_balance":18.0,"requires_document":false,"allow_past_dates":false,"show_used_balance":true,"total_balance":21.0,"days_used":7.0,"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":2.0,"accrued_per":"per_year","allow_negative_balance":false}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/employee_leave_policy_balance_card"},"description":"One card per policy.","x-description-ar":"بطاقة لكل سياسة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so has no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Use a token created by an employee, or link the user to an employee in QHR.","x-fix-ar":"استخدم رمزاً أنشأه موظف، أو اربط المستخدم بسجل موظف في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/employees/leave_policies/{leave_policy_id}/statement":{"get":{"summary":"Get my balance statement for one leave policy","operationId":"employee_leave_policies.my_statement","tags":["Employee leave policies"],"description":"Returns every movement of the token owner's balance on one policy in one year, oldest first: the\nassignment, accruals, carry-over in and its expiry, manual adjustments by HR, and each leave request as a\ndeduction, with a running total. Rejected and cancelled requests are listed but not counted. The last\nrunning total equals `summary.available_days`, the same figure as `employee_leave_policies.my_list`.\n\n**When to use:** to explain how a balance was reached (\"why do I have 6 days?\"). For the current balances\nalone, `employee_leave_policies.my_list` is lighter. Policies removed from the employee still have a\nstatement (`unassigned_on`).\n\n**Prerequisites:** `leave_policy_id` from `employee_leave_policies.my_list`; the token must belong to an\nemployee.\n\n**Side effects:** none.","x-summary-ar":"عرض كشف رصيدي لسياسة إجازة واحدة","x-description-ar":"يعرض كل حركة على رصيد صاحب الرمز في سياسة واحدة خلال سنة واحدة، الأقدم أولاً: التعيين والاستحقاقات والترحيل\nوانتهاؤه والتعديلات اليدوية من الموارد البشرية وكل طلب إجازة كخصم، مع الرصيد الجاري. تظهر الطلبات المرفوضة\nوالملغاة دون أن تُحسب. آخر رصيد جارٍ يساوي `summary.available_days`، وهو الرقم نفسه في\n`employee_leave_policies.my_list`.\n\n**متى تستخدمه:** لشرح كيف تكوّن الرصيد («لماذا لدي ٦ أيام؟»). للأرصدة الحالية وحدها\n`employee_leave_policies.my_list` أخف. السياسات التي أُزيلت من الموظف يبقى لها كشف (`unassigned_on`).\n\n**المتطلبات:** `leave_policy_id` من `employee_leave_policies.my_list`؛ ويجب أن يخص الرمز موظفاً.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_leave_policy_my_policy_id"},{"name":"fiscal_year","in":"query","required":false,"schema":{"type":"integer"},"description":"Calendar year; the current year when omitted.","x-description-ar":"السنة الميلادية؛ السنة الحالية إن لم تُرسل.","example":2026}],"responses":{"200":{"description":"The statement.","x-description-ar":"الكشف.","content":{"application/json":{"example":{"fiscal_year":2026,"policy":{"id":12,"name":"Annual Leave — Staff"},"unassigned_on":null,"summary":{"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":0.0,"available_days":20.0},"entries":[{"event_type":"carryover","effective_date":"2026-01-01","amount":4.0,"counted":true,"description":"Carried over from 2025","actor":null,"leave_request_id":null,"status":null,"running_total":4.0},{"event_type":"accrual","effective_date":"2026-01-01","amount":21.0,"counted":true,"description":"Annual accrual for 2026","actor":null,"leave_request_id":null,"status":null,"running_total":25.0},{"event_type":"deduction","effective_date":"2026-03-02","amount":-5.0,"counted":true,"description":"Leave 02/03/2026 – 06/03/2026","actor":null,"leave_request_id":4410,"status":"approved","running_total":20.0}]},"schema":{"$ref":"#/components/schemas/employee_leave_policy_statement"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"No statement for this policy.","x-description-ar":"لا يوجد كشف لهذه السياسة.","x-codes":[{"code":"validation_failed","meaning":"The policy was never assigned to the token's owner.","x-meaning-ar":"لم تُعيَّن هذه السياسة لصاحب الرمز قط.","x-fix":"Pick a policy from `employee_leave_policies.my_list`.","x-fix-ar":"اختر سياسة من `employee_leave_policies.my_list`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so has no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Use a token created by an employee, or link the user to an employee in QHR.","x-fix-ar":"استخدم رمزاً أنشأه موظف، أو اربط المستخدم بسجل موظف في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This leave policy has never been assigned to this employee","code":"validation_failed"}}}}}}},"/employees/managers":{"get":{"summary":"List who an employee can report to","operationId":"employees.managers","tags":["Employees"],"description":"Returns the employees who can be set as a manager, alphabetically, with employee number, job title,\ndepartment and status to tell people with the same name apart. With `employee_id`, that employee and\neveryone below them are left out, since they cannot be their own manager.\n\n**When to use:** before setting `manager_id` in `employees.create` or `employees.update`.\n\n**Prerequisites:** none; `employee_id` (optional) from `employees.list`.\n\n**Side effects:** none. Up to 100 per page.","x-summary-ar":"عرض من يمكن أن يتبع له الموظف","x-description-ar":"يعرض الموظفين الذين يمكن تعيينهم مديراً، مرتبين أبجدياً، مع الرقم الوظيفي والمسمى والقسم والحالة للتمييز\nبين المتشابهين في الاسم. عند إرسال `employee_id` يُستبعد ذلك الموظف ومن تحته، لأنه لا يمكن أن يكون مدير نفسه.\n\n**متى تستخدمه:** قبل تعيين `manager_id` في `employees.create` أو `employees.update`.\n\n**المتطلبات:** لا شيء؛ و`employee_id` (اختياري) من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ١٠٠ في الصفحة.","x-access":"read","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"employee_id","in":"query","required":false,"schema":{"type":"integer"},"description":"The employee you are choosing a manager for.","x-description-ar":"الموظف الذي تختار له مديراً.","example":1203},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100},"description":"Name contains.","x-description-ar":"الاسم يحتوي على.","example":"Omar"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Possible managers.","x-description-ar":"المديرون الممكنون.","content":{"application/json":{"example":{"records":[{"id":88,"full_name":"Omar Ali","employee_no":"E-0007","job_title":"Finance Manager","department_name":"Finance","employment_status":"active"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي.","nullable":true},"department_name":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"employment_status":{"type":"string","description":"Employment status key.","x-description-ar":"مفتاح حالة التوظيف.","nullable":true}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/meta_data":{"get":{"summary":"Get the choices for employee fields","operationId":"employees.meta_data","tags":["Employees"],"description":"Returns every list of choices the employee fields accept, each item as `{ value, label }` with labels in the\nrequested language: genders, marital and employment statuses, employment and contract types, education\nlevels, pay frequencies, salary kinds, countries and nationalities, currencies, banks, and the company's own\ndepartments, active locations and attendance profiles (as ids).\n\n**When to use:** before `employees.create` or `employees.update`, to send valid values and ids, or to show\npeople readable labels instead of keys.\n\n**Prerequisites:** none. Any member of the company may call it.\n\n**Side effects:** none.","x-summary-ar":"عرض الخيارات المتاحة لحقول الموظف","x-description-ar":"يعرض كل قوائم الخيارات التي تقبلها حقول الموظف، كل عنصر بالشكل `{ value, label }` والتسميات بلغة الطلب:\nالجنس والحالة الاجتماعية وحالة التوظيف وأنواع التوظيف والعقود والمستويات التعليمية ودورية الراتب ونوعه\nوالدول والجنسيات والعملات والبنوك، إضافةً إلى أقسام الشركة ومواقعها النشطة وملفات الحضور (بأرقامها).\n\n**متى تستخدمه:** قبل `employees.create` أو `employees.update` لإرسال قيم وأرقام صحيحة، أو لعرض تسميات مفهومة\nبدل المفاتيح.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءها.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The choice lists.","x-description-ar":"قوائم الخيارات.","content":{"application/json":{"example":{"data":{"genders":[{"value":"male","label":"Male"},{"value":"female","label":"Female"}],"employment_statuses":[{"value":"active","label":"Active"},{"value":"notice_period","label":"Notice period"},{"value":"inactive","label":"Inactive"}],"contract_types":[{"value":"definite","label":"Fixed term"},{"value":"indefinite","label":"Indefinite"}],"departments":[{"value":4,"label":"Finance"}],"employment_types":[{"value":1,"label":"Full time"}],"attendance_settings":[{"value":1,"label":"Standard"}],"banks":[{"value":"RJHI","label":"Al Rajhi Bank"}]}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"One list per field; each item is `{ value, label }` (departments, locations and attendance settings use the record id as `value`).","x-description-ar":"قائمة لكل حقل؛ كل عنصر `{ value, label }` (الأقسام والمواقع وملفات الحضور قيمتها رقم السجل).","additionalProperties":{"type":"array","items":{"type":"object"}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/search":{"get":{"summary":"Find employees by name","operationId":"employees.search","tags":["Employees"],"description":"Finds employees whose first or last name (English or Arabic) contains `q`, alphabetically, and returns\njust their `id`, name and email.\n\n**When to use:** to turn a name a person mentions (\"Sara\", \"سارة\") into an employee `id` for another\noperation. Use `employed=true` to leave out people who have left, e.g. when choosing someone to assign work to.\n\n**Prerequisites:** none. Without \"View employees directory\" you only find yourself and your own reports.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"البحث عن موظفين بالاسم","x-description-ar":"يبحث عن الموظفين الذين يحتوي اسمهم الأول أو اسم العائلة (بالعربية أو الإنجليزية) على `q`، مرتبين أبجدياً،\nويعيد رقم `id` والاسم والبريد فقط.\n\n**متى تستخدمه:** لتحويل اسم يذكره شخص (\"Sara\"، \"سارة\") إلى رقم `id` موظف لاستخدامه في عملية أخرى. أرسل\n`employed=true` لاستبعاد من غادروا، مثلاً عند اختيار شخص لإسناد عمل إليه.\n\n**المتطلبات:** لا شيء. بدون «عرض دليل الموظفين» لن تجد إلا نفسك ومرؤوسيك.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"employee/view","label":"View own profile","x-label-ar":"عرض ملفي الشخصي"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":100},"description":"Part of a first or last name, English or Arabic.","x-description-ar":"جزء من الاسم الأول أو اسم العائلة، بالعربية أو الإنجليزية.","example":"Sara"},{"name":"employed","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` leaves out employees who have left.","x-description-ar":"`true` يستبعد الموظفين الذين غادروا.","example":true},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Matching employees.","x-description-ar":"الموظفون المطابقون.","content":{"application/json":{"example":{"records":[{"id":1203,"full_name":"Sara Ahmed","email":"sara@example.com"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/employee_option_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/team":{"get":{"summary":"List my direct reports","operationId":"employees.team","tags":["Employees"],"description":"Returns the employees who report directly to the token's owner, alphabetically, with the same fields as\n`employees.list`.\n\n**When to use:** for a manager's questions about their own team (\"who is in my team?\"). The list is empty\nwhen the owner has no employee record or no reports.\n\n**Prerequisites:** none — the manager is the token's owner.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مرؤوسيّ المباشرين","x-description-ar":"يعرض الموظفين الذين يتبعون مباشرةً لصاحب الرمز، مرتبين أبجدياً، بالحقول نفسها التي يعيدها `employees.list`.\n\n**متى تستخدمه:** لأسئلة المدير عن فريقه (\"من في فريقي؟\"). تكون القائمة فارغة إن لم يكن لصاحب الرمز سجل\nوظيفي أو لم يكن له مرؤوسون.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"employee/view_team","label":"View team list","x-label-ar":"عرض قائمة الفريق"},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains.","x-description-ar":"الاسم يحتوي على.","example":"Sara"},{"name":"employed","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` leaves out employees who have left.","x-description-ar":"`true` يستبعد الموظفين الذين غادروا.","example":true},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The owner's direct reports.","x-description-ar":"المرؤوسون المباشرون لصاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","employee_email":"sara@example.com","job_title":"Accountant","department":"Finance","employment_type":"Full time","manager_id":88,"status":"Active","status_key":"active","portal_access":"Activated","portal_access_key":"activated","start_date":"2024-03-01","residence_country":"Saudi Arabia","location_id":2,"location":"Riyadh HQ","additional_locations":[],"employee_image":null}],"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/employee_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/validate_email":{"get":{"summary":"Check whether an email can be used for a new employee","operationId":"employees.validate_email","tags":["Employees"],"description":"Tells you whether an email is well-formed and free in this company. When it is taken, `employee_id` and\n`tenant_user_id` name who has it. `links_to_user` is true when the email belongs to a system user who has no\nemployee record yet: creating the employee with it links that user instead of failing.\n\n**When to use:** before `employees.create`, to avoid a refusal, or to find out who already uses an email.\n\n**Prerequisites:** none. Any member of the company may call it.\n\n**Side effects:** none. Not offered to Claude: it tells who in the company owns an email address.","x-summary-ar":"التحقق من إمكانية استخدام بريد لموظف جديد","x-description-ar":"يخبرك إن كان البريد صحيح الصيغة وغير مستخدم في هذه الشركة. إن كان مستخدماً يذكر `employee_id`\nو`tenant_user_id` صاحبه. ويكون `links_to_user` صحيحاً عندما يخص البريد مستخدماً للنظام بلا سجل وظيفي بعد:\nعندها يربط إنشاء الموظف بهذا البريد ذلك المستخدم بدل أن يُرفض.\n\n**متى تستخدمه:** قبل `employees.create` لتجنب الرفض، أو لمعرفة من يستخدم بريداً ما.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءها.\n\n**الآثار الجانبية:** لا شيء. لا يُعرض على Claude لأنه يكشف من يملك عنوان بريد في الشركة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"email","in":"query","required":true,"schema":{"type":"string","format":"email"},"description":"The email to check.","x-description-ar":"البريد المراد التحقق منه.","example":"new.hire@example.com"}],"responses":{"200":{"description":"Whether the email is usable.","x-description-ar":"هل يمكن استخدام البريد.","content":{"application/json":{"example":{"data":{"valid_format":true,"duplicate":false,"available":true,"links_to_user":false,"employee_id":null,"tenant_user_id":null}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","properties":{"valid_format":{"type":"boolean","description":"The email is well-formed.","x-description-ar":"صيغة البريد صحيحة."},"duplicate":{"type":"boolean","description":"Someone in the company already has it.","x-description-ar":"يستخدمه شخص في الشركة بالفعل."},"available":{"type":"boolean","description":"Well-formed and free: `employees.create` will accept it.","x-description-ar":"صحيح الصيغة وغير مستخدم: سيقبله `employees.create`."},"links_to_user":{"type":"boolean","description":"It belongs to a user with no employee record; creating the employee links them.","x-description-ar":"يخص مستخدماً بلا سجل وظيفي؛ إنشاء الموظف يربطه به."},"employee_id":{"type":"integer","description":"The employee who has it.","x-description-ar":"الموظف الذي يستخدمه.","nullable":true},"tenant_user_id":{"type":"integer","description":"The user who has it.","x-description-ar":"المستخدم الذي يستخدمه.","nullable":true}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/employees/{employee_id}/folders":{"get":{"summary":"List an employee's document folders and their documents","operationId":"folders.list","tags":["Documents"],"description":"Returns the folders on one employee's profile (e.g. \"Application\", \"Identity papers\", \"Contracts\"), each\nwith every document in it — including documents with no expiry date and older versions\n(`current_version: false`). Every employee has an \"Application\" folder from the day they are added.\nHidden folders are left out unless `include_hidden=true`.\n\n**When to use:** to answer \"what documents do we hold for Layla?\", or to find a folder's `id` before\n`documents.create`. For expiry questions across all employees, `documents.list` is better.\n\n**Prerequisites:** the employee's `id`, from `employees.list` or `employees.search`. You can only open the\nfolders of employees you can see (admins: everyone; others: themselves and their direct reports).\n\n**Side effects:** none. Not paginated: an employee has a handful of folders.","x-summary-ar":"عرض مجلدات مستندات موظف ومستنداتها","x-description-ar":"يعرض المجلدات في ملف موظف واحد (مثل «الطلب» و«وثائق الهوية» و«العقود»)، ومع كل مجلد جميع المستندات التي\nفيه — بما فيها المستندات التي بلا تاريخ انتهاء والإصدارات الأقدم (`current_version: false`). لكل موظف مجلد\n«الطلب» منذ إضافته. لا تظهر المجلدات المخفية إلا مع `include_hidden=true`.\n\n**متى تستخدمه:** للإجابة عن \"ما المستندات المحفوظة لليلى؟\"، أو لمعرفة رقم `id` المجلد قبل\n`documents.create`. لأسئلة الانتهاء على مستوى كل الموظفين، `documents.list` أنسب.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `employees.search`. لا تفتح إلا مجلدات الموظفين الذين\nتستطيع رؤيتهم (مسؤول النظام: الجميع؛ وغيره: نفسه ومرؤوسوه المباشرون).\n\n**الآثار الجانبية:** لا شيء. بلا صفحات: للموظف عدد قليل من المجلدات.","x-access":"read","x-permission":{"key":"document/view","label":"View own documents","x-label-ar":"عرض وثائقي الخاصة","x-others":{"key":"document/view_others","label":"View others' documents","x-label-ar":"عرض وثائق الآخرين"}},"x-feature":"document","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/folder_employee_id"},{"$ref":"#/components/parameters/folder_include_hidden"},{"name":"q[name_en_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"English name contains.","x-description-ar":"الاسم بالإنجليزية يحتوي على.","example":"Identity"},{"name":"q[name_ar_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Arabic name contains.","x-description-ar":"الاسم بالعربية يحتوي على.","example":"الهوية"}],"responses":{"200":{"description":"The employee's folders.","x-description-ar":"مجلدات الموظف.","content":{"application/json":{"example":[{"id":30,"name_en":"Application","name_ar":"الطلب","hidden":false,"created_at":"2026-09-01 05:00:00 UTC","attachments":[]},{"id":31,"name_en":"Identity papers","name_ar":"وثائق الهوية","hidden":false,"created_at":"2026-09-01 05:05:00 UTC","attachments":[{"id":512,"title":"Iqama","expiry_date":"2027-03-01","expiry_state":"expiring_soon","verified":true,"reminders_enabled":true,"version_number":1,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"}]}],"schema":{"type":"array","items":{"$ref":"#/components/schemas/folder"}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Add a folder to an employee's documents","operationId":"folders.create","tags":["Documents"],"description":"Adds a folder to one employee's profile, with an English and an Arabic name, each unique among that\nemployee's folders.\n\n**When to use:** to organise an employee's files (e.g. \"Contracts\", \"Certificates\") before uploading\ndocuments into it with `documents.create`.\n\n**Prerequisites:** the employee's `id`, from `employees.list`. Check `folders.list` first to avoid a name\nthe employee already has.\n\n**Side effects:** the folder appears on the employee's profile. Recorded in the audit log. Not offered to\nClaude: folders only matter together with file uploads, which Claude does not do.","x-summary-ar":"إضافة مجلد إلى مستندات موظف","x-description-ar":"يضيف مجلداً إلى ملف موظف واحد، باسم بالإنجليزية وآخر بالعربية، كل منهما فريد بين مجلدات ذلك الموظف.\n\n**متى تستخدمه:** لتنظيم ملفات الموظف (مثل «العقود» و«الشهادات») قبل رفع المستندات إليه عبر\n`documents.create`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`. راجع `folders.list` أولاً لتجنب اسم موجود لدى الموظف.\n\n**الآثار الجانبية:** يظهر المجلد في ملف الموظف. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأن المجلدات\nلا تفيد إلا مع رفع الملفات، وهو ما لا يقوم به Claude.","x-access":"write","x-permission":{"key":"document/create","label":"Upload files \u0026 create folders","x-label-ar":"رفع ملفات وإنشاء مجلدات"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/folder_employee_id"}],"responses":{"201":{"description":"The new folder.","x-description-ar":"المجلد الجديد.","content":{"application/json":{"example":{"id":32,"name_en":"Contracts","name_ar":"العقود","hidden":false,"created_at":"2027-02-27 07:00:00 UTC","attachments":[]},"schema":{"$ref":"#/components/schemas/folder"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The folder cannot be added.","x-description-ar":"لا يمكن إضافة المجلد.","x-codes":[{"code":"validation_failed","meaning":"A name is missing, or another folder of this employee already has it.","x-meaning-ar":"أحد الاسمين ناقص، أو يحمله مجلد آخر لهذا الموظف.","x-fix":"Send names different from the employee's other folders (see `folders.list`).","x-fix-ar":"أرسل اسمين مختلفين عن أسماء مجلدات الموظف الأخرى (انظر `folders.list`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","errors":["Name en has already been taken"],"code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/folder_create_input"},"example":{"folder":{"name_en":"Contracts","name_ar":"العقود"}}}},"required":true,"description":"The new folder."}}},"/employees/{employee_id}/folders/{id}":{"patch":{"summary":"Rename or hide an employee's folder","operationId":"folders.update","tags":["Documents"],"description":"Changes a folder's English or Arabic name, or hides it (`hidden: true`) / shows it again. Fields you leave\nout stay as they are; the documents inside are not touched.\n\n**When to use:** to correct a folder's name, or to tuck away a folder that is no longer used without\ndeleting its documents.\n\n**Prerequisites:** the employee's `id` (`employees.list`) and the folder's `id` (`folders.list` — with\n`include_hidden=true` for a hidden one). To change a hidden folder (e.g. to show it again with\n`hidden: false`), send `include_hidden=true` here too; without it a hidden folder answers 404.\n\n**Side effects:** a hidden folder drops out of `folders.list` unless `include_hidden=true`. Recorded in the\naudit log. Not offered to Claude: folders only matter together with file uploads.","x-summary-ar":"تعديل اسم مجلد موظف أو إخفاؤه","x-description-ar":"يغيّر اسم المجلد بالإنجليزية أو بالعربية، أو يخفيه (`hidden: true`) أو يعيد إظهاره. الحقول التي لا ترسلها\nتبقى كما هي، ولا تتأثر المستندات التي فيه.\n\n**متى تستخدمه:** لتصحيح اسم مجلد، أو لإخفاء مجلد لم يعد مستخدماً دون حذف مستنداته.\n\n**المتطلبات:** رقم `id` الموظف (`employees.list`) ورقم `id` المجلد (`folders.list` — مع\n`include_hidden=true` للمجلد المخفي). لتعديل مجلد مخفي (مثل إعادة إظهاره بـ `hidden: false`) أرسل\n`include_hidden=true` هنا أيضاً؛ ومن دونه يعود المجلد المخفي بالرمز 404.\n\n**الآثار الجانبية:** يختفي المجلد المخفي من `folders.list` إلا مع `include_hidden=true`. يُسجَّل في سجل\nالتدقيق. لا يُعرض على Claude لأن المجلدات لا تفيد إلا مع رفع الملفات.","x-access":"write","x-permission":{"key":"document/edit","label":"Rename \u0026 reorganise","x-label-ar":"إعادة التسمية وإعادة التنظيم"},"x-feature":"document","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/folder_employee_id"},{"$ref":"#/components/parameters/folder_id"},{"$ref":"#/components/parameters/folder_include_hidden"}],"responses":{"200":{"description":"The folder after the change.","x-description-ar":"المجلد بعد التعديل.","content":{"application/json":{"example":{"id":31,"name_en":"ID \u0026 residency","name_ar":"الهوية والإقامة","hidden":false,"created_at":"2026-09-01 05:05:00 UTC","attachments":[{"id":512,"title":"Iqama","expiry_date":"2027-03-01","expiry_state":"expiring_soon","verified":true,"reminders_enabled":true,"version_number":1,"current_version":true,"attachable_type":"Folder","attachable_id":31,"employee":{"id":88,"name":"Layla Hassan"},"file_name":"iqama.pdf","file_size":248133,"content_type":"application/pdf","file_url":"https://files.qhr.example/documents/iqama.pdf?expires=1767225600\u0026signature=abc123","created_at":"2027-02-10 06:15:00 UTC","updated_at":"2027-02-10 06:15:00 UTC"}]},"schema":{"$ref":"#/components/schemas/folder"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The folder cannot be renamed.","x-description-ar":"لا يمكن تعديل اسم المجلد.","x-codes":[{"code":"validation_failed","meaning":"A name is missing, or another folder of this employee already has it.","x-meaning-ar":"أحد الاسمين ناقص، أو يحمله مجلد آخر لهذا الموظف.","x-fix":"Send names different from the employee's other folders (see `folders.list`).","x-fix-ar":"أرسل اسمين مختلفين عن أسماء مجلدات الموظف الأخرى (انظر `folders.list`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name ar has already been taken","errors":["Name ar has already been taken"],"code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/folder_input"},"example":{"folder":{"name_en":"ID \u0026 residency","name_ar":"الهوية والإقامة"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete an empty folder","operationId":"folders.delete","tags":["Documents"],"description":"Deletes one of an employee's folders for good. Only an empty folder can be deleted, and never the\n\"Application\" folder every employee has.\n\n**When to use:** to remove a folder created by mistake. To keep a folder's documents but stop showing it,\nhide it with `folders.update` (`hidden: true`).\n\n**Prerequisites:** the employee's `id` (`employees.list`) and the folder's `id` (`folders.list`). Move or\ndelete its documents first (`documents.update`, `documents.delete`). For a hidden folder send\n`include_hidden=true`; without it a hidden folder answers 404.\n\n**Side effects:** the folder disappears from the employee's profile. Recorded in the audit log. It cannot\nbe undone, so it is not offered to Claude.","x-summary-ar":"حذف مجلد فارغ","x-description-ar":"يحذف أحد مجلدات الموظف نهائياً. لا يُحذف إلا المجلد الفارغ، ولا يُحذف أبداً مجلد «الطلب» الموجود لكل موظف.\n\n**متى تستخدمه:** لإزالة مجلد أُنشئ بالخطأ. للإبقاء على مستندات المجلد مع إخفائه، أخفِه عبر\n`folders.update` (`hidden: true`).\n\n**المتطلبات:** رقم `id` الموظف (`employees.list`) ورقم `id` المجلد (`folders.list`). انقل مستنداته أو\nاحذفها أولاً (`documents.update` و`documents.delete`). للمجلد المخفي أرسل `include_hidden=true`؛ ومن\nدونه يعود بالرمز 404.\n\n**الآثار الجانبية:** يختفي المجلد من ملف الموظف. يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه، لذلك لا\nيُعرض على Claude.","x-access":"write","x-permission":{"key":"document/delete","label":"Delete files \u0026 folders","x-label-ar":"حذف الملفات والمجلدات"},"x-feature":"document","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/folder_employee_id"},{"$ref":"#/components/parameters/folder_id"},{"$ref":"#/components/parameters/folder_include_hidden"}],"responses":{"204":{"description":"Deleted. No body.","x-description-ar":"حُذف. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The folder cannot be deleted.","x-description-ar":"لا يمكن حذف المجلد.","x-codes":[{"code":"validation_failed","meaning":"The folder still holds documents, or it is the employee's \"Application\" folder, which is never deleted.","x-meaning-ar":"ما زالت في المجلد مستندات، أو أنه مجلد «الطلب» الخاص بالموظف الذي لا يُحذف أبداً.","x-fix":"Move or delete its documents first; hide the folder with `folders.update` instead if you only want it out of sight.","x-fix-ar":"انقل مستنداته أو احذفها أولاً؛ أو أخفِ المجلد عبر `folders.update` إن أردت إبعاده عن العرض فقط."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot delete a folder that contains documents","code":"validation_failed"}}}}}}},"/employees/{id}":{"get":{"summary":"Get one employee's full record","operationId":"employees.show","tags":["Employees"],"description":"Returns everything QHR holds on one employee: personal and contact data, ID, job, department, manager,\nlocations, employment status, contract and bank details, current salary (when you may see salaries),\ntoday's working schedule and documents.\n\n**When to use:** to answer questions about a specific person, or before `employees.update` to see the current\nvalues.\n\n**Prerequisites:** the employee's `id`, from `employees.list` or `employees.search`. Anyone may read their own\nrecord; reading someone else's needs \"View other profiles\" (`x-permission.x-others`).\n\n**Side effects:** none.","x-summary-ar":"عرض السجل الكامل لموظف","x-description-ar":"يعرض كل ما يحفظه QHR عن موظف واحد: البيانات الشخصية وبيانات الاتصال والهوية والوظيفة والقسم والمدير\nوالمواقع وحالة التوظيف وبيانات العقد والبنك والراتب الحالي (إن كان لك حق رؤية الرواتب) وجدول العمل لليوم\nوالمستندات.\n\n**متى تستخدمه:** للإجابة عن أسئلة تخص شخصاً بعينه، أو قبل `employees.update` لمعرفة القيم الحالية.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `employees.search`. يستطيع أي شخص قراءة سجله، أما\nقراءة سجل غيره فتحتاج «عرض ملفات الآخرين» (`x-permission.x-others`).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"employee/view","label":"View own profile","x-label-ar":"عرض ملفي الشخصي","x-others":{"key":"employee/view_others","label":"View other profiles","x-label-ar":"عرض ملفات الآخرين"}},"x-feature":"employee","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_id"}],"responses":{"200":{"description":"The employee.","x-description-ar":"الموظف.","content":{"application/json":{"example":{"id":1203,"employee_no":"E-0042","employee_no_locked":false,"first_name":"Sara","last_name":"Ahmed","first_name_ar":"سارة","last_name_ar":"أحمد","full_name":"Sara Ahmed","gender":"female","date_of_birth":"1994-05-12","marital_status":"single","nationality":"SA","residence_country":"SA","national_id_number":"1234567890","national_id_issued_date":"2022-01-10","national_id_expiry_date":"2032-01-09","email":"sara@example.com","work_email":"sara@acme.example","work_phone_number":"+966501234567","home_phone_number":null,"address":"Riyadh","emergency_contact_name":"Huda Ahmed","emergency_contact_relationship":"Sister","emergency_contact_home_phone_number":null,"emergency_contact_mobile_phone_number":"+966509876543","job_title":"Accountant","department_id":4,"manager_id":88,"manager_name":"Omar Ali","location_id":2,"location_name":"Riyadh HQ","additional_locations":[],"last_working_day":null,"employment_status":"Active","employment_status_key":"active","portal_access":"Activated","portal_access_key":"activated","has_portal_access":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working","flexible":false,"scheduled_hours":8.0},"employment_detail":{"id":1203,"join_date":"2024-03-01","employment_type_id":1,"contract_type":"indefinite","contract_end_date":null,"iban":"SA0380000000608010167519","bank_code":"RJHI","attendance_setting_id":1},"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","start_date":"2024-03-01","currency":"SAR","benefits":[],"salary_deductions":[],"insurance_deductions":[]},"documents":[],"created_at":"2024-02-20 06:30:00 UTC","updated_at":"2026-11-01 07:00:00 UTC"},"schema":{"$ref":"#/components/schemas/employee"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Update an employee","operationId":"employees.update","tags":["Employees"],"description":"Changes the fields you send; everything you leave out stays as it is. Send personal fields in `personal_info`,\ncontract and bank fields in `employment_detail`, and salary fields in `salary`.\n\n**Who may change what:** with \"Edit other profiles\" you can change any field of anyone, including the\nemployee number (until the employee is linked to Qoyod accounting). With only \"Edit own profile\" you can\nchange your own date of birth, marital status, home phone, address and emergency contact; sending any other\nfield answers 403 naming the fields. The email has its own operation, `employees.update_email`.\n\n**Prerequisites:** the employee's `id` from `employees.list` or `employees.search`; ids for the fields from\n`employees.meta_data` and `employees.managers`. Read the current values with `employees.show`.\n\n**Side effects:** recorded in the audit log, and synced to Qoyod accounting when connected. Removing an\nadditional location that still has attendance-device links answers 422 `device_links_will_close` listing\nthem; send the same body again with `confirm_device_unlink: true` to close them.\n\n**Not offered to Claude:** it can change the IBAN, bank account and salary, where an employee is paid.","x-summary-ar":"تعديل بيانات موظف","x-description-ar":"يعدّل الحقول التي ترسلها فقط ويترك الباقي كما هو. أرسل الحقول الشخصية في `personal_info`، وبيانات العقد\nوالبنك في `employment_detail`، وبيانات الراتب في `salary`.\n\n**من يعدّل ماذا:** مع «تعديل ملفات الآخرين» تعدّل أي حقل لأي موظف، بما فيه الرقم الوظيفي (ما لم يُربط\nالموظف بمحاسبة قيود). ومع «تعديل ملفي الشخصي» فقط تعدّل في سجلك تاريخ الميلاد والحالة الاجتماعية وهاتف\nالمنزل والعنوان وجهة الطوارئ؛ وإرسال أي حقل آخر يُرجع 403 مع أسماء الحقول. للبريد عملية خاصة هي\n`employees.update_email`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `employees.search`، وأرقام الحقول من\n`employees.meta_data` و`employees.managers`. اقرأ القيم الحالية عبر `employees.show`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق ويُزامَن مع محاسبة قيود عند الربط. حذف موقع إضافي ما زالت له\nروابط بأجهزة حضور يُرجع 422 بالرمز `device_links_will_close` مع قائمتها؛ أعد إرسال الطلب نفسه مع\n`confirm_device_unlink: true` لإغلاقها.\n\n**لا يُعرض على Claude:** لأنه يستطيع تغيير الآيبان والحساب البنكي والراتب، أي وجهة دفع راتب الموظف.","x-access":"write","x-permission":{"key":"employee/edit","label":"Edit own profile","x-label-ar":"تعديل ملفي الشخصي","x-others":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"}},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_id"}],"responses":{"200":{"description":"The employee after the change.","x-description-ar":"الموظف بعد التعديل.","content":{"application/json":{"example":{"id":1203,"employee_no":"E-0042","employee_no_locked":false,"first_name":"Sara","last_name":"Ahmed","first_name_ar":"سارة","last_name_ar":"أحمد","full_name":"Sara Ahmed","gender":"female","date_of_birth":"1994-05-12","marital_status":"single","nationality":"SA","residence_country":"SA","national_id_number":"1234567890","national_id_issued_date":"2022-01-10","national_id_expiry_date":"2032-01-09","email":"sara@example.com","work_email":"sara@acme.example","work_phone_number":"+966501234567","home_phone_number":null,"address":"Riyadh","emergency_contact_name":"Huda Ahmed","emergency_contact_relationship":"Sister","emergency_contact_home_phone_number":null,"emergency_contact_mobile_phone_number":"+966509876543","job_title":"Accountant","department_id":4,"manager_id":88,"manager_name":"Omar Ali","location_id":2,"location_name":"Riyadh HQ","additional_locations":[],"last_working_day":null,"employment_status":"Active","employment_status_key":"active","portal_access":"Activated","portal_access_key":"activated","has_portal_access":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working","flexible":false,"scheduled_hours":8.0},"employment_detail":{"id":1203,"join_date":"2024-03-01","employment_type_id":1,"contract_type":"indefinite","contract_end_date":null,"iban":"SA0380000000608010167519","bank_code":"RJHI","attendance_setting_id":1},"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","start_date":"2024-03-01","currency":"SAR","benefits":[],"salary_deductions":[],"insurance_deductions":[]},"documents":[],"created_at":"2024-02-20 06:30:00 UTC","updated_at":"2026-11-01 07:00:00 UTC"},"schema":{"$ref":"#/components/schemas/employee"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"device_links_will_close","meaning":"Removing these locations closes the attendance-device links listed in `device_links`.","x-meaning-ar":"حذف هذه المواقع يغلق روابط أجهزة الحضور المذكورة في `device_links`.","x-fix":"Send the same request again with `confirm_device_unlink: true`, or keep the locations.","x-fix-ar":"أعد إرسال الطلب نفسه مع `confirm_device_unlink: true`، أو أبقِ المواقع."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Department must exist","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee"],"properties":{"employee":{"type":"object","description":"Only the fields to change, in their block.","x-description-ar":"الحقول المراد تعديلها فقط، كلٌّ في مجموعته.","properties":{"personal_info":{"$ref":"#/components/schemas/employee_personal_info_update"},"employment_detail":{"$ref":"#/components/schemas/employee_employment_detail_input"},"salary":{"$ref":"#/components/schemas/employee_salary_input"}}},"confirm_device_unlink":{"type":"boolean","description":"Confirms closing the device links listed by a `device_links_will_close` refusal.","x-description-ar":"يؤكد إغلاق روابط الأجهزة التي ذكرها رفض `device_links_will_close`."}}},"example":{"employee":{"personal_info":{"job_title":"Senior Accountant"}}}}},"required":true,"description":"The fields to change."}}},"/employees/{id}/attendance_profile":{"get":{"summary":"Get an employee's attendance profile","operationId":"attendance_profiles.employee_profile","tags":["Attendance profiles"],"description":"Returns the attendance profile an employee is on today, the date it started, and the next scheduled\nchange (a different profile from a future date), if there is one. An employee who was never moved is on\nthe profile of their contract, or else on the company default; `effective_from` is then null.\n\n**When to use:** to answer \"what are this person's working hours?\" or \"is a profile change coming up?\".\nBefore `attendance_profiles.change_employee_profile` or `attendance_profiles.cancel_scheduled_change`.\n\n**Prerequisites:** the employee's `id`, from `employees.list` or `employees.search`.\n\n**Side effects:** none.","x-summary-ar":"عرض ملف الحضور لموظف","x-description-ar":"يعرض ملف الحضور الذي يتبعه الموظف اليوم وتاريخ بدئه، والتغيير المجدول التالي (ملف آخر من تاريخ قادم) إن وُجد.\nالموظف الذي لم يُنقل قط يكون على ملف عقده، وإلا فعلى الملف الافتراضي للشركة، ويكون `effective_from` حينها\nnull.\n\n**متى تستخدمه:** للإجابة عن «ما ساعات عمل هذا الشخص؟» أو «هل هناك تغيير ملف قادم؟»، وقبل\n`attendance_profiles.change_employee_profile` أو `attendance_profiles.cancel_scheduled_change`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `employees.search`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance_profile/view","label":"View attendance profiles","x-label-ar":"عرض ملفات الحضور"},"x-feature":"attendance_profile","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_employee_id"}],"responses":{"200":{"description":"The employee's current profile and next change.","x-description-ar":"ملف الموظف الحالي والتغيير القادم.","content":{"application/json":{"example":{"current":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"effective_from":"2026-09-01","scheduled":null},"schema":{"$ref":"#/components/schemas/attendance_profile_employee_profile"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Move an employee to another attendance profile","operationId":"attendance_profiles.change_employee_profile","tags":["Attendance profiles"],"description":"Puts one employee on another profile from a chosen date (tomorrow when `effective_from` is omitted). The\ndate must be tomorrow or later and not inside a period a payroll run already covers. A change already\nstarting on that date is replaced; earlier history stays.\n\n**When to use:** when one person changes shift or branch. For a group, use `attendance_profiles.assign`.\n\n**Prerequisites:** the employee's `id` from `employees.list`; the profile's `id` from\n`attendance_profiles.list`. See the current profile and any scheduled change with\n`attendance_profiles.employee_profile`.\n\n**Side effects:** saves the change and recounts the employee's upcoming leave (pending, and approved but\nnot started) with the new profile's days off. Not offered to Claude, because it changes the employee's\nschedule and leave balance.","x-summary-ar":"نقل موظف إلى ملف حضور آخر","x-description-ar":"ينقل موظفاً واحداً إلى ملف آخر من تاريخ يُحدد (من الغد إن لم يُرسل `effective_from`). يجب أن يكون التاريخ غداً\nأو بعده، وألا يقع في فترة تغطيها مسيرة رواتب. يُستبدل أي تغيير يبدأ في التاريخ نفسه، ويبقى السجل السابق كما هو.\n\n**متى تستخدمه:** عندما ينتقل شخص إلى وردية أو فرع آخر. للمجموعات استخدم `attendance_profiles.assign`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، ورقم `id` الملف من `attendance_profiles.list`. اعرض الملف\nالحالي وأي تغيير مجدول عبر `attendance_profiles.employee_profile`.\n\n**الآثار الجانبية:** يحفظ التغيير ويعيد احتساب إجازات الموظف القادمة (المعلّقة، والمعتمدة التي لم تبدأ) بأيام\nراحة الملف الجديد. لا يُعرض على Claude لأنه يغيّر جدول الموظف ورصيد إجازاته.","x-access":"write","x-permission":{"key":"attendance_profile/assign","label":"Assign profiles to employees","x-label-ar":"إسناد ملفات الحضور للموظفين"},"x-feature":"attendance_profile","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_employee_id"}],"responses":{"200":{"description":"The employee's profile and the scheduled change.","x-description-ar":"ملف الموظف والتغيير المجدول.","content":{"application/json":{"example":{"current":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"effective_from":"2026-09-01","scheduled":{"attendance_profile":{"id":5,"name":"Night shift","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"effective_from":"2026-12-01"}},"schema":{"$ref":"#/components/schemas/attendance_profile_employee_profile"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التغيير.","x-codes":[{"code":"validation_failed","meaning":"The start date is today or earlier, or a payroll run already covers it.","x-meaning-ar":"تاريخ البدء هو اليوم أو قبله، أو تغطيه مسيرة رواتب.","x-fix":"Choose a date from tomorrow on, outside paid periods, or revert the payroll run.","x-fix-ar":"اختر تاريخاً من الغد فصاعداً خارج الفترات المدفوعة، أو تراجع عن مسيرة الرواتب."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A profile change can start tomorrow at the earliest.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["attendance_profile"],"properties":{"attendance_profile":{"type":"object","required":["attendance_setting_id"],"description":"The change.","x-description-ar":"التغيير.","properties":{"attendance_setting_id":{"type":"integer","description":"The profile to move to, from `attendance_profiles.list`.","x-description-ar":"الملف المنقول إليه، من `attendance_profiles.list`."},"effective_from":{"type":"string","description":"First day on the new profile, tomorrow at the earliest; tomorrow when omitted.","x-description-ar":"أول يوم على الملف الجديد، غداً على الأقرب؛ غداً إن لم يُرسل.","format":"date"}}}}},"example":{"attendance_profile":{"attendance_setting_id":5,"effective_from":"2026-12-01"}}}},"required":true,"description":"The new profile and its start date."}},"delete":{"summary":"Cancel an employee's scheduled profile change","operationId":"attendance_profiles.cancel_scheduled_change","tags":["Attendance profiles"],"description":"Cancels the employee's next profile change that has not started yet; they stay on their current profile.\nA change that has already started is history and cannot be cancelled: move them back with\n`attendance_profiles.change_employee_profile` instead.\n\n**When to use:** when a planned shift or branch move is called off.\n\n**Prerequisites:** the employee's `id` from `employees.list`; check there is a `scheduled` change with\n`attendance_profiles.employee_profile`.\n\n**Side effects:** deletes the scheduled change and recounts the employee's upcoming leave with the days off\nof the profile they stay on. Not offered to Claude, because the cancelled change cannot be restored.","x-summary-ar":"إلغاء تغيير ملف الحضور المجدول لموظف","x-description-ar":"يلغي تغيير الملف التالي للموظف الذي لم يبدأ بعد، فيبقى على ملفه الحالي. التغيير الذي بدأ أصبح سجلاً ولا يمكن\nإلغاؤه: أعد الموظف إلى ملفه عبر `attendance_profiles.change_employee_profile` بدلاً من ذلك.\n\n**متى تستخدمه:** عند إلغاء نقل مخطط إلى وردية أو فرع آخر.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`؛ وتحقق من وجود تغيير `scheduled` عبر\n`attendance_profiles.employee_profile`.\n\n**الآثار الجانبية:** يحذف التغيير المجدول ويعيد احتساب إجازات الموظف القادمة بأيام راحة الملف الذي بقي عليه.\nلا يُعرض على Claude لأن التغيير الملغى لا يمكن استعادته.","x-access":"write","x-permission":{"key":"attendance_profile/assign","label":"Assign profiles to employees","x-label-ar":"إسناد ملفات الحضور للموظفين"},"x-feature":"attendance_profile","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_profile_employee_id"}],"responses":{"200":{"description":"The employee's profile, with no scheduled change.","x-description-ar":"ملف الموظف دون تغيير مجدول.","content":{"application/json":{"example":{"current":{"id":3,"name":"Head office","name_en":"Head office","name_ar":"المكتب الرئيسي","is_default":false,"weekly_target_days":5,"days_off":[5,6],"correction_requests_enabled":true,"correction_request_limit_days":7,"correction_approved_by":"manager","permission_requests_enabled":true,"grace_period_enabled":true,"grace_period_minutes":15,"auto_absent_after_minutes":240,"track_breaks":false,"allowed_break_minutes":60,"daily_target_hours":8.0,"weekly_target_hours":38.0,"work_start_time":"08:00","work_end_time":"16:00","assigned_employees_count":42,"day_shifts":[{"id":11,"name":"Short Thursday","day_of_week":4,"kind":"flexible","location_id":null,"start_time":null,"required_hours":6.0,"location_name":null}]},"effective_from":"2026-09-01","scheduled":null},"schema":{"$ref":"#/components/schemas/attendance_profile_employee_profile"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"There is nothing to cancel.","x-description-ar":"لا يوجد ما يُلغى.","x-codes":[{"code":"validation_failed","meaning":"The employee has no scheduled profile change.","x-meaning-ar":"ليس لدى الموظف تغيير ملف مجدول.","x-fix":"Check `scheduled` with `attendance_profiles.employee_profile`.","x-fix-ar":"تحقق من `scheduled` عبر `attendance_profiles.employee_profile`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"There is no scheduled profile change to cancel.","code":"validation_failed"}}}}}}},"/employees/{id}/cancel_invitation":{"put":{"summary":"Withdraw an employee's pending invitation","operationId":"employee_invitations.cancel","tags":["Employee invitations"],"description":"Withdraws an invitation the employee has not accepted yet: their login status becomes `cancelled` and the\nlink in the email no longer lets them in. Only a `pending` (or `expired`) invitation can be withdrawn; an\nactive account, an employee never invited, or one already cancelled is refused.\n\n**When to use:** when an invitation went to the wrong person or should not have been sent. To invite the\nemployee again later, use `employee_invitations.invite`.\n\n**Prerequisites:** the employee's `id`, from `employee_invitations.list` (`q[portal_access_eq]=pending`).\n\n**Side effects:** none beyond the status change; no email is sent.\n\n**Not offered to Claude:** it changes who can sign in to QHR.","x-summary-ar":"سحب دعوة معلّقة لموظف","x-description-ar":"يسحب دعوة لم يقبلها الموظف بعد: تصبح حالة دخوله `cancelled` ولا يعود الرابط في البريد يتيح له الدخول. لا\nتُسحب إلا دعوة `pending` (أو `expired`)؛ ويُرفض الطلب لحساب مفعّل أو لموظف لم يُدعَ أو لدعوة ملغاة أصلاً.\n\n**متى تستخدمه:** حين تصل الدعوة إلى الشخص الخطأ أو ما كان ينبغي إرسالها. لدعوة الموظف مجدداً لاحقاً استخدم\n`employee_invitations.invite`.\n\n**المتطلبات:** رقم `id` الموظف من `employee_invitations.list` (`q[portal_access_eq]=pending`).\n\n**الآثار الجانبية:** لا شيء سوى تغيير الحالة؛ لا يُرسل أي بريد.\n\n**لا يُعرض على Claude:** لأنه يغيّر من يستطيع الدخول إلى QHR.","x-access":"write","x-permission":{"key":"employee_invitation/cancel","label":"Cancel invitations","x-label-ar":"إلغاء الدعوات"},"x-feature":"employee_invitation","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_id"}],"responses":{"200":{"description":"The invitation was withdrawn.","x-description-ar":"سُحبت الدعوة.","content":{"application/json":{"example":{"message":"Invitation has been cancelled."},"schema":{"$ref":"#/components/schemas/employee_invitation_message"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"There is no invitation to withdraw.","x-description-ar":"لا توجد دعوة لسحبها.","x-codes":[{"code":"validation_failed","meaning":"The employee was never invited, already accepted (account active), or the invitation is already cancelled.","x-meaning-ar":"لم يُدعَ الموظف قط، أو قبل الدعوة (الحساب مفعّل)، أو الدعوة ملغاة أصلاً.","x-fix":"Check `portal_access_key` in `employee_invitations.list`; only `pending` or `expired` can be withdrawn.","x-fix-ar":"راجع `portal_access_key` في `employee_invitations.list`؛ لا يُسحب إلا `pending` أو `expired`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Invitation is already cancelled.","code":"validation_failed"}}}}}}},"/employees/{id}/email":{"patch":{"summary":"Change an employee's email","operationId":"employees.update_email","tags":["Employees"],"description":"Changes an employee's email. For an employee who was invited to QHR, it is also their login: the pending\ninvitation moves to the new address and is sent again.\n\n**When to use:** to correct a mistyped email or move someone to a new address. To change other fields, use\n`employees.update`.\n\n**Prerequisites:** the employee's `id` from `employees.list`. Check the new email with\n`employees.validate_email`.\n\n**Side effects:** may re-send the QHR invitation to the new address; if the new email is the login of a company\nuser with no employee record, that user is linked to this employee. Recorded in the audit log. Not offered to\nClaude, because it changes who can sign in as this employee.","x-summary-ar":"تغيير بريد موظف","x-description-ar":"يغيّر بريد الموظف. وللموظف المدعو إلى QHR هو أيضاً بريد الدخول: تنتقل الدعوة المعلّقة إلى العنوان الجديد\nوتُرسل مرة أخرى.\n\n**متى تستخدمه:** لتصحيح بريد مكتوب خطأً أو نقل الموظف إلى عنوان جديد. لتعديل الحقول الأخرى استخدم\n`employees.update`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`. تحقق من البريد الجديد عبر `employees.validate_email`.\n\n**الآثار الجانبية:** قد تُعاد الدعوة إلى العنوان الجديد؛ وإن كان البريد الجديد بريد دخول مستخدم في الشركة بلا\nسجل وظيفي يُربط ذلك المستخدم بهذا الموظف. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر من يستطيع\nالدخول باسم هذا الموظف.","x-access":"write","x-permission":{"key":"employee/edit_others","label":"Edit other profiles","x-label-ar":"تعديل ملفات الآخرين"},"x-feature":"employee","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_id"}],"responses":{"200":{"description":"The employee with the new email.","x-description-ar":"الموظف بالبريد الجديد.","content":{"application/json":{"example":{"id":1203,"employee_no":"E-0042","employee_no_locked":false,"first_name":"Sara","last_name":"Ahmed","first_name_ar":"سارة","last_name_ar":"أحمد","full_name":"Sara Ahmed","gender":"female","date_of_birth":"1994-05-12","marital_status":"single","nationality":"SA","residence_country":"SA","national_id_number":"1234567890","national_id_issued_date":"2022-01-10","national_id_expiry_date":"2032-01-09","email":"sara@example.com","work_email":"sara@acme.example","work_phone_number":"+966501234567","home_phone_number":null,"address":"Riyadh","emergency_contact_name":"Huda Ahmed","emergency_contact_relationship":"Sister","emergency_contact_home_phone_number":null,"emergency_contact_mobile_phone_number":"+966509876543","job_title":"Accountant","department_id":4,"manager_id":88,"manager_name":"Omar Ali","location_id":2,"location_name":"Riyadh HQ","additional_locations":[],"last_working_day":null,"employment_status":"Active","employment_status_key":"active","portal_access":"Activated","portal_access_key":"activated","has_portal_access":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working","flexible":false,"scheduled_hours":8.0},"employment_detail":{"id":1203,"join_date":"2024-03-01","employment_type_id":1,"contract_type":"indefinite","contract_end_date":null,"iban":"SA0380000000608010167519","bank_code":"RJHI","attendance_setting_id":1},"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","start_date":"2024-03-01","currency":"SAR","benefits":[],"salary_deductions":[],"insurance_deductions":[]},"documents":[],"created_at":"2024-02-20 06:30:00 UTC","updated_at":"2026-11-01 07:00:00 UTC"},"schema":{"$ref":"#/components/schemas/employee"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The email cannot be used.","x-description-ar":"لا يمكن استخدام البريد.","x-codes":[{"code":"email_taken","meaning":"The email belongs to another employee or user in this company. `employee_id` and `tenant_user_id` say who.","x-meaning-ar":"البريد يخص موظفاً أو مستخدماً آخر في هذه الشركة. يوضح `employee_id` و`tenant_user_id` صاحبه.","x-fix":"Use another email, or open the employee named in `employee_id`.","x-fix-ar":"استخدم بريداً آخر، أو افتح سجل الموظف المذكور في `employee_id`."},{"code":"employee_inactive","meaning":"The email is a user's login, and the employee would be inactive, so they cannot be linked.","x-meaning-ar":"البريد هو بريد دخول مستخدم، والموظف غير نشط، فلا يمكن ربطهما.","x-fix":"Use another email, or make the employee active.","x-fix-ar":"استخدم بريداً آخر، أو اجعل الموظف نشطاً."},{"code":"validation_failed","meaning":"The email is not valid, or it is the employee's current email.","x-meaning-ar":"البريد غير صحيح، أو هو البريد الحالي للموظف.","x-fix":"Send a different, well-formed email.","x-fix-ar":"أرسل بريداً مختلفاً بصيغة صحيحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This email already belongs to another employee.","code":"email_taken","employee_id":1188,"tenant_user_id":null}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"The new email.","x-description-ar":"البريد الجديد.","format":"email"}}},"example":{"email":"sara.ahmed@example.com"}}},"required":true,"description":"The new email."}}},"/employees/{id}/invite":{"put":{"summary":"Invite an employee to sign in to QHR","operationId":"employee_invitations.invite","tags":["Employee invitations"],"description":"Emails the employee an invitation to sign in to QHR with their personal email, and sets their login status\nto `pending` until they accept. Calling it again re-sends the invitation (a cancelled or expired one too).\nThe employee needs an email. An employee whose account is already active is refused.\n\n**When to use:** to give an employee access to QHR (self-service leave, attendance, payslips), after\nadding them with `employees.create` without `invite_to_portal`.\n\n**Prerequisites:** the employee's `id`, from `employee_invitations.list` or `employees.list`. Optional\n`tenant_role_id`, from `roles.list`; with none, a first invitation grants the default employee role and a\nre-invitation keeps the role the person already has.\n\n**Side effects:** creates the person's QHR login (through Qoyod Identity) if they have none, links it to\nthe employee, and sends the invitation email. When the person already has a membership that is not active\nyet (pending, cancelled or expired), a `tenant_role_id` overwrites the role it holds, including\ndemoting another admin (only the last active admin is protected).\n\n**Not offered to Claude:** it grants access to the company's data, and `tenant_role_id` can be any active\nrole, Admin included.","x-summary-ar":"دعوة موظف للدخول إلى QHR","x-description-ar":"يرسل إلى بريد الموظف الشخصي دعوة للدخول إلى QHR، ويجعل حالة دخوله `pending` إلى أن يقبلها. استدعاؤه مرة\nأخرى يعيد إرسال الدعوة (حتى الملغاة أو المنتهية). يجب أن يكون للموظف بريد، ويُرفض طلب موظف حسابه مفعّل\nأصلاً.\n\n**متى تستخدمه:** لمنح موظف صلاحية الدخول إلى QHR (الخدمة الذاتية للإجازات والحضور وقسائم الرواتب) بعد\nإضافته عبر `employees.create` دون `invite_to_portal`.\n\n**المتطلبات:** رقم `id` الموظف من `employee_invitations.list` أو `employees.list`. و`tenant_role_id`\nاختياري من `roles.list`؛ بدونه تمنح الدعوة الأولى دور الموظف الافتراضي، وتُبقي إعادة الدعوة الدور الذي\nيحمله الشخص.\n\n**الآثار الجانبية:** يُنشئ حساب دخول للشخص إلى QHR (عبر Qoyod Identity) إن لم يكن له حساب، ويربطه\nبالموظف، ويرسل بريد الدعوة. وإن كانت للشخص عضوية غير مفعّلة بعد (معلّقة أو ملغاة أو منتهية) فإن\n`tenant_role_id` يستبدل الدور الذي تحمله، حتى لو أنزل ذلك مدير نظام آخر (لا يُحمى إلا آخر مدير نظام نشط).\n\n**لا يُعرض على Claude:** لأنه يمنح صلاحية الوصول إلى بيانات الشركة، ويمكن أن يكون `tenant_role_id` أي دور\nنشط بما فيه مدير النظام.","x-access":"write","x-permission":{"key":"employee_invitation/create","label":"Send invitations","x-label-ar":"إرسال دعوات"},"x-feature":"employee_invitation","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_id"}],"responses":{"200":{"description":"The invitation was sent.","x-description-ar":"أُرسلت الدعوة.","content":{"application/json":{"example":{"message":"Invitation sent successfully."},"schema":{"$ref":"#/components/schemas/employee_invitation_message"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The invitation cannot be sent.","x-description-ar":"لا يمكن إرسال الدعوة.","x-codes":[{"code":"validation_failed","meaning":"The employee has no email; or `tenant_role_id` is unknown or inactive; or the account is already active; or the role would demote the company's only active admin; or the email is another employee's login.","x-meaning-ar":"ليس للموظف بريد؛ أو `tenant_role_id` غير موجود أو غير نشط؛ أو الحساب مفعّل أصلاً؛ أو الدور يُنزل مدير النظام النشط الوحيد؛ أو البريد بريد دخول موظف آخر.","x-fix":"Read `error`. Add an email with `employees.update`, pick an active role, or leave an active account as it is.","x-fix-ar":"اقرأ `error`. أضف بريداً عبر `employees.update`، أو اختر دوراً نشطاً، أو اترك الحساب المفعّل كما هو."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Email is required for portal invitation.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tenant_role_id":{"type":"integer","description":"Role the invitation grants (any active role). When omitted, the default employee role for a first invitation, the current role otherwise.","x-description-ar":"الدور الذي تمنحه الدعوة (أي دور نشط). إن لم يُرسل: دور الموظف الافتراضي في الدعوة الأولى، والدور الحالي في غيرها."}}},"example":{"tenant_role_id":3}}},"required":true,"description":"The role to invite with (optional)."}}},"/employees/{id}/time_off/balance_adjustments":{"post":{"summary":"Adjust an employee's leave balance by hand","operationId":"time_off.adjust_balance","tags":["Employee time off"],"description":"Adds days to, or takes days from, an employee's balance on one policy for the current year, with a reason.\nThe balance never goes below zero: taking more than it holds leaves it at 0, and the response says what was\nreally applied (`delta`). Days are rounded to one decimal.\n\n**When to use:** to grant extra days (worked a public holiday, a goodwill day) or to correct an error. To\nsee the effect, read `time_off.balance_statement`.\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.balances`.\nNeeds \"Adjust employee leave balances\".\n\n**Side effects:** the balance changes at once, and a `manual_adjustment` row with the reason and the token\nowner's name is added to the balance statement. Recorded in the audit log. No one is notified. Changes the\nleave paid out when the employee leaves.\n\n**Not offered to Claude:** leave days are paid time and are paid out in cash when someone leaves, so a\nchange to a balance moves money.","x-summary-ar":"تعديل رصيد إجازة موظف يدوياً","x-description-ar":"يضيف أياماً إلى رصيد موظف في سياسة واحدة للعام الحالي أو يخصم منه، مع ذكر السبب. لا ينزل الرصيد تحت الصفر:\nخصم أكثر مما فيه يتركه عند ٠، ويذكر الرد ما طُبّق فعلاً (`delta`). وتُقرَّب الأيام إلى منزلة عشرية واحدة.\n\n**متى تستخدمه:** لمنح أيام إضافية (عمل في عطلة رسمية، يوم تقديري) أو لتصحيح خطأ. لرؤية الأثر اقرأ\n`time_off.balance_statement`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.balances`. يحتاج صلاحية\n«تعديل أرصدة إجازات الموظفين».\n\n**الآثار الجانبية:** يتغير الرصيد فوراً، وتُضاف إلى كشف الرصيد حركة `manual_adjustment` بالسبب واسم صاحب الرمز.\nيُسجَّل في سجل التدقيق. لا يُبلَّغ أحد. ويغيّر ما يُصرف من إجازات عند مغادرة الموظف.\n\n**لا يُعرض على Claude:** أيام الإجازة وقت مدفوع الأجر وتُصرف نقداً عند المغادرة، فتعديل الرصيد يحرّك أموالاً.","x-access":"write","x-permission":{"key":"time_off/adjust_balance","label":"Adjust employee leave balances","x-label-ar":"تعديل أرصدة إجازات الموظفين"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"201":{"description":"What was applied.","x-description-ar":"ما طُبّق.","content":{"application/json":{"example":{"policy_id":7,"name":"Annual Leave","old_total":21.0,"new_total":22.0,"delta":1.0,"reason":"Worked on the National Day holiday"},"schema":{"type":"object","properties":{"policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"old_total":{"type":"number","description":"This year's balance before.","x-description-ar":"رصيد هذا العام قبل التعديل."},"new_total":{"type":"number","description":"This year's balance after.","x-description-ar":"رصيد هذا العام بعد التعديل."},"delta":{"type":"number","description":"The change really applied; smaller than asked when the balance hit zero.","x-description-ar":"التغيير المطبّق فعلاً؛ وقد يقل عن المطلوب إن وصل الرصيد إلى الصفر."},"reason":{"type":"string","description":"The reason recorded.","x-description-ar":"السبب المسجّل."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The adjustment was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"No reason, a zero `delta`, the policy is not active or not held by the employee, or the employee has no balance row for this year yet.","x-meaning-ar":"لا يوجد سبب، أو `delta` صفر، أو السياسة غير فعّالة أو غير مسندة إلى الموظف، أو لا يوجد للموظف سجل رصيد لهذا العام بعد.","x-fix":"Fix what `error` names. Pick the policy from `time_off.balances`.","x-fix-ar":"صحّح ما يذكره `error`، واختر السياسة من `time_off.balances`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A reason is required","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["balance_adjustment"],"properties":{"balance_adjustment":{"type":"object","required":["leave_policy_id","delta","reason"],"description":"The adjustment.","x-description-ar":"التعديل.","properties":{"leave_policy_id":{"type":"integer","description":"The policy, from `time_off.balances` (`id`); it must be active and held by the employee.","x-description-ar":"السياسة، من `time_off.balances` (`id`)؛ ويجب أن تكون فعّالة ومسندة إلى الموظف."},"delta":{"type":"number","description":"Days to add (positive) or take away (negative); not zero.","x-description-ar":"الأيام المضافة (موجب) أو المخصومة (سالب)؛ ولا تكون صفراً."},"reason":{"type":"string","description":"Why; shown on the balance statement.","x-description-ar":"السبب؛ ويظهر في كشف الرصيد."}}}}},"example":{"balance_adjustment":{"leave_policy_id":7,"delta":1,"reason":"Worked on the National Day holiday"}}}},"required":true,"description":"The adjustment."}}},"/employees/{id}/time_off/balance_statements/{leave_policy_id}":{"get":{"summary":"Get an employee's balance statement for one policy","operationId":"time_off.balance_statement","tags":["Employee time off"],"description":"Returns every movement on one policy's balance for one year, like a bank statement: the assignment, yearly\nor monthly accruals, carry-over and its expiry, manual adjustments (with who made them and why) and each\nleave request as a deduction, in date order with a running total that ends at the balance. Rejected and\ncancelled requests are listed but do not move the total (`counted: false`).\n\n**When to use:** to explain a balance (\"why does Sara have 18 days?\") or to check a manual adjustment. For\njust the totals, `time_off.balances` is lighter. Works for a policy that was removed from the employee\ntoo (`unassigned_on`).\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.balances` or\n`time_off.policies`. Needs \"View others' time off\".\n\n**Side effects:** none.","x-summary-ar":"عرض كشف رصيد موظف لسياسة واحدة","x-description-ar":"يعرض كل حركة على رصيد سياسة واحدة لعام واحد، مثل كشف الحساب البنكي: الإسناد، والاستحقاق السنوي أو الشهري،\nوالترحيل وانتهاؤه، والتعديلات اليدوية (مع من أجراها وسببها)، وكل طلب إجازة كخصم، بترتيب التاريخ مع رصيد\nجارٍ ينتهي عند الرصيد الفعلي. الطلبات المرفوضة والملغاة تظهر لكنها لا تغيّر الرصيد (`counted: false`).\n\n**متى تستخدمه:** لتفسير رصيد («لماذا لدى سارة ١٨ يوماً؟») أو للتحقق من تعديل يدوي. للإجماليات فقط،\n`time_off.balances` أخف. ويعمل أيضاً لسياسة أُزيلت من الموظف (`unassigned_on`).\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.balances` أو\n`time_off.policies`. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"$ref":"#/components/parameters/time_off_leave_policy_id"},{"name":"fiscal_year","in":"query","required":false,"schema":{"type":"integer"},"description":"The leave year (calendar year). This year when omitted.","x-description-ar":"سنة الإجازة (السنة الميلادية). العام الحالي إن لم تُرسل.","example":2026}],"responses":{"200":{"description":"The statement.","x-description-ar":"الكشف.","content":{"application/json":{"example":{"fiscal_year":2026,"policy":{"id":7,"name":"Annual Leave"},"unassigned_on":null,"summary":{"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":0.0,"available_days":20.0},"entries":[{"event_type":"carryover","effective_date":"2026-01-01","amount":4.0,"counted":true,"description":"Carried over from 2025","actor":null,"leave_request_id":null,"status":null,"running_total":4.0},{"event_type":"accrual","effective_date":"2026-01-01","amount":21.0,"counted":true,"description":"Yearly accrual","actor":null,"leave_request_id":null,"status":null,"running_total":25.0},{"event_type":"deduction","effective_date":"2026-03-02","amount":-5.0,"counted":true,"description":"Deduction: 02/03/2026 – 06/03/2026","actor":null,"leave_request_id":5480,"status":"approved","running_total":20.0},{"event_type":"manual_adjustment","effective_date":"2026-06-01","amount":1.0,"counted":true,"description":"Manual adjustment: worked on a public holiday","actor":"Huda Saleh","leave_request_id":null,"status":null,"running_total":21.0}]},"schema":{"$ref":"#/components/schemas/time_off_statement"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The policy was never assigned to this employee.","x-description-ar":"لم تُسند السياسة إلى هذا الموظف قط.","x-codes":[{"code":"validation_failed","meaning":"This employee has never held this leave policy.","x-meaning-ar":"لم تُسند سياسة الإجازة هذه إلى الموظف قط.","x-fix":"Pick a policy from `time_off.balances` or `time_off.policies` (`assigned`).","x-fix-ar":"اختر سياسة من `time_off.balances` أو `time_off.policies` (`assigned`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This leave policy has never been assigned to this employee","code":"validation_failed"}}}}}}},"/employees/{id}/time_off/leave_requests":{"get":{"summary":"List an employee's leave requests","operationId":"time_off.leave_requests","tags":["Employee time off"],"description":"Returns every leave request of one employee, newest first, whatever its status and date: pending, approved,\nrejected, cancelled and revoked, past and future. Each row says where the request waits (`current_stage`),\nwhether HR or the manager filed it (`on_behalf`, `submitted_by`) and whether the token's owner may withdraw\nor revoke an approval on it (`approver_actions`).\n\n**When to use:** to answer \"what leave has this person asked for or taken?\". For the remaining days per\npolicy use `time_off.balances`; for requests across the whole company use `hr_leaves.requests`.\n\n**Prerequisites:** the employee's `id` from `employees.list`, `employees.search` or `hr_leaves.employees`.\nNeeds \"View others' time off\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات إجازة موظف","x-description-ar":"يعرض كل طلبات الإجازة لموظف واحد، الأحدث أولاً، أياً كانت حالتها وتاريخها: المعلّقة والمعتمدة والمرفوضة\nوالملغاة والمسحوب اعتمادها، الماضية والقادمة. ويوضح كل صف أين ينتظر الطلب (`current_stage`)، وهل قدّمته\nالموارد البشرية أو المدير نيابةً عنه (`on_behalf` و`submitted_by`)، وهل يستطيع صاحب الرمز سحب الاعتماد\nعليه (`approver_actions`).\n\n**متى تستخدمه:** للإجابة عن سؤال «ما الإجازات التي طلبها هذا الشخص أو أخذها؟». للأيام المتبقية في كل\nسياسة استخدم `time_off.balances`، ولطلبات الشركة كلها استخدم `hr_leaves.requests`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `employees.search` أو `hr_leaves.employees`. يحتاج\nصلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","cancelled","revoked"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"approved"},{"name":"q[leave_policy_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this leave policy (id from `time_off.balances`).","x-description-ar":"سياسة إجازة محددة فقط (الرقم من `time_off.balances`).","example":7},{"name":"q[start_date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or after this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو بعده.","example":"2026-01-01"},{"name":"q[start_date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or before this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو قبله.","example":"2026-12-31"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc` on `start_date`, `end_date`, `created_at` or `status`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` على `start_date` أو `end_date` أو `created_at` أو `status`. الأحدث أولاً إن لم يُرسل.","example":"start_date desc"}],"responses":{"200":{"description":"A page of the employee's leave requests.","x-description-ar":"صفحة من طلبات إجازة الموظف.","content":{"application/json":{"example":{"records":[{"id":5521,"start_date":"2026-12-14","end_date":"2026-12-16","balance":"3.0","status":"pending","created_at":"2026-11-20 08:15:00 UTC","leave_type_name":"Annual Leave","on_behalf":true,"policy_approver":"Manager","current_stage":"awaiting_manager","current_approver_name":null,"cancellation_requested_at":null,"locked":false,"lock_reason":null,"submitted_by":{"id":88,"full_name":"Huda Saleh"},"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/time_off_leave_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"File a leave request on behalf of an employee","operationId":"time_off.create_leave_request","tags":["Employee time off"],"description":"Files a leave request for an employee, as HR, under one of their leave policies. QHR counts the working days\n(weekends and holidays excluded) and the request starts `pending`, going through the policy's normal approval\nchain (manager, HR, or manager then HR) exactly as if the employee had filed it; it is not approved by being\nfiled here. It is marked `on_behalf`, which lets it use past dates even when the policy does not. The\nemployee cannot edit it, and if they cancel it the cancellation goes to the approver's review instead of\ntaking effect at once.\n\n**When to use:** when someone asks HR to book leave for them, or to record leave after the fact. Check the\ndates first with `time_off.validate_leave_request`. To file for yourself, use your own leave requests\ninstead.\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.balances`.\nNeeds \"Submit leave requests on behalf of employees\".\n\n**Side effects:** the days are held against the balance as pending (`pending_days`) until it is decided; each\napprover of the first stage is emailed. Refused when the days exceed the available balance (unless the\npolicy allows a negative balance), when it overlaps leave already approved, or when it ends after the\nemployee's last working day. A request that only overlaps another pending one is filed, with a `warning`.\nA policy that requires a supporting document cannot be filed here: the document is a file upload, which this\noperation does not take.","x-summary-ar":"تقديم طلب إجازة نيابةً عن موظف","x-description-ar":"يقدّم طلب إجازة لموظف، بصفتك من الموارد البشرية، على إحدى سياسات الإجازة المسندة إليه. يحسب QHR أيام العمل\n(دون العطل الأسبوعية والرسمية) ويبدأ الطلب بحالة `pending`، ويمر بمسار الاعتماد المعتاد للسياسة (المدير، أو\nالموارد البشرية، أو المدير ثم الموارد البشرية) كأن الموظف قدّمه بنفسه؛ فتقديمه هنا لا يعني اعتماده. ويُعلَّم\nبـ `on_behalf`، ما يسمح له بتواريخ ماضية حتى لو لم تسمح بها السياسة. ولا يستطيع الموظف تعديله، وإن ألغاه\nيذهب الإلغاء إلى مراجعة المعتمِد بدلاً من أن يسري فوراً.\n\n**متى تستخدمه:** عندما يطلب شخص من الموارد البشرية حجز إجازة له، أو لتسجيل إجازة بعد وقوعها. افحص التواريخ أولاً\nعبر `time_off.validate_leave_request`. ولتقديم إجازة لنفسك استخدم طلبات إجازتك أنت.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.balances`. يحتاج صلاحية\n«تقديم طلبات إجازة نيابةً عن الموظفين».\n\n**الآثار الجانبية:** تُحجز الأيام من الرصيد كأيام معلّقة (`pending_days`) حتى يُبت في الطلب، ويصل بريد إلى كل\nمعتمِد في المرحلة الأولى. يُرفض إن تجاوزت الأيام الرصيد المتاح (ما لم تسمح السياسة برصيد سالب)، أو تداخل مع\nإجازة معتمدة، أو انتهى بعد آخر يوم عمل للموظف. أما التداخل مع طلب معلّق آخر فقط فيُقدَّم معه `warning`.\nولا يمكن هنا تقديم طلب في سياسة تشترط مستنداً داعماً، لأن المستند ملف مرفوع وهذه العملية لا تستقبل الملفات.","x-access":"write","x-permission":{"key":"time_off/request_on_behalf","label":"Submit leave requests on behalf of employees","x-label-ar":"تقديم طلبات إجازة نيابةً عن الموظفين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"201":{"description":"The new request, pending approval. `warning` appears when it overlaps another pending request.","x-description-ar":"الطلب الجديد بانتظار الاعتماد. يظهر `warning` إن تداخل مع طلب معلّق آخر.","content":{"application/json":{"example":{"record":{"id":5521,"employee_id":1203,"leave_policy_id":7,"start_date":"2026-12-14","end_date":"2026-12-16","balance":"3.0","reason":"Family wedding in Jeddah","status":"pending","on_behalf":true,"created_at":"2026-11-20 08:15:00 UTC"}},"schema":{"type":"object","required":["record"],"properties":{"record":{"type":"object","description":"The leave request.","x-description-ar":"طلب الإجازة.","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"الموظف."},"leave_policy_id":{"type":"integer","description":"The policy.","x-description-ar":"السياسة."},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"balance":{"type":"string","description":"Working days it takes, as a decimal string.","x-description-ar":"أيام العمل التي يأخذها، كنص عشري."},"reason":{"type":"string","description":"The reason given.","x-description-ar":"السبب المذكور.","nullable":true},"status":{"type":"string","description":"Always `pending` here.","x-description-ar":"دائماً `pending` هنا."},"on_behalf":{"type":"boolean","description":"Always true here.","x-description-ar":"دائماً true هنا."},"created_at":{"type":"string","description":"When it was filed, in UTC.","x-description-ar":"وقت تقديمه بتوقيت UTC."}}},"warning":{"type":"string","description":"Advice that did not stop the filing: an overlap with a pending request, or a booking in next year's balance.","x-description-ar":"تنبيه لم يمنع التقديم: تداخل مع طلب معلّق، أو حجز من رصيد العام القادم."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The leave cannot be filed.","x-description-ar":"لا يمكن تقديم الإجازة.","x-codes":[{"code":"validation_failed","meaning":"Dates missing, malformed or reversed; the policy is not held; no working days in the range; not enough balance; it overlaps approved leave; it ends after the last working day; or the policy needs a document.","x-meaning-ar":"التواريخ ناقصة أو غير صحيحة أو معكوسة، أو السياسة غير مسندة، أو لا أيام عمل في الفترة، أو الرصيد لا يكفي، أو تتداخل مع إجازة معتمدة، أو تنتهي بعد آخر يوم عمل، أو السياسة تشترط مستنداً.","x-fix":"Fix what `error` names. Check dates first with `time_off.validate_leave_request`.","x-fix-ar":"صحّح ما يذكره `error`، وافحص التواريخ أولاً عبر `time_off.validate_leave_request`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Insufficient leave balance","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leave_request"],"properties":{"leave_request":{"type":"object","required":["leave_policy_id","start_date","end_date"],"description":"The request.","x-description-ar":"الطلب.","properties":{"leave_policy_id":{"type":"integer","description":"The policy, from `time_off.balances` (`id`).","x-description-ar":"السياسة، من `time_off.balances` (`id`)."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"reason":{"type":"string","description":"Why, up to 500 characters; approvers see it.","x-description-ar":"السبب، حتى ٥٠٠ حرف؛ ويراه المعتمِدون.","maxLength":500}}}}},"example":{"leave_request":{"leave_policy_id":7,"start_date":"2026-12-14","end_date":"2026-12-16","reason":"Family wedding in Jeddah"}}}},"required":true,"description":"The leave to file."}}},"/employees/{id}/time_off/leave_requests/balances":{"get":{"summary":"List an employee's leave balances","operationId":"time_off.balances","tags":["Employee time off"],"description":"Returns each active leave policy the employee holds with this year's figures: days earned, carried over,\nentitled, taken, held by pending requests and still available. The figures reconcile:\n`entitled_days` = `accrued_days` + `carryover_days` (when usable) and `available_balance` =\n`entitled_days` − `taken_days` − `pending_days`.\n\n**When to use:** to answer \"how many days of annual leave does Sara have left?\", and to find the\n`leave_policy_id` that `time_off.validate_leave_request`, `time_off.create_leave_request`,\n`time_off.adjust_balance` and `time_off.balance_statement` need. Policies the employee does not hold, and\ninactive ones, are not here; see `time_off.policies`.\n\n**Prerequisites:** the employee's `id` from `employees.list` or `hr_leaves.employees`. Needs \"View others'\ntime off\".\n\n**Side effects:** none. A `per_event` policy has no balance to count down, so its figures are not limits.","x-summary-ar":"عرض أرصدة إجازات موظف","x-description-ar":"يعرض كل سياسة إجازة فعّالة مسندة إلى الموظف مع أرقام هذا العام: الأيام المكتسبة والمرحّلة والمستحقة\nوالمأخوذة والمحجوزة لطلبات معلّقة والمتاحة. والأرقام متسقة: `entitled_days` = `accrued_days` +\n`carryover_days` (إن كان قابلاً للاستخدام)، و`available_balance` = `entitled_days` − `taken_days` −\n`pending_days`.\n\n**متى تستخدمه:** للإجابة عن سؤال «كم يوماً بقي لسارة من إجازتها السنوية؟»، ولمعرفة `leave_policy_id` الذي\nتحتاجه `time_off.validate_leave_request` و`time_off.create_leave_request` و`time_off.adjust_balance`\nو`time_off.balance_statement`. السياسات غير المسندة إلى الموظف والمعطّلة ليست هنا؛ انظر `time_off.policies`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list` أو `hr_leaves.employees`. يحتاج صلاحية «عرض إجازات\nالآخرين».\n\n**الآثار الجانبية:** لا شيء. سياسة `per_event` لا رصيد لها، فأرقامها ليست حدوداً.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The employee's balances, one card per policy.","x-description-ar":"أرصدة الموظف، بطاقة لكل سياسة.","content":{"application/json":{"example":{"records":[{"id":7,"name":"Annual Leave","duration":21.0,"available_balance":18.0,"requires_document":false,"allow_past_dates":false,"show_used_balance":true,"total_balance":21.0,"days_used":7.0,"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":2.0,"accrued_per":"per_year","allow_negative_balance":false}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/time_off_balance_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/employees/{id}/time_off/leave_requests/validate":{"get":{"summary":"Check leave dates for an employee before filing","operationId":"time_off.validate_leave_request","tags":["Employee time off"],"description":"Checks candidate dates for one employee and one policy without saving anything: how many working days they\ntake (weekends and holidays excluded), how many days the policy has available, whether that is exceeded,\nand which of the employee's pending or approved requests share a day with them.\n\n**When to use:** before `time_off.create_leave_request`, to tell the person what will happen. A 422 here\nmeans the submit would be refused for the same reason (no dates, policy not held, end before start, past\nthe employee's last working day).\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.balances`.\nNeeds \"Submit leave requests on behalf of employees\".\n\n**Side effects:** none.","x-summary-ar":"فحص تواريخ إجازة لموظف قبل تقديمها","x-description-ar":"يفحص تواريخ مقترحة لموظف واحد وسياسة واحدة دون حفظ أي شيء: كم يوم عمل تأخذ (دون العطل الأسبوعية\nوالرسمية)، وكم يوماً متاحاً في السياسة، وهل يُتجاوز، وأيّ طلبات الموظف المعلّقة أو المعتمدة تشترك معها في يوم.\n\n**متى تستخدمه:** قبل `time_off.create_leave_request` لإخبار الشخص بما سيحدث. الرد 422 هنا يعني أن التقديم\nسيُرفض للسبب نفسه (لا تواريخ، أو السياسة غير مسندة، أو النهاية قبل البداية، أو بعد آخر يوم عمل للموظف).\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.balances`. يحتاج صلاحية\n«تقديم طلبات إجازة نيابةً عن الموظفين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/request_on_behalf","label":"Submit leave requests on behalf of employees","x-label-ar":"تقديم طلبات إجازة نيابةً عن الموظفين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"name":"leave_policy_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The policy to check against, from `time_off.balances` (`id`).","x-description-ar":"السياسة التي يُفحص عليها، من `time_off.balances` (`id`).","example":7},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","example":"2026-12-14"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","example":"2026-12-16"}],"responses":{"200":{"description":"What filing these dates would run into.","x-description-ar":"ما سيواجهه تقديم هذه التواريخ.","content":{"application/json":{"example":{"overlaps":[{"leave_type":"Annual Leave","start_date":"2026-12-15","end_date":"2026-12-15","status":"approved"}],"balance":{"available_days":18.0,"requested_days":3.0,"allow_negative_balance":false,"exceeded":false},"warning":"Your request overlaps with an existing pending or approved leave request."},"schema":{"$ref":"#/components/schemas/time_off_validation"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The dates cannot be filed.","x-description-ar":"لا يمكن تقديم هذه التواريخ.","x-codes":[{"code":"validation_failed","meaning":"Dates missing or malformed, the policy is not held by the employee, the end is before the start, or the leave ends after the employee's last working day.","x-meaning-ar":"التواريخ ناقصة أو غير صحيحة، أو السياسة غير مسندة إلى الموظف، أو النهاية قبل البداية، أو تنتهي الإجازة بعد آخر يوم عمل للموظف.","x-fix":"Fix what `error` names, then check again.","x-fix-ar":"صحّح ما يذكره `error` ثم أعد الفحص."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"End date must be on or after the start date","code":"validation_failed"}}}}}}},"/employees/{id}/time_off/offboarding":{"get":{"summary":"Preview an employee's leave settlement on leaving","operationId":"time_off.offboarding_preview","tags":["Employee time off"],"description":"Works out, in days, the leave an employee would be paid out if they left on a given last working day:\ncarry-over plus this year's entitlement earned to that day, minus approved leave taken, for each encashable\npolicy (annual leave that is fully paid); other policies are listed under `excluded` with the reason. It\nalso lists the requests that outlive that day and what starting the offboarding does to each: `cancel`\n(starts after it) or `needs_review` (straddles it).\n\nOnce an offboarding has started, the last working day is the one it was started with; once it is\nfinalised, this returns the settlement frozen at that moment. Figures are days, not money: the end-of-service\namount is worked out by the termination package.\n\n**When to use:** before `time_off.start_offboarding`, to show HR the settlement and which leave will be\ncancelled, and afterwards to read where the offboarding stands.\n\n**Prerequisites:** the employee's `id` from `employees.list`. Needs \"View others' time off\".\n\n**Side effects:** none.","x-summary-ar":"معاينة تسوية إجازات موظف عند مغادرته","x-description-ar":"يحسب بالأيام رصيد الإجازات الذي يُصرف للموظف لو غادر في آخر يوم عمل محدد: المرحّل مضافاً إليه استحقاق هذا\nالعام حتى ذلك اليوم، مطروحاً منه الإجازات المعتمدة المأخوذة، لكل سياسة قابلة للصرف النقدي (الإجازة السنوية\nمدفوعة الأجر بالكامل)؛ أما بقية السياسات فتظهر في `excluded` مع السبب. ويذكر أيضاً الطلبات التي تمتد بعد ذلك\nاليوم وما يفعله بدء إنهاء الخدمة بكل منها: `cancel` يبدأ بعده، أو `needs_review` يمتد عبره.\n\nبعد بدء إنهاء الخدمة يكون آخر يوم عمل هو الذي بدأ به، وبعد اعتماده نهائياً يعيد التسوية المجمّدة لحظتها. الأرقام\nأيام لا مبالغ: مبلغ نهاية الخدمة تحسبه حزمة إنهاء الخدمة.\n\n**متى تستخدمه:** قبل `time_off.start_offboarding` لعرض التسوية والإجازات التي ستُلغى على الموارد البشرية، وبعده\nلمعرفة وضع إنهاء الخدمة.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"name":"last_working_day","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"The last working day to work it out for, before an offboarding has started. 30 days from today when omitted; ignored once one has started.","x-description-ar":"آخر يوم عمل يُحسب عليه، قبل بدء إنهاء الخدمة. بعد ٣٠ يوماً من اليوم إن لم يُرسل؛ ويُتجاهل بعد البدء.","example":"2026-12-31"}],"responses":{"200":{"description":"The settlement and the leave it affects.","x-description-ar":"التسوية والإجازات المتأثرة بها.","content":{"application/json":{"example":{"carryover":4.0,"pro_rated":19.2,"used":5.0,"to_encash":18.2,"policies":[{"leave_policy_id":7,"name":"Annual Leave","carryover":4.0,"pro_rated":19.2,"used":5.0,"to_encash":18.2}],"excluded":[{"leave_policy_id":9,"name":"Sick Leave","reason":"category_not_encashable"}],"last_working_day":"2026-12-31","affected_leave_requests":[{"id":5530,"leave_policy_id":7,"leave_type_name":"Annual Leave","start_date":"2027-01-10","end_date":"2027-01-12","balance":3.0,"status":"approved","action":"cancel"}],"cancellation_warning":"Cancelling these leave requests is permanent. Reverting this offboarding will not restore them."},"schema":{"$ref":"#/components/schemas/time_off_offboarding"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Start an employee's offboarding","operationId":"time_off.start_offboarding","tags":["Employee time off"],"description":"Starts an employee's exit: they move to `notice_period` (resigned, still working) until the last working\nday, and the leave they can no longer take is cancelled. Preview it first with `time_off.offboarding_preview`.\n\n**When to use:** when an employee resigns or is let go and HR has their last working day. Finalise on or\nafter that day with `time_off.finalize_offboarding`; undo with `time_off.revert_offboarding`.\n\n**Prerequisites:** the employee's `id` from `employees.list`; they must be `active` and hold no open custody.\nThe token's owner must have an employee record (it is recorded as who started it). Needs \"Manage employee\noffboarding\".\n\n**Side effects:** every pending or approved leave request that starts after the last working day is cancelled\nfor good, with a note; reverting the offboarding does not bring them back. Their attendance leave days are\nremoved, which re-prices unpaid and partly paid leave on payroll runs not yet finalised. Requests that\nstraddle the last day are left for HR to shorten (`needs_review` in the preview). Recorded in the audit log.\nNo one is notified.\n\n**Not offered to Claude:** it changes someone's employment status and cancels their leave permanently.","x-summary-ar":"بدء إنهاء خدمة موظف","x-description-ar":"يبدأ خروج الموظف: ينتقل إلى `notice_period` (استقال وما زال يعمل) حتى آخر يوم عمل، وتُلغى الإجازات التي لم يعد\nيستطيع أخذها. عاينه أولاً عبر `time_off.offboarding_preview`.\n\n**متى تستخدمه:** عند استقالة موظف أو إنهاء خدمته وتحديد آخر يوم عمل له. اعتمده نهائياً في ذلك اليوم أو بعده عبر\n`time_off.finalize_offboarding`، وتراجع عنه عبر `time_off.revert_offboarding`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، ويجب أن يكون `active` وألا تكون لديه عهدة مفتوحة. ويجب أن\nيكون لصاحب الرمز سجل وظيفي (يُسجَّل بوصفه من بدأ الإجراء). يحتاج صلاحية «إدارة إنهاء خدمة الموظفين».\n\n**الآثار الجانبية:** يُلغى نهائياً، مع ملاحظة، كل طلب إجازة معلّق أو معتمد يبدأ بعد آخر يوم عمل؛ والتراجع عن إنهاء\nالخدمة لا يعيده. وتُحذف أيام إجازته من الحضور، ما يعيد تسعير الإجازات غير المدفوعة والمدفوعة جزئياً في مسيرات\nالرواتب غير المعتمدة. أما الطلبات الممتدة عبر آخر يوم فتبقى لتقصّرها الموارد البشرية (`needs_review` في\nالمعاينة). يُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.\n\n**لا يُعرض على Claude:** لأنه يغيّر حالة توظيف الشخص ويلغي إجازاته نهائياً.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"201":{"description":"The employee is now on notice.","x-description-ar":"الموظف الآن في فترة الإشعار.","content":{"application/json":{"example":{"employment_status":"notice_period"},"schema":{"$ref":"#/components/schemas/time_off_employment_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The offboarding cannot start.","x-description-ar":"لا يمكن بدء إنهاء الخدمة.","x-codes":[{"code":"validation_failed","meaning":"The employee is not `active`; the last working day or reason is missing; the day is in the past; or the token's owner has no employee record (\"Initiated by must exist\").","x-meaning-ar":"الموظف ليس `active`، أو آخر يوم عمل أو السبب ناقص، أو اليوم في الماضي، أو ليس لصاحب الرمز سجل وظيفي (\"Initiated by must exist\").","x-fix":"Fix what `error` names.","x-fix-ar":"صحّح ما يذكره `error`."},{"code":"open_custody","meaning":"The employee still holds company custody or owes custody installments.","x-meaning-ar":"ما زالت لدى الموظف عهدة للشركة أو أقساط عهدة مستحقة.","x-fix":"Have the custody returned or settled first, or run a termination package.","x-fix-ar":"استرد العهدة أو سوِّها أولاً، أو أنشئ حزمة إنهاء خدمة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This employee still holds custody or owes custody installments. Return or settle the custody, or run a termination package","error_code":"open_custody","code":"open_custody"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["last_working_day","resign_reason"],"properties":{"last_working_day":{"type":"string","description":"The last working day; today or later.","x-description-ar":"آخر يوم عمل؛ اليوم أو بعده.","format":"date"},"resign_reason":{"type":"string","description":"Why the employee is leaving.","x-description-ar":"سبب مغادرة الموظف."}}},"example":{"last_working_day":"2026-12-31","resign_reason":"Resigned to relocate to Dammam"}}},"required":true,"description":"The exit."}},"patch":{"summary":"Finalise an employee's offboarding","operationId":"time_off.finalize_offboarding","tags":["Employee time off"],"description":"Completes a started offboarding on or after the last working day: the employee becomes `inactive`, loses\ntheir QHR login for this company, and the leave settlement (`time_off.offboarding_preview`) is frozen as it\nstands. It does not pay anything itself; the end-of-service amount is settled by the termination package.\n\n**When to use:** on or after the last working day, once HR has dealt with any `needs_review` requests.\n\n**Prerequisites:** the employee's `id` from `employees.list`, with an offboarding started by\n`time_off.start_offboarding`. Needs \"Manage employee offboarding\".\n\n**Side effects:** employment status, login and the frozen settlement change at once; recorded in the audit\nlog. No one is notified. It cannot be reverted with `time_off.revert_offboarding`.\n\n**Not offered to Claude:** it ends someone's employment and removes their access to QHR.","x-summary-ar":"اعتماد إنهاء خدمة موظف نهائياً","x-description-ar":"يُتم إنهاء خدمة بدأ سابقاً، في آخر يوم عمل أو بعده: يصبح الموظف `inactive` ويفقد دخوله إلى QHR في هذه الشركة،\nوتُجمَّد تسوية الإجازات (`time_off.offboarding_preview`) على حالها. ولا يدفع شيئاً بنفسه؛ فمبلغ نهاية الخدمة\nتسوّيه حزمة إنهاء الخدمة.\n\n**متى تستخدمه:** في آخر يوم عمل أو بعده، بعد أن تعالج الموارد البشرية أي طلبات `needs_review`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، مع إنهاء خدمة بدأ عبر `time_off.start_offboarding`. يحتاج\nصلاحية «إدارة إنهاء خدمة الموظفين».\n\n**الآثار الجانبية:** تتغير حالة التوظيف والدخول والتسوية المجمّدة فوراً، ويُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.\nولا يمكن التراجع عنه عبر `time_off.revert_offboarding`.\n\n**لا يُعرض على Claude:** لأنه ينهي خدمة الشخص ويزيل وصوله إلى QHR.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"200":{"description":"The employee has left.","x-description-ar":"غادر الموظف.","content":{"application/json":{"example":{"employment_status":"inactive"},"schema":{"$ref":"#/components/schemas/time_off_employment_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The offboarding cannot be finalised.","x-description-ar":"لا يمكن اعتماد إنهاء الخدمة نهائياً.","x-codes":[{"code":"validation_failed","meaning":"No offboarding has been started, or the last working day has not come yet.","x-meaning-ar":"لم يبدأ إنهاء خدمة، أو لم يحن آخر يوم عمل بعد.","x-fix":"Start it with `time_off.start_offboarding`, or wait for the last working day.","x-fix-ar":"ابدأه عبر `time_off.start_offboarding`، أو انتظر آخر يوم عمل."},{"code":"open_custody","meaning":"The employee still holds company custody or owes custody installments.","x-meaning-ar":"ما زالت لدى الموظف عهدة للشركة أو أقساط عهدة مستحقة.","x-fix":"Have the custody returned or settled first, or run a termination package.","x-fix-ar":"استرد العهدة أو سوِّها أولاً، أو أنشئ حزمة إنهاء خدمة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Offboarding can only be finalized on or after the last working day.","code":"validation_failed"}}}}}},"delete":{"summary":"Cancel an employee's started offboarding","operationId":"time_off.revert_offboarding","tags":["Employee time off"],"description":"Cancels an offboarding that was started but not finalised: the employee is `active` again and the offboarding\nis marked reverted. The leave requests cancelled when it started stay cancelled; file them again if needed.\n\n**When to use:** when a resignation is withdrawn or an exit was started by mistake. An offboarding created by\na termination package that has gone past draft cannot be undone here; cancel the package instead.\n\n**Prerequisites:** the employee's `id` from `employees.list`, with an offboarding started by\n`time_off.start_offboarding` and not finalised. Needs \"Manage employee offboarding\".\n\n**Side effects:** the employment status changes at once; recorded in the audit log. No one is notified.\n\n**Not offered to Claude:** it changes someone's employment status.","x-summary-ar":"التراجع عن إنهاء خدمة موظف قبل اعتماده","x-description-ar":"يلغي إنهاء خدمة بدأ ولم يُعتمد نهائياً: يعود الموظف `active` ويُعلَّم إنهاء الخدمة بأنه متراجَع عنه. أما طلبات\nالإجازة التي أُلغيت عند البدء فتبقى ملغاة؛ قدّمها من جديد إن لزم.\n\n**متى تستخدمه:** عند سحب استقالة أو بدء خروج بالخطأ. إنهاء الخدمة الذي أنشأته حزمة إنهاء خدمة تجاوزت المسودة لا\nيمكن التراجع عنه هنا؛ ألغِ الحزمة بدلاً من ذلك.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، مع إنهاء خدمة بدأ عبر `time_off.start_offboarding` ولم\nيُعتمد نهائياً. يحتاج صلاحية «إدارة إنهاء خدمة الموظفين».\n\n**الآثار الجانبية:** تتغير حالة التوظيف فوراً ويُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.\n\n**لا يُعرض على Claude:** لأنه يغيّر حالة توظيف الشخص.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"200":{"description":"The employee is active again.","x-description-ar":"عاد الموظف على رأس العمل.","content":{"application/json":{"example":{"employment_status":"active"},"schema":{"$ref":"#/components/schemas/time_off_employment_status"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"There is nothing to revert.","x-description-ar":"لا يوجد ما يُتراجع عنه.","x-codes":[{"code":"validation_failed","meaning":"No started, unfinalised offboarding, or it belongs to a termination package past draft (the message names the package).","x-meaning-ar":"لا يوجد إنهاء خدمة بدأ ولم يُعتمد، أو أنه تابع لحزمة إنهاء خدمة تجاوزت المسودة (وتذكر الرسالة الحزمة).","x-fix":"Check `time_off.offboarding_preview`; for a package, cancel the package.","x-fix-ar":"راجع `time_off.offboarding_preview`؛ وفي حالة الحزمة ألغِ الحزمة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No active offboarding record found","code":"validation_failed"}}}}}}},"/employees/{id}/time_off/policies":{"get":{"summary":"List the leave policies an employee holds or could hold","operationId":"time_off.policies","tags":["Employee time off"],"description":"Returns the company's active leave policies, plus any inactive one the employee still holds, each with its\nstatus for this employee: `assigned` (they hold it), `blocked` (they already hold another policy of the same\nleave category; an employee holds one per category) or `available` (it can be assigned). Assigned first,\nthen blocked, then available, by name. Not paginated.\n\n**When to use:** before `time_off.assign_policy` (pick an `available` one) or `time_off.remove_policy`\n(pick an `assigned` one). For balances use `time_off.balances`.\n\n**Prerequisites:** the employee's `id` from `employees.list`. Needs \"View others' time off\".\n\n**Side effects:** none.","x-summary-ar":"عرض سياسات الإجازة المسندة إلى موظف أو الممكن إسنادها","x-description-ar":"يعرض سياسات الإجازة الفعّالة في الشركة، إضافة إلى أي سياسة معطّلة ما زالت مسندة إلى الموظف، ولكل منها حالتها\nلهذا الموظف: `assigned` مسندة إليه، أو `blocked` لديه سياسة أخرى من فئة الإجازة نفسها (للموظف سياسة واحدة لكل\nفئة)، أو `available` يمكن إسنادها. المسندة أولاً ثم المحجوبة ثم المتاحة، مرتبة بالاسم. بلا صفحات.\n\n**متى تستخدمه:** قبل `time_off.assign_policy` (اختر سياسة `available`) أو `time_off.remove_policy` (اختر\nسياسة `assigned`). للأرصدة استخدم `time_off.balances`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"200":{"description":"Every policy with its status for this employee.","x-description-ar":"كل سياسة مع حالتها لهذا الموظف.","content":{"application/json":{"example":[{"id":7,"name":"Annual Leave","status":"assigned"},{"id":8,"name":"Annual Leave (Senior)","status":"blocked"},{"id":9,"name":"Sick Leave","status":"available"}],"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"status":{"type":"string","description":"`assigned`, `blocked` (another policy of the same category is held) or `available`.","x-description-ar":"`assigned` مسندة، `blocked` محجوبة (لديه سياسة أخرى من الفئة نفسها)، `available` متاحة.","enum":["assigned","blocked","available"]}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Assign a leave policy to an employee","operationId":"time_off.assign_policy","tags":["Employee time off"],"description":"Gives an employee a leave policy, so they can request leave under it. An employee holds one policy per leave\ncategory, so this is refused when they already hold another policy of the same category.\n\nThe first entitlement is granted at once: the full duration for a one-time policy, this year's share counted\nfrom the joining date for a yearly policy, nothing for a `per_event` policy. Re-assigning a policy that was\nremoved brings back its old balance and history instead, with no second grant, and accrual restarts today.\n\n**When to use:** for a new joiner, or when someone moves to a different policy (remove the old one first\nwith `time_off.remove_policy`). Pick an `available` policy from `time_off.policies`.\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.policies`.\nNeeds \"Manage leave policies for employees\".\n\n**Side effects:** the balance and its first statement rows (`assignment`, `accrual`) are created. Recorded in\nthe audit log. No one is notified.\n\n**Not offered to Claude:** it grants paid leave days, which are paid out in cash when the employee leaves.","x-summary-ar":"إسناد سياسة إجازة إلى موظف","x-description-ar":"يسند سياسة إجازة إلى موظف ليتمكن من طلب الإجازة بموجبها. للموظف سياسة واحدة لكل فئة إجازة، لذا يُرفض الإسناد إن\nكانت لديه سياسة أخرى من الفئة نفسها.\n\nيُمنح الاستحقاق الأول فوراً: المدة كاملة للسياسة التي تُمنح مرة واحدة، وحصة هذا العام محسوبة من تاريخ الالتحاق\nللسياسة السنوية، ولا شيء لسياسة `per_event`. وإعادة إسناد سياسة أُزيلت سابقاً تعيد رصيدها وتاريخها القديمين بدلاً\nمن ذلك، دون منح ثانٍ، ويبدأ الاستحقاق من اليوم.\n\n**متى تستخدمه:** لموظف جديد، أو عند نقل شخص إلى سياسة أخرى (أزل القديمة أولاً عبر `time_off.remove_policy`).\nاختر سياسة `available` من `time_off.policies`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.policies`. يحتاج صلاحية\n«إدارة سياسات الإجازة للموظفين».\n\n**الآثار الجانبية:** يُنشأ الرصيد وأولى حركات كشفه (`assignment` و`accrual`). يُسجَّل في سجل التدقيق. لا يُبلَّغ\nأحد.\n\n**لا يُعرض على Claude:** لأنه يمنح أيام إجازة مدفوعة تُصرف نقداً عند مغادرة الموظف.","x-access":"write","x-permission":{"key":"time_off/manage_policy","label":"Manage leave policies for employees","x-label-ar":"إدارة سياسات الإجازات الخاصة بالموظفين"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"}],"responses":{"201":{"description":"Who was assigned.","x-description-ar":"من أُسندت إليه السياسة.","content":{"application/json":{"example":{"assigned":[{"employee_id":1203,"name":"Sara Ahmed","restored":false}],"skipped":[]},"schema":{"type":"object","properties":{"assigned":{"type":"array","description":"The employee, when assigned.","x-description-ar":"الموظف، عند الإسناد.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف."},"restored":{"type":"boolean","description":"True when an earlier assignment and its balance were brought back.","x-description-ar":"صحيح إن أُعيد إسناد سابق مع رصيده."}}}},"skipped":{"type":"array","description":"Always empty here (a skip answers 422).","x-description-ar":"فارغة دائماً هنا (التخطي يُرجع 422).","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The policy cannot be assigned.","x-description-ar":"لا يمكن إسناد السياسة.","x-codes":[{"code":"validation_failed","meaning":"The employee already holds a policy of this leave category.","x-meaning-ar":"لدى الموظف سياسة من فئة الإجازة هذه.","x-fix":"Remove the other policy with `time_off.remove_policy` first, or pick an `available` policy from `time_off.policies`.","x-fix-ar":"أزل السياسة الأخرى أولاً عبر `time_off.remove_policy`، أو اختر سياسة `available` من `time_off.policies`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Already has an active assignment in this leave category","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leave_policy_id"],"properties":{"leave_policy_id":{"type":"integer","description":"The policy, from `time_off.policies` (an `available` one).","x-description-ar":"السياسة، من `time_off.policies` (سياسة `available`)."}}},"example":{"leave_policy_id":9}}},"required":true,"description":"The policy to assign."}}},"/employees/{id}/time_off/policies/{leave_policy_id}":{"delete":{"summary":"Remove a leave policy from an employee","operationId":"time_off.remove_policy","tags":["Employee time off"],"description":"Takes a leave policy away from an employee: it leaves their balance list and they can no longer request\nleave under it. Requests already filed are not touched. The balance and its history are kept (readable with\n`time_off.balance_statement`) and come back if the policy is assigned again.\n\nIt must be confirmed: without `acknowledge_balance_loss=true` nothing changes and the answer is a 422 whose\n`preview` shows the balance the employee would lose sight of. Show it to the person, then send the same\nrequest with `acknowledge_balance_loss=true`.\n\n**When to use:** when someone moves to another policy of the same category, or should no longer have this\nleave. Pick an `assigned` policy from `time_off.policies`.\n\n**Prerequisites:** the employee's `id` from `employees.list`; `leave_policy_id` from `time_off.policies`.\nNeeds \"Manage leave policies for employees\".\n\n**Side effects:** the assignment is removed; recorded in the audit log. No one is notified.\n\n**Not offered to Claude:** the employee loses access to the leave days they hold under this policy.","x-summary-ar":"إزالة سياسة إجازة من موظف","x-description-ar":"يزيل سياسة إجازة من موظف: تختفي من قائمة أرصدته ولا يستطيع طلب إجازة بموجبها. الطلبات المقدمة سابقاً لا تتأثر.\nويُحتفظ بالرصيد وتاريخه (يمكن قراءته عبر `time_off.balance_statement`) ويعودان إن أُسندت السياسة مجدداً.\n\nيجب تأكيد الإزالة: دون `acknowledge_balance_loss=true` لا يتغير شيء ويكون الرد 422 يعرض فيه `preview` الرصيد الذي\nسيختفي عن الموظف. اعرضه على الشخص ثم أرسل الطلب نفسه مع `acknowledge_balance_loss=true`.\n\n**متى تستخدمه:** عند نقل شخص إلى سياسة أخرى من الفئة نفسها، أو حين لم يعد مستحقاً لهذه الإجازة. اختر سياسة\n`assigned` من `time_off.policies`.\n\n**المتطلبات:** رقم `id` الموظف من `employees.list`، و`leave_policy_id` من `time_off.policies`. يحتاج صلاحية\n«إدارة سياسات الإجازة للموظفين».\n\n**الآثار الجانبية:** يُزال الإسناد ويُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.\n\n**لا يُعرض على Claude:** لأن الموظف يفقد الوصول إلى أيام الإجازة التي يملكها في هذه السياسة.","x-access":"write","x-permission":{"key":"time_off/manage_policy","label":"Manage leave policies for employees","x-label-ar":"إدارة سياسات الإجازات الخاصة بالموظفين"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_off_employee_id"},{"$ref":"#/components/parameters/time_off_leave_policy_id"},{"name":"acknowledge_balance_loss","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` confirms the removal. Without it the answer is a 422 with the balance `preview`.","x-description-ar":"`true` يؤكد الإزالة. ودونه يكون الرد 422 مع `preview` الرصيد.","example":true}],"responses":{"200":{"description":"Removed.","x-description-ar":"أُزيلت.","content":{"application/json":{"example":{"message":"Employee unassigned successfully"},"schema":{"type":"object","properties":{"message":{"type":"string","description":"Confirmation, in the requested language.","x-description-ar":"تأكيد بلغة الطلب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"Not confirmed: nothing was removed.","x-description-ar":"لم تُؤكَّد الإزالة: لم يُزل شيء.","x-codes":[{"code":"validation_failed","meaning":"`acknowledge_balance_loss=true` was not sent. `preview` holds the balance the employee would lose sight of (`fiscal_year`, `entitled_days`, `taken_days`, `pending_days`, `available_days`…).","x-meaning-ar":"لم يُرسل `acknowledge_balance_loss=true`. ويحمل `preview` الرصيد الذي سيختفي عن الموظف (`fiscal_year` و`entitled_days` و`taken_days` و`pending_days` و`available_days`…).","x-fix":"Show the preview, then send the same request with `acknowledge_balance_loss=true`.","x-fix-ar":"اعرض المعاينة ثم أرسل الطلب نفسه مع `acknowledge_balance_loss=true`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Un-assigning removes this policy from the employee's balance list. Re-send with acknowledge_balance_loss=true to confirm. The balance itself is kept and is restored if the policy is re-assigned.","code":"validation_failed","preview":{"fiscal_year":2026,"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":2.0,"available_days":18.0}}}}}}}},"/exports":{"get":{"summary":"List my exports","operationId":"exports.list","tags":["Exports"],"description":"Returns the exports the token's owner started from QHR lists, newest first: which list, the format, the\nstatus and progress, and when the file will be deleted. Other people's exports are never shown.\n\n**When to use:** to find an export started in the web app and see whether its file is ready, or\nto see whether a large export is still being built (`status=active`).\n\n**Prerequisites:** none. `page_key` narrows to one list (`employees`, `payslips`, `hr_loans`…).\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض عمليات التصدير الخاصة بي","x-description-ar":"يعرض عمليات التصدير التي بدأها صاحب الرمز من قوائم QHR، الأحدث أولاً: أي قائمة والصيغة والحالة والتقدّم ووقت حذف\nالملف. لا تظهر أبداً عمليات تصدير الآخرين.\n\n**متى تستخدمه:** للعثور على تصدير بدأ من تطبيق الويب ومعرفة هل ملفه جاهز، أو لمعرفة هل ما زال\nتصدير كبير قيد الإعداد (`status=active`).\n\n**المتطلبات:** لا شيء. يحصر `page_key` النتائج في قائمة واحدة (`employees` أو `payslips` أو `hr_loans`…).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-any-of":[{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV"},{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV"}]},"x-feature":"exports","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"page_key","in":"query","required":false,"schema":{"type":"string"},"description":"Only exports of this list, e.g. `payslips`.","x-description-ar":"تصدير هذه القائمة فقط، مثل `payslips`.","example":"payslips"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active"]},"description":"`active`: only exports still queued or being built.","x-description-ar":"`active`: التصدير الذي ما زال بالانتظار أو قيد الإعداد فقط.","example":"active"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of your exports.","x-description-ar":"صفحة من عمليات التصدير الخاصة بك.","content":{"application/json":{"example":{"records":[{"id":318,"page":"payslips","format":"xlsx","status":"ready","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/data_export"},"description":"Your exports, newest first.","x-description-ar":"عمليات تصديرك، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/exports/{id}":{"get":{"summary":"Get one of my exports","operationId":"exports.show","tags":["Exports"],"description":"Returns one of the token owner's exports: status, rows written so far, and when the file is ready and when\nit will be deleted.\n\n**When to use:** to poll a background export until `status` is `ready`, then download it with `exports.download`.\n\n**Prerequisites:** the export `id` from `exports.list`. Another person's export answers 404. If the owner\nhas since lost the permission to see that list (or its export key), the answer is 403.\n\n**Side effects:** none.","x-summary-ar":"عرض أحد عمليات التصدير الخاصة بي","x-description-ar":"يعرض أحد عمليات تصدير صاحب الرمز: الحالة والصفوف المكتوبة حتى الآن ووقت جاهزية الملف ووقت حذفه.\n\n**متى تستخدمه:** لمتابعة تصدير في الخلفية حتى تصبح `status` بقيمة `ready`، ثم تنزيله عبر `exports.download`.\n\n**المتطلبات:** رقم `id` التصدير من `exports.list`. تصدير شخص آخر يُرجع 404. وإن فقد صاحب الرمز منذ ذلك الحين\nصلاحية رؤية تلك القائمة (أو مفتاح تصديرها) يكون الرد 403.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-any-of":[{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV"},{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV"}]},"x-feature":"exports","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/data_export_id"}],"responses":{"200":{"description":"The export.","x-description-ar":"التصدير.","content":{"application/json":{"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"ready","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}},"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"description":"The owner may not see this export.","x-description-ar":"لا يحق لصاحب الرمز رؤية هذا التصدير.","x-codes":[{"code":"forbidden","meaning":"The owner's role holds neither export permission, or can no longer see this export's list: its export key, the list permission, the company feature, an employee record for a team list, or a column or filter saved on the export was lost since it was made.","x-meaning-ar":"دور صاحب الرمز لا يملك أياً من صلاحيتي التصدير، أو لم يعد يرى قائمة هذا التصدير: فقد منذ إنشائه مفتاح تصديرها أو صلاحية القائمة أو ميزة الشركة أو سجل الموظف لقائمة الفريق أو عموداً أو مرشحاً محفوظاً في التصدير.","x-fix":"Ask an admin to grant the list and export permissions again (`x-permission`).","x-fix-ar":"اطلب من مسؤول النظام إعادة منح صلاحيتي القائمة والتصدير (`x-permission`)."},{"code":"employee_inactive","meaning":"The token owner's employee record is not active.","x-meaning-ar":"سجل صاحب الرمز الوظيفي غير نشط.","x-fix":"HR must reactivate the employee record.","x-fix-ar":"يجب أن تعيد الموارد البشرية تفعيل السجل الوظيفي."},{"code":"tenant_access_revoked","meaning":"The token's owner is no longer an active member of this company. Rare: removing a member normally revokes their tokens, which answers 401 `token_revoked` instead.","x-meaning-ar":"صاحب الرمز لم يعد عضواً نشطاً في هذه الشركة. نادر الحدوث: فإزالة العضو تُلغي رموزه عادةً، فتكون الإجابة 401 بالرمز `token_revoked` بدلاً من ذلك.","x-fix":"The owner must be re-invited to the company, then create a new token. If the owner is still a member, contact QHR support.","x-fix-ar":"يجب إعادة دعوة صاحب الرمز إلى الشركة ثم إنشاء رمز جديد. وإن كان لا يزال عضواً فتواصل مع دعم QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You do not have permission to perform this action","code":"forbidden"}}}},"404":{"$ref":"#/components/responses/not_found"}}}},"/exports/{id}/download":{"get":{"summary":"Download the file of one of my exports","operationId":"exports.download","tags":["Exports"],"description":"Answers with a redirect (302) to the export's file. The `Location` header is a signed link to the file\nthat works for five minutes and saves it under its QHR name (`QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.xlsx`).\n\n**When to use:** once `exports.show` says `status: ready`, typically for a large export that was built in\nthe background (202 from a list's `…export` operation).\n\n**Prerequisites:** the export `id` from `exports.list` or from the 202 answer. Only the owner's own exports;\nthe owner must still be allowed to see that list. Files are kept for 7 days.\n\n**Side effects:** the first download marks the export `downloaded`. Returns a file, so it is not offered to\nClaude.","x-summary-ar":"تنزيل ملف أحد عمليات التصدير الخاصة بي","x-description-ar":"يجيب بإعادة توجيه (302) إلى ملف التصدير. ترويسة `Location` رابط موقّع إلى الملف يعمل خمس دقائق ويحفظه\nباسمه في QHR (`QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.xlsx`).\n\n**متى تستخدمه:** بعد أن تعرض `exports.show` القيمة `status: ready`، وغالباً لتصدير كبير أُنشئ في الخلفية\n(202 من عملية `…export` لإحدى القوائم).\n\n**المتطلبات:** رقم `id` التصدير من `exports.list` أو من رد 202. تصديرات صاحب الرمز فقط، ويجب أن يظل مسموحاً له\nبرؤية تلك القائمة. تُحفظ الملفات ٧ أيام.\n\n**الآثار الجانبية:** أول تنزيل يعلّم التصدير بالحالة `downloaded`. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-any-of":[{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV"},{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV"}]},"x-feature":"exports","x-mcp":false,"x-file-download":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/data_export_id"}],"responses":{"302":{"description":"A redirect to the file.","x-description-ar":"إعادة توجيه إلى الملف.","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"Signed, five-minute link to the file.","x-description-ar":"رابط موقّع إلى الملف صالح خمس دقائق."}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"410":{"description":"The file was deleted.","x-description-ar":"حُذف الملف.","x-codes":[{"code":"expired","meaning":"Files are kept for 7 days; this one is gone.","x-meaning-ar":"تُحفظ الملفات ٧ أيام، وهذا الملف حُذف.","x-fix":"Run the list's `…export` operation again.","x-fix-ar":"شغّل عملية `…export` للقائمة مرة أخرى."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This file has been deleted after 7 days. Export again from the page.","code":"expired","error_code":"expired"}}}}}}},"/gosi/compliance_summary":{"get":{"summary":"Check the establishment's wage-protection compliance","operationId":"gosi.compliance_summary","tags":["GOSI"],"description":"Asks GOSI whether the establishment complied with the Wage Protection System (Mudad) in each of the last\n`months` months (1–12, 3 by default), with the establishment's name as GOSI holds it.\n\n**When to use:** \"are we WPS-compliant?\", before a Mudad deadline or a government service that requires\ncompliance.\n\n**Prerequisites:** the company is connected to GOSI (`gosi.settings`).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"فحص التزام المنشأة بحماية الأجور","x-description-ar":"يسأل التأمينات هل التزمت المنشأة بنظام حماية الأجور (مدد) في كل شهر من آخر `months` شهراً (١–١٢، و٣\nافتراضياً)، مع اسم المنشأة كما لدى التأمينات.\n\n**متى تستخدمه:** «هل نحن ملتزمون بحماية الأجور؟»، قبل موعد مدد أو خدمة حكومية تشترط الالتزام.\n\n**المتطلبات:** أن تكون الشركة مربوطة بالتأمينات (`gosi.settings`).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/view_compliance","label":"View WPS compliance summary","x-label-ar":"عرض ملخص الالتزام بحماية الأجور"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"months","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":12},"description":"How many recent months, 1–12. 3 when omitted or out of range.","x-description-ar":"عدد الأشهر الأخيرة، ١–١٢. ثلاثة إن لم يُرسل أو كان خارج المدى.","example":3}],"responses":{"200":{"description":"Compliance by month.","x-description-ar":"الالتزام حسب الشهر.","content":{"application/json":{"example":{"establishment_name":"Acme Trading Co.","periods":[{"period":"2026-10","compliant":true},{"period":"2026-09","compliant":true},{"period":"2026-08","compliant":false}]},"schema":{"$ref":"#/components/schemas/gosi_compliance_summary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the company is not connected to GOSI (see `gosi.settings`), or GOSI has no record for its establishment. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: الشركة غير مربوطة بالتأمينات (انظر `gosi.settings`)، أو لا يوجد لدى التأمينات سجل لمنشأتها. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Connect GOSI with `gosi.update_settings` and wait for approval, or check the unified number. If GOSI is unavailable, try again later.","x-fix-ar":"اربط التأمينات عبر `gosi.update_settings` وانتظر الموافقة، أو تحقق من الرقم الموحد. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"GOSI is not connected. Add your establishment's unified number in the GOSI settings first.","code":"validation_failed"}}}}}}},"/gosi/contributor_info":{"get":{"summary":"Look up a national ID's GOSI record","operationId":"gosi.contributor_info","tags":["GOSI"],"description":"Asks GOSI where the holder of a national ID or Iqama number is registered: each establishment, the job\ntitle and the full registered wage.\n\n**When to use:** to check a candidate's current registration before hiring, or a person who is not an\nemployee yet. For an existing employee use `gosi.employee_contributor_info`.\n\n**Prerequisites:** a national ID (starts with 1) or Iqama number (starts with 2), 10 digits. GOSI does not\nneed to be connected.\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`.\nNot offered to Claude: looks up any national ID / Iqama against GOSI (Masdr) and consumes the company's GOSI quota.","x-summary-ar":"البحث عن سجل هوية لدى التأمينات","x-description-ar":"يسأل التأمينات أين يُسجَّل صاحب رقم الهوية الوطنية أو الإقامة: كل منشأة والمسمى الوظيفي والأجر الكامل المسجل.\n\n**متى تستخدمه:** للتحقق من تسجيل مرشح قبل توظيفه، أو لشخص ليس موظفاً بعد. للموظف الحالي استخدم\n`gosi.employee_contributor_info`.\n\n**المتطلبات:** رقم هوية وطنية (يبدأ بـ 1) أو إقامة (يبدأ بـ 2) من ١٠ أرقام. لا يلزم ربط التأمينات.\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`.\nلا يُعرض على Claude: يبحث عن أي رقم هوية أو إقامة في التأمينات الاجتماعية (مصدر) ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/lookup_contributors","label":"Look up GOSI records for onboarding","x-label-ar":"الاستعلام عن سجلات التأمينات عند التوظيف"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"national_id","in":"query","required":true,"schema":{"type":"string","pattern":"^[12][0-9]{9}$"},"description":"National ID or Iqama number, 10 digits.","x-description-ar":"رقم الهوية أو الإقامة، ١٠ أرقام.","example":"1012345678"}],"responses":{"200":{"description":"The person's GOSI registrations.","x-description-ar":"تسجيلات الشخص لدى التأمينات.","content":{"application/json":{"example":{"contributor_info":[{"establishment_name_ar":"شركة أكمي التجارية","establishment_name_en":"Acme Trading Co.","job_title_ar":"محاسب","job_title_en":"Accountant","full_wage":11250}]},"schema":{"$ref":"#/components/schemas/gosi_contributor_info"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not 10 digits starting with 1 or 2, or GOSI has no contributor record for it. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية ليس ١٠ أرقام تبدأ بـ 1 أو 2، أو لا يوجد لدى التأمينات سجل مشترك له. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Check the number. If GOSI is unavailable, try again later.","x-fix-ar":"تحقق من الرقم. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"GOSI validation is currently unavailable. Please try again later.","code":"validation_failed"}}}}}}},"/gosi/employees/me/contributor_info":{"get":{"summary":"Look up my GOSI record","operationId":"gosi.my_employee_contributor_info","tags":["GOSI"],"description":"Asks GOSI where the token owner is registered with GOSI — each establishment, the registered job title and full wage.\n\n**When to use:** for an employee checking their own record. HR checking someone else uses\n`gosi.employee_contributor_info`.\n\n**Prerequisites:** the token's owner must be an employee; the employee's national ID on their record; GOSI does not need to be connected.\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"البحث عن سجلي لدى التأمينات","x-description-ar":"يسأل التأمينات أين يُسجَّل صاحب الرمز لدى التأمينات — كل منشأة والمسمى المسجل والأجر الكامل.\n\n**متى تستخدمه:** عندما يتحقق الموظف من سجله بنفسه. أما فحص الموارد البشرية لموظف آخر فعبر\n`gosi.employee_contributor_info`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً، ورقم هوية الموظف في سجله؛ لا يلزم ربط التأمينات.\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/validate_own","label":"View own GOSI data","x-label-ar":"عرض بيانات التأمينات الاجتماعية الخاصة بي"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"contributor_info":[{"establishment_name_ar":"شركة أكمي التجارية","establishment_name_en":"Acme Trading Co.","job_title_ar":"محاسب","job_title_en":"Accountant","full_wage":11250}]},"schema":{"$ref":"#/components/schemas/gosi_contributor_info"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer, or the owner is not an employee.","x-description-ar":"تعذّر الرد من التأمينات، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not 10 digits starting with 1 or 2, or GOSI has no contributor record for it. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية ليس ١٠ أرقام تبدأ بـ 1 أو 2، أو لا يوجد لدى التأمينات سجل مشترك له. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Correct the national ID (on the employee: `employees.update`). If GOSI is unavailable, try again later.","x-fix-ar":"صحّح رقم الهوية (للموظف: `employees.update`). وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The employee's national ID must be a 10-digit number starting with 1 or 2.","code":"validation_failed"}}}}}}},"/gosi/employees/{employee_id}/contributor_info":{"get":{"summary":"Look up an employee's GOSI record","operationId":"gosi.employee_contributor_info","tags":["GOSI"],"description":"Asks GOSI where the employee is registered with GOSI — each establishment, the registered job title and full wage.\n\n**When to use:** to check that an employee is registered under this establishment with the right job title and wage. For the token owner's own record use `gosi.my_employee_contributor_info`.\n\n**Prerequisites:** `employee_id` from `employees.list`; the employee's national ID on their record; GOSI does not need to be connected. Only employees the caller may see\ncan be checked (others answer 404).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"البحث عن سجل موظف لدى التأمينات","x-description-ar":"يسأل التأمينات أين يُسجَّل الموظف لدى التأمينات — كل منشأة والمسمى المسجل والأجر الكامل.\n\n**متى تستخدمه:** للتحقق من تسجيل الموظف على هذه المنشأة بالمسمى والأجر الصحيحين. لسجل صاحب الرمز نفسه استخدم `gosi.my_employee_contributor_info`.\n\n**المتطلبات:** `employee_id` من `employees.list`، ورقم هوية الموظف في سجله؛ لا يلزم ربط التأمينات. لا يُفحص إلا الموظفون الذين يراهم\nالمستدعي (وغيرهم يُرجع 404).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/lookup_contributors","label":"Look up GOSI records for onboarding","x-label-ar":"الاستعلام عن سجلات التأمينات عند التوظيف"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/gosi_employee_id"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"contributor_info":[{"establishment_name_ar":"شركة أكمي التجارية","establishment_name_en":"Acme Trading Co.","job_title_ar":"محاسب","job_title_en":"Accountant","full_wage":11250}]},"schema":{"$ref":"#/components/schemas/gosi_contributor_info"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not 10 digits starting with 1 or 2, or GOSI has no contributor record for it. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية ليس ١٠ أرقام تبدأ بـ 1 أو 2، أو لا يوجد لدى التأمينات سجل مشترك له. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Correct the national ID (on the employee: `employees.update`). If GOSI is unavailable, try again later.","x-fix-ar":"صحّح رقم الهوية (للموظف: `employees.update`). وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The employee's national ID must be a 10-digit number starting with 1 or 2.","code":"validation_failed"}}}}}}},"/gosi/employment_validations/me":{"get":{"summary":"Check my employment with GOSI","operationId":"gosi.my_employment_validation","tags":["GOSI"],"description":"Asks GOSI whether GOSI shows the token owner as actively employed by this establishment.\n\n**When to use:** for an employee checking their own record. HR checking someone else uses\n`gosi.employment_validation`.\n\n**Prerequisites:** the token's owner must be an employee; the company connected to GOSI (`gosi.settings`) and the employee's national ID on their record.\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"التحقق من علاقة عملي لدى التأمينات","x-description-ar":"يسأل التأمينات هل تُظهر التأمينات صاحب الرمز على رأس العمل لدى هذه المنشأة.\n\n**متى تستخدمه:** عندما يتحقق الموظف من سجله بنفسه. أما فحص الموارد البشرية لموظف آخر فعبر\n`gosi.employment_validation`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً، وأن تكون الشركة مربوطة بالتأمينات (`gosi.settings`) وأن يكون رقم هوية الموظف في سجله.\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/validate_own","label":"View own GOSI data","x-label-ar":"عرض بيانات التأمينات الاجتماعية الخاصة بي"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"employee_active":true},"schema":{"$ref":"#/components/schemas/gosi_employment_validation"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer, or the owner is not an employee.","x-description-ar":"تعذّر الرد من التأمينات، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the company is not connected to GOSI, the national ID is not valid, or GOSI finds no active or several establishments for the unified number. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: الشركة غير مربوطة بالتأمينات، أو رقم الهوية غير صحيح، أو لم تجد التأمينات منشأة نشطة أو وجدت عدة منشآت للرقم الموحد. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Connect GOSI with `gosi.update_settings` and wait for approval, or check the unified number. If GOSI is unavailable, try again later.","x-fix-ar":"اربط التأمينات عبر `gosi.update_settings` وانتظر الموافقة، أو تحقق من الرقم الموحد. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"GOSI is not connected. Add your establishment's unified number in the GOSI settings first.","code":"validation_failed"}}}}}}},"/gosi/employment_validations/{employee_id}":{"get":{"summary":"Check an employee's employment with GOSI","operationId":"gosi.employment_validation","tags":["GOSI"],"description":"Asks GOSI whether GOSI shows the employee as actively employed by this establishment.\n\n**When to use:** after hiring, to confirm the employee was registered, or before offboarding. For the token owner's own record use `gosi.my_employment_validation`.\n\n**Prerequisites:** `employee_id` from `employees.list`; the company connected to GOSI (`gosi.settings`) and the employee's national ID on their record. Only employees the caller may see\ncan be checked (others answer 404).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"التحقق من علاقة عمل موظف لدى التأمينات","x-description-ar":"يسأل التأمينات هل تُظهر التأمينات الموظف على رأس العمل لدى هذه المنشأة.\n\n**متى تستخدمه:** بعد التوظيف للتأكد من تسجيل الموظف، أو قبل إنهاء خدمته. لسجل صاحب الرمز نفسه استخدم `gosi.my_employment_validation`.\n\n**المتطلبات:** `employee_id` من `employees.list`، وأن تكون الشركة مربوطة بالتأمينات (`gosi.settings`) وأن يكون رقم هوية الموظف في سجله. لا يُفحص إلا الموظفون الذين يراهم\nالمستدعي (وغيرهم يُرجع 404).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/validate_employment","label":"Validate employment with GOSI","x-label-ar":"التحقق من التوظيف في التأمينات الاجتماعية"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/gosi_employee_id"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"employee_active":true},"schema":{"$ref":"#/components/schemas/gosi_employment_validation"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the company is not connected to GOSI, the national ID is not valid, or GOSI finds no active or several establishments for the unified number. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: الشركة غير مربوطة بالتأمينات، أو رقم الهوية غير صحيح، أو لم تجد التأمينات منشأة نشطة أو وجدت عدة منشآت للرقم الموحد. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Connect GOSI with `gosi.update_settings` and wait for approval, or check the unified number. If GOSI is unavailable, try again later.","x-fix-ar":"اربط التأمينات عبر `gosi.update_settings` وانتظر الموافقة، أو تحقق من الرقم الموحد. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"GOSI is not connected. Add your establishment's unified number in the GOSI settings first.","code":"validation_failed"}}}}}}},"/gosi/establishment_breakdown":{"get":{"summary":"Get the establishment's GOSI head count and wages","operationId":"gosi.establishment_breakdown","tags":["GOSI"],"description":"Returns what GOSI holds for the establishment: registered employees (Saudis by gender, non-Saudis), their\nregistered wages, and compliance by period.\n\n**When to use:** to compare GOSI's head count and wage bill with QHR's (Saudisation, reconciling who is\nregistered).\n\n**Prerequisites:** the company is connected to GOSI (`gosi.settings`).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"عرض عدد موظفي المنشأة وأجورهم لدى التأمينات","x-description-ar":"يعرض ما لدى التأمينات عن المنشأة: الموظفون المسجلون (السعوديون حسب الجنس، وغير السعوديين) وأجورهم المسجلة،\nوالالتزام حسب الفترة.\n\n**متى تستخدمه:** لمقارنة عدد الموظفين ومجموع الأجور لدى التأمينات بما في QHR (التوطين، ومطابقة المسجلين).\n\n**المتطلبات:** أن تكون الشركة مربوطة بالتأمينات (`gosi.settings`).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/view_breakdown","label":"View establishment breakdown","x-label-ar":"عرض تفاصيل المنشأة"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The breakdown.","x-description-ar":"التوزيع.","content":{"application/json":{"example":{"wage":{"total":412000,"saudis":251000,"non_saudis":161000},"employees":{"total":42,"saudis":{"total":18,"male":11,"female":7},"non_saudis":{"total":24}},"compliance_records":[{"period":"2026-10","compliant":true,"compliance_percentage":100}]},"schema":{"$ref":"#/components/schemas/gosi_establishment_breakdown"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the company is not connected to GOSI (see `gosi.settings`), or GOSI has no record for its establishment. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: الشركة غير مربوطة بالتأمينات (انظر `gosi.settings`)، أو لا يوجد لدى التأمينات سجل لمنشأتها. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Connect GOSI with `gosi.update_settings` and wait for approval, or check the unified number. If GOSI is unavailable, try again later.","x-fix-ar":"اربط التأمينات عبر `gosi.update_settings` وانتظر الموافقة، أو تحقق من الرقم الموحد. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No GOSI records found for this establishment.","code":"validation_failed"}}}}}}},"/gosi/iban_verifications/me":{"get":{"summary":"Verify my IBAN","operationId":"gosi.my_iban_verification","tags":["GOSI"],"description":"Asks GOSI whether the IBAN on the token owner's bank details belongs to their national ID, with the bank and account status.\n\n**When to use:** for an employee checking their own record. HR checking someone else uses\n`gosi.iban_verification`.\n\n**Prerequisites:** the token's owner must be an employee; the employee's national ID and an IBAN on their bank details (`employees.update`, `employment_detail.iban`).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"التحقق من الآيبان الخاص بي","x-description-ar":"يسأل التأمينات هل الآيبان في بيانات صاحب الرمز البنكية يعود لهويته، مع البنك وحالة الحساب.\n\n**متى تستخدمه:** عندما يتحقق الموظف من سجله بنفسه. أما فحص الموارد البشرية لموظف آخر فعبر\n`gosi.iban_verification`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً، ورقم هوية الموظف وآيبان في بياناته البنكية (`employees.update`، `employment_detail.iban`).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/validate_own","label":"View own GOSI data","x-label-ar":"عرض بيانات التأمينات الاجتماعية الخاصة بي"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"iban_valid":true,"account_status":"Active","bank_name_ar":"مصرف الراجحي","bank_name_en":"Al Rajhi Bank","failure_code":null},"schema":{"$ref":"#/components/schemas/gosi_iban_verification"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer, or the owner is not an employee.","x-description-ar":"تعذّر الرد من التأمينات، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not valid, the employee has no IBAN, or the IBAN format is invalid. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية غير صحيح، أو ليس للموظف آيبان، أو صيغة الآيبان غير صحيحة. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Add or correct the IBAN with `employees.update`. If GOSI is unavailable, try again later.","x-fix-ar":"أضف الآيبان أو صحّحه عبر `employees.update`. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The employee has no IBAN recorded in their bank details.","code":"validation_failed"}}}}}}},"/gosi/iban_verifications/{employee_id}":{"get":{"summary":"Verify an employee's IBAN","operationId":"gosi.iban_verification","tags":["GOSI"],"description":"Asks GOSI whether the IBAN on the employee's bank details belongs to their national ID, with the bank and account status.\n\n**When to use:** before the first salary transfer or after a bank change, to avoid a rejected WPS payment. For the token owner's own record use `gosi.my_iban_verification`.\n\n**Prerequisites:** `employee_id` from `employees.list`; the employee's national ID and an IBAN on their bank details (`employees.update`, `employment_detail.iban`). Only employees the caller may see\ncan be checked (others answer 404).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"التحقق من آيبان موظف","x-description-ar":"يسأل التأمينات هل الآيبان في بيانات الموظف البنكية يعود لهويته، مع البنك وحالة الحساب.\n\n**متى تستخدمه:** قبل أول تحويل للراتب أو بعد تغيير البنك، لتجنب رفض الدفعة في حماية الأجور. لسجل صاحب الرمز نفسه استخدم `gosi.my_iban_verification`.\n\n**المتطلبات:** `employee_id` من `employees.list`، ورقم هوية الموظف وآيبان في بياناته البنكية (`employees.update`، `employment_detail.iban`). لا يُفحص إلا الموظفون الذين يراهم\nالمستدعي (وغيرهم يُرجع 404).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/verify_iban","label":"Verify employee IBANs","x-label-ar":"التحقق من الآيبان البنكي للموظفين"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/gosi_employee_id"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"iban_valid":true,"account_status":"Active","bank_name_ar":"مصرف الراجحي","bank_name_en":"Al Rajhi Bank","failure_code":null},"schema":{"$ref":"#/components/schemas/gosi_iban_verification"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not valid, the employee has no IBAN, or the IBAN format is invalid. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية غير صحيح، أو ليس للموظف آيبان، أو صيغة الآيبان غير صحيحة. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Add or correct the IBAN with `employees.update`. If GOSI is unavailable, try again later.","x-fix-ar":"أضف الآيبان أو صحّحه عبر `employees.update`. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The employee has no IBAN recorded in their bank details.","code":"validation_failed"}}}}}}},"/gosi/settings":{"get":{"summary":"Get the company's GOSI connection","operationId":"gosi.settings","tags":["GOSI"],"description":"Returns whether the company is connected to GOSI and with which establishment unified number, or whether\na number is waiting for Qoyod to verify that the company owns it, or why the last one was rejected.\n\n**When to use:** before any GOSI check: the establishment-level checks (compliance, breakdown, employment\nvalidation) need `gosi_connected: true`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Does not call GOSI.","x-summary-ar":"عرض ربط الشركة بالتأمينات الاجتماعية","x-description-ar":"يعرض هل الشركة مربوطة بالتأمينات الاجتماعية وبأي رقم موحد للمنشأة، أو هل هناك رقم بانتظار تحقق قيود من\nملكية الشركة له، أو سبب رفض آخر طلب.\n\n**متى تستخدمه:** قبل أي فحص لدى التأمينات: تحتاج فحوصات المنشأة (الالتزام، التوزيع، التحقق من علاقة العمل)\nإلى `gosi_connected: true`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. لا يستدعي التأمينات.","x-access":"read","x-permission":{"key":"gosi/view_settings","label":"View GOSI connection","x-label-ar":"عرض إعدادات الربط مع التأمينات الاجتماعية"},"x-feature":"gosi","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The connection.","x-description-ar":"الربط.","content":{"application/json":{"example":{"gosi_unified_id":"7011111111","gosi_connected":true,"connection_status":"approved","pending_unified_id":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/gosi_settings"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"patch":{"summary":"Submit or remove the GOSI unified number","operationId":"gosi.update_settings","tags":["GOSI"],"description":"Submits the establishment's GOSI unified number (10 digits starting with 70) for Qoyod to verify that the\ncompany owns it, or, sent blank, disconnects GOSI at once. Submitting a number does not connect it: the\nstatus becomes `pending`, the current connection is dropped, and the checks stop until Qoyod approves.\nCorrecting a pending number amends the same request.\n\n**When to use:** when the company first connects GOSI, changes establishment, or stops using GOSI checks.\n\n**Prerequisites:** the unified number from the GOSI portal. Read the current state with `gosi.settings`.\n\n**Side effects:** drops the current connection, so every GOSI check answers \"not connected\" until approval;\nQHR looks the number up in GOSI once to show the reviewer the establishment name. Recorded in the audit\nlog. Not offered to Claude: it decides which establishment's government data the company can read.","x-summary-ar":"إرسال الرقم الموحد للتأمينات أو إزالته","x-description-ar":"يرسل الرقم الموحد للمنشأة لدى التأمينات (١٠ أرقام تبدأ بـ 70) لتتحقق قيود من ملكية الشركة له، أو يفصل الربط\nفوراً إذا أُرسل فارغاً. إرسال الرقم لا يربطه: تصبح الحالة `pending` ويُلغى الربط الحالي وتتوقف الفحوصات حتى\nتوافق قيود. تصحيح رقم معلّق يعدّل الطلب نفسه.\n\n**متى تستخدمه:** عند ربط الشركة بالتأمينات أول مرة، أو تغيير المنشأة، أو التوقف عن استخدام فحوصات التأمينات.\n\n**المتطلبات:** الرقم الموحد من بوابة التأمينات. اقرأ الحالة الحالية عبر `gosi.settings`.\n\n**الآثار الجانبية:** يُلغى الربط الحالي فتُرجع كل فحوصات التأمينات «غير مربوط» حتى الموافقة، ويبحث QHR عن\nالرقم لدى التأمينات مرة واحدة ليعرض اسم المنشأة على المراجع. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيحدد بيانات أي منشأة حكومية تستطيع الشركة قراءتها.","x-access":"write","x-permission":{"key":"gosi/manage_settings","label":"Manage GOSI connection","x-label-ar":"إدارة الربط مع التأمينات الاجتماعية"},"x-feature":"gosi","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The connection after the change.","x-description-ar":"الربط بعد التغيير.","content":{"application/json":{"example":{"gosi_unified_id":null,"gosi_connected":false,"connection_status":"pending","pending_unified_id":"7011111111","rejection_reason":null},"schema":{"$ref":"#/components/schemas/gosi_settings"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The number was refused.","x-description-ar":"رُفض الرقم.","x-codes":[{"code":"validation_failed","meaning":"The unified number is not 10 digits starting with 70.","x-meaning-ar":"الرقم الموحد ليس ١٠ أرقام تبدأ بـ 70.","x-fix":"Copy the establishment's unified number from the GOSI portal.","x-fix-ar":"انسخ الرقم الموحد للمنشأة من بوابة التأمينات."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The GOSI unified number must be 10 digits starting with 70.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["gosi_setting"],"properties":{"gosi_setting":{"type":"object","description":"The setting.","x-description-ar":"الإعداد.","properties":{"gosi_unified_id":{"type":"string","description":"Unified number, 10 digits starting with 70; empty to disconnect.","x-description-ar":"الرقم الموحد، ١٠ أرقام تبدأ بـ 70؛ فارغ لفصل الربط.","nullable":true}}}}},"example":{"gosi_setting":{"gosi_unified_id":"7011111111"}}}},"required":true,"description":"The unified number, or blank to disconnect."}}},"/gosi/wage_verifications/me":{"get":{"summary":"Check my wage against GOSI","operationId":"gosi.my_wage_verification","tags":["GOSI"],"description":"Asks GOSI whether the token owner's basic salary in QHR matches the wage registered with GOSI.\n\n**When to use:** for an employee checking their own record. HR checking someone else uses\n`gosi.wage_verification`.\n\n**Prerequisites:** the token's owner must be an employee; the employee's national ID and an active fixed monthly salary above zero (`salaries.active`).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"مطابقة أجري مع التأمينات","x-description-ar":"يسأل التأمينات هل يطابق الراتب الأساسي للموظف في QHR الأجر المسجل لدى التأمينات.\n\n**متى تستخدمه:** عندما يتحقق الموظف من سجله بنفسه. أما فحص الموارد البشرية لموظف آخر فعبر\n`gosi.wage_verification`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً، ورقم هوية الموظف وراتب شهري ثابت نشط أكبر من صفر (`salaries.active`).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/validate_own","label":"View own GOSI data","x-label-ar":"عرض بيانات التأمينات الاجتماعية الخاصة بي"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"wage_valid":true,"wage":"9000"},"schema":{"$ref":"#/components/schemas/gosi_wage_verification"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"GOSI could not answer, or the owner is not an employee.","x-description-ar":"تعذّر الرد من التأمينات، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not valid, or the employee has no fixed monthly basic salary. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية غير صحيح، أو ليس للموظف راتب أساسي شهري ثابت. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Give the employee a fixed monthly salary (`salaries.create`) or correct the ID. If GOSI is unavailable, try again later.","x-fix-ar":"أضف للموظف راتباً شهرياً ثابتاً (`salaries.create`) أو صحّح الهوية. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Wage verification requires a fixed monthly basic salary on the employee record.","code":"validation_failed"}}}}}}},"/gosi/wage_verifications/{employee_id}":{"get":{"summary":"Check an employee's wage against GOSI","operationId":"gosi.wage_verification","tags":["GOSI"],"description":"Asks GOSI whether the employee's basic salary in QHR matches the wage registered with GOSI.\n\n**When to use:** after a salary change, to see whether GOSI must be updated (contributions follow the registered wage). For the token owner's own record use `gosi.my_wage_verification`.\n\n**Prerequisites:** `employee_id` from `employees.list`; the employee's national ID and an active fixed monthly salary above zero (`salaries.active`). Only employees the caller may see\ncan be checked (others answer 404).\n\n**Side effects:** Each check writes one row in QHR's GOSI audit trail; nothing else changes. GOSI is called live through Masdr and its answer is not stored. Every call uses up part of the company's GOSI quota, an hourly limit shared by all GOSI checks; above it the answer is 429 `rate_limited`. Not offered to Claude: calls GOSI (Masdr) live and consumes the company's GOSI quota.","x-summary-ar":"مطابقة أجر موظف مع التأمينات","x-description-ar":"يسأل التأمينات هل يطابق الراتب الأساسي للموظف في QHR الأجر المسجل لدى التأمينات.\n\n**متى تستخدمه:** بعد تغيير الراتب، لمعرفة هل يلزم تحديث التأمينات (الاشتراكات تتبع الأجر المسجل). لسجل صاحب الرمز نفسه استخدم `gosi.my_wage_verification`.\n\n**المتطلبات:** `employee_id` من `employees.list`، ورقم هوية الموظف وراتب شهري ثابت نشط أكبر من صفر (`salaries.active`). لا يُفحص إلا الموظفون الذين يراهم\nالمستدعي (وغيرهم يُرجع 404).\n\n**الآثار الجانبية:** يكتب كل فحص صفاً واحداً في سجل فحوصات التأمينات في QHR، ولا يتغير شيء آخر. تُستدعى التأمينات مباشرة عبر منصة مصدر ولا يُحفظ ردها. كل استدعاء يستهلك جزءاً من حصة الشركة من طلبات التأمينات، وهي حد بالساعة تتشاركه كل فحوصات التأمينات، وبعده يكون الرد 429 `rate_limited`. لا يُعرض على Claude: يستدعي التأمينات الاجتماعية (مصدر) مباشرة ويستهلك حصة الشركة من طلبات التأمينات.","x-access":"read","x-permission":{"key":"gosi/verify_wage","label":"Verify wages with GOSI","x-label-ar":"التحقق من الأجور في التأمينات الاجتماعية"},"x-feature":"gosi","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/gosi_employee_id"}],"responses":{"200":{"description":"GOSI's answer.","x-description-ar":"رد التأمينات.","content":{"application/json":{"example":{"wage_valid":true,"wage":"9000"},"schema":{"$ref":"#/components/schemas/gosi_wage_verification"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"GOSI could not answer.","x-description-ar":"تعذّر الرد من التأمينات.","x-codes":[{"code":"validation_failed","meaning":"GOSI could not answer: the national ID is not valid, or the employee has no fixed monthly basic salary. GOSI being unreachable answers this too (\"GOSI validation is currently unavailable\").","x-meaning-ar":"تعذّر الرد من التأمينات: رقم الهوية غير صحيح، أو ليس للموظف راتب أساسي شهري ثابت. ويُرجع هذا أيضاً عند تعذّر الوصول إلى التأمينات.","x-fix":"Give the employee a fixed monthly salary (`salaries.create`) or correct the ID. If GOSI is unavailable, try again later.","x-fix-ar":"أضف للموظف راتباً شهرياً ثابتاً (`salaries.create`) أو صحّح الهوية. وإن كانت التأمينات غير متاحة فأعد المحاولة لاحقاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Wage verification requires a fixed monthly basic salary on the employee record.","code":"validation_failed"}}}}}}},"/holidays":{"get":{"summary":"List public holidays","operationId":"holidays.list","tags":["Public holidays"],"description":"Returns the company's public holidays, most recently added first, each with its dates, the country that\nobserves it and whether it shows in employees' upcoming-holidays card. A holiday applies to the employees\nwhose country of residence is its `country`: those days are not working days for them, so they owe no\nattendance, are never marked absent, and the days are not counted inside their leave.\n\n**When to use:** to answer \"when is the next holiday?\" or \"is the office closed on 23 September?\", or to\nfind a holiday's `id` before changing it. Narrow to a period with `q[start_date]` / `q[end_date]` (any\nholiday overlapping the period is returned) and to a country with `q[country_eq]`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض العطل الرسمية","x-description-ar":"يعرض العطل الرسمية للشركة، الأحدث إضافةً أولاً، مع تواريخ كل عطلة والدولة التي تعطّل فيها وهل تظهر في\nبطاقة العطل القادمة لدى الموظفين. تنطبق العطلة على الموظفين المقيمين في دولتها `country`: فتلك الأيام ليست\nأيام عمل لهم، فلا يُطلب منهم الحضور ولا يُسجَّلون غائبين، ولا تُحتسب الأيام من إجازاتهم.\n\n**متى تستخدمه:** للإجابة عن \"متى العطلة القادمة؟\" أو \"هل الدوام معطّل يوم ٢٣ سبتمبر؟\"، أو لمعرفة رقم `id`\nالعطلة قبل تعديلها. اقصر النتائج على فترة بـ `q[start_date]` و`q[end_date]` (تُعاد كل عطلة تتداخل مع\nالفترة)، وعلى دولة بـ `q[country_eq]`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ عطلة في الصفحة.","x-access":"read","x-permission":{"key":"public_holiday/view","label":"View public holidays","x-label-ar":"عرض العطل الرسمية"},"x-feature":"public_holiday","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[start_date]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Only holidays that end on or after this date.","x-description-ar":"العطل التي تنتهي في هذا التاريخ أو بعده فقط.","example":"2026-09-01"},{"name":"q[end_date]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Only holidays that start on or before this date.","x-description-ar":"العطل التي تبدأ في هذا التاريخ أو قبله فقط.","example":"2026-12-31"},{"name":"q[country_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this country, ISO code.","x-description-ar":"دولة محددة فقط، برمز ISO.","example":"SA"},{"name":"q[name_en_or_name_ar_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"English or Arabic name contains.","x-description-ar":"الاسم بالإنجليزية أو العربية يحتوي على.","example":"National"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`; `date asc` sorts by start date. Most recently added first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`؛ و`date asc` يرتب حسب تاريخ البداية. الأحدث إضافةً أولاً إن لم يُرسل.","example":"date asc"}],"responses":{"200":{"description":"A page of holidays.","x-description-ar":"صفحة من العطل.","content":{"application/json":{"example":{"records":[{"id":41,"name":"Saudi National Day","start_date":"2026-09-23","end_date":"2026-09-23","country":"SA","country_name":"Saudi Arabia","show_on_dashboard_for_assigned_users":true}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/holiday_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a public holiday","operationId":"holidays.create","tags":["Public holidays"],"description":"Adds a public holiday for one country, from `start_date` to `end_date` inclusive. It applies to every\nemployee whose country of residence is `country`.\n\n**When to use:** when the company announces a holiday (Eid, National Day). A holiday may not overlap another\nholiday of the same country; to lengthen one, use `holidays.update`.\n\n**Prerequisites:** the holidays already set, from `holidays.list`, to avoid an overlap. The token's owner\nmust be linked to an employee record.\n\n**Side effects:** every pending or upcoming leave request of the employees in that country is recalculated\nso the holiday days are not counted as leave (balances change accordingly, and each changed request records\nthe update). In the background, the holiday days are marked \"holiday\" in those employees' attendance, and\nany absence already recorded on them is removed, together with its undecided absence deduction (see Time\nincidents). Refused if a date falls in a payroll period that has already been paid. Not offered to Claude, because it changes the attendance and leave of everyone in the country.","x-summary-ar":"إضافة عطلة رسمية","x-description-ar":"يضيف عطلة رسمية لدولة واحدة، من `start_date` إلى `end_date` ضمناً. تنطبق على كل موظف يقيم في الدولة\n`country`.\n\n**متى تستخدمه:** عند إعلان الشركة عطلة (العيد، اليوم الوطني). لا يجوز أن تتداخل العطلة مع عطلة أخرى للدولة\nنفسها؛ ولتمديد عطلة استخدم `holidays.update`.\n\n**المتطلبات:** العطل المسجلة من `holidays.list` لتجنب التداخل. ويجب أن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يُعاد احتساب كل طلب إجازة معلّق أو قادم لموظفي تلك الدولة حتى لا تُحتسب أيام العطلة من\nالإجازة (فتتغير الأرصدة تبعاً لذلك، ويُسجَّل التعديل على كل طلب تغيّر). وفي الخلفية تُعلَّم أيام العطلة بأنها\n«عطلة» في حضور هؤلاء الموظفين، ويُحذف أي غياب سُجّل فيها مع خصم الغياب الذي لم يُبتّ فيه بعد (انظر مخالفات\nالوقت). تُرفض إن وقع أحد أيامها في فترة رواتب صُرفت بالفعل. لا تُعرض على Claude لأنها\nتغيّر حضور وإجازات كل الموظفين في الدولة.","x-access":"write","x-permission":{"key":"public_holiday/create","label":"Add public holidays","x-label-ar":"إضافة عطل رسمية"},"x-feature":"public_holiday","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new holiday.","x-description-ar":"العطلة الجديدة.","content":{"application/json":{"example":{"id":41,"name":"Saudi National Day","name_en":"Saudi National Day","name_ar":"اليوم الوطني السعودي","start_date":"2026-09-23","end_date":"2026-09-23","country":"SA","country_name":"Saudi Arabia","show_on_dashboard_for_assigned_users":true},"schema":{"$ref":"#/components/schemas/holiday"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The holiday cannot be added.","x-description-ar":"لا يمكن إضافة العطلة.","x-codes":[{"code":"validation_failed","meaning":"A field is missing or not valid: a blank name, an unknown country code, `end_date` before `start_date`, dates overlapping another holiday of the same country, or a date in a payroll period that has already been paid (`error` names the payroll run).","x-meaning-ar":"حقل ناقص أو غير صحيح: اسم فارغ، أو رمز دولة غير معروف، أو `end_date` قبل `start_date`، أو تواريخ تتداخل مع عطلة أخرى للدولة نفسها، أو تاريخ ضمن فترة رواتب صُرفت بالفعل (يذكر `error` مسير الرواتب).","x-fix":"Fix the field named in `error`. For an overlap, change the dates or edit the existing holiday; for a paid period, revert that payroll run first.","x-fix-ar":"صحّح الحقل المذكور في `error`. عند التداخل غيّر التواريخ أو عدّل العطلة الموجودة؛ وعند الفترة المصروفة تراجع عن مسير الرواتب أولاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company. Adding, changing or deleting a holiday re-prices employees' upcoming leave and records who did it, which needs one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. إضافة العطلة أو تعديلها أو حذفها يعيد احتساب الإجازات القادمة للموظفين ويسجّل من قام بذلك، وهذا يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["holiday"],"properties":{"holiday":{"$ref":"#/components/schemas/holiday_input","required":["name_en","name_ar","start_date","end_date","country"]}}},"example":{"holiday":{"name_en":"Saudi National Day","name_ar":"اليوم الوطني السعودي","start_date":"2026-09-23","end_date":"2026-09-23","country":"SA","show_on_dashboard_for_assigned_users":true}}}},"required":true,"description":"The new holiday."}}},"/holidays/stat_cards":{"get":{"summary":"Count holidays, weekend and working days in a period","operationId":"holidays.stat_cards","tags":["Public holidays"],"description":"Splits a period into working days, holiday days and weekend days, and names the longest holiday in it.\nThe three always add up to `period.days`: a holiday falling on a weekend counts as weekend, and a day that\nis a holiday in two countries counts once. The weekend is the company's default attendance profile's days\noff. `total_holidays` counts holiday records; `total_holiday_days` counts days. `longest_holidays` lists\nevery holiday tied for the most working days inside the period, with how many active employees live in its\ncountry.\n\n**When to use:** to answer \"how many working days are there this year / this quarter?\" or \"what is the\nlongest holiday this year?\". With no dates the period is the current calendar year in the company's time\nzone. Takes the same filters as `holidays.list`, e.g. `q[country_eq]` for one country.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عدّ العطل وأيام نهاية الأسبوع وأيام العمل في فترة","x-description-ar":"يقسّم فترة إلى أيام عمل وأيام عطل وأيام نهاية أسبوع، ويذكر أطول عطلة فيها. مجموع الثلاثة يساوي دائماً\n`period.days`: العطلة التي تقع في نهاية الأسبوع تُحتسب نهاية أسبوع، واليوم الذي هو عطلة في دولتين يُحتسب\nمرة واحدة. نهاية الأسبوع هي أيام الراحة في ملف الحضور الافتراضي للشركة. يعدّ `total_holidays` سجلات العطل،\nويعدّ `total_holiday_days` الأيام. ويذكر `longest_holidays` كل عطلة تتساوى في أكبر عدد من أيام العمل داخل\nالفترة، مع عدد الموظفين النشطين المقيمين في دولتها.\n\n**متى تستخدمه:** للإجابة عن \"كم يوم عمل في هذه السنة / هذا الربع؟\" أو \"ما أطول عطلة هذا العام؟\". دون تواريخ\nتكون الفترة السنة الميلادية الحالية بتوقيت الشركة. يقبل مرشحات `holidays.list` نفسها، مثل `q[country_eq]`\nلدولة واحدة.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"public_holiday/view","label":"View public holidays","x-label-ar":"عرض العطل الرسمية"},"x-feature":"public_holiday","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[start_date]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First day of the period. 1 January of the current year when omitted.","x-description-ar":"أول يوم في الفترة. الأول من يناير للسنة الحالية إن لم يُرسل.","example":"2026-01-01"},{"name":"q[end_date]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last day of the period, on or after `q[start_date]`. 31 December of the current year when omitted.","x-description-ar":"آخر يوم في الفترة، في `q[start_date]` أو بعده. ٣١ ديسمبر للسنة الحالية إن لم يُرسل.","example":"2026-12-31"},{"name":"q[country_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this country's holidays, ISO code.","x-description-ar":"عطل دولة محددة فقط، برمز ISO.","example":"SA"}],"responses":{"200":{"description":"The period's figures.","x-description-ar":"أرقام الفترة.","content":{"application/json":{"example":{"period":{"from":"2026-01-01","to":"2026-12-31","days":365},"total_holidays":3,"total_holiday_days":9,"total_weekend_days":104,"total_working_days":252,"longest_holidays":[{"id":39,"name":"Eid al-Fitr","start_date":"2026-03-19","end_date":"2026-03-24","country":"SA","country_name":"Saudi Arabia","working_days":4,"assigned_employees":58}],"total_countries":1},"schema":{"type":"object","required":["period","total_holidays","total_holiday_days","total_weekend_days","total_working_days","longest_holidays","total_countries"],"properties":{"period":{"type":"object","description":"The period counted: `from`, `to` and its number of `days`.","x-description-ar":"الفترة المحسوبة: `from` و`to` وعدد أيامها `days`.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"days":{"type":"integer","description":"Days in the period.","x-description-ar":"عدد أيام الفترة."}}},"total_holidays":{"type":"integer","description":"Holiday records overlapping the period.","x-description-ar":"عدد سجلات العطل التي تتداخل مع الفترة."},"total_holiday_days":{"type":"integer","description":"Holiday days in the period that are not weekend days.","x-description-ar":"أيام العطل في الفترة التي ليست أيام نهاية أسبوع."},"total_weekend_days":{"type":"integer","description":"Weekend days in the period.","x-description-ar":"أيام نهاية الأسبوع في الفترة."},"total_working_days":{"type":"integer","description":"Days left once weekends and holidays are taken out.","x-description-ar":"الأيام المتبقية بعد استبعاد نهايات الأسبوع والعطل."},"total_countries":{"type":"integer","description":"Countries with a holiday in the period.","x-description-ar":"عدد الدول التي لها عطلة في الفترة."},"longest_holidays":{"type":"array","description":"The holiday(s) with the most working days inside the period; several when tied.","x-description-ar":"العطلة (أو العطل عند التساوي) الأكثر أيام عمل داخل الفترة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Holiday id.","x-description-ar":"رقم العطلة."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"start_date":{"type":"string","description":"First day (full holiday, not clipped).","x-description-ar":"أول يوم (العطلة كاملة).","format":"date"},"end_date":{"type":"string","description":"Last day (full holiday, not clipped).","x-description-ar":"آخر يوم (العطلة كاملة).","format":"date"},"country":{"type":"string","description":"ISO country code.","x-description-ar":"رمز الدولة ISO."},"country_name":{"type":"string","description":"Country name.","x-description-ar":"اسم الدولة.","nullable":true},"working_days":{"type":"integer","description":"Its working days that fall inside the period.","x-description-ar":"أيام العمل منها الواقعة داخل الفترة."},"assigned_employees":{"type":"integer","description":"Active employees residing in its country.","x-description-ar":"عدد الموظفين النشطين المقيمين في دولتها."}}}}}}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"A date is not in `YYYY-MM-DD` form, or `q[start_date]` is after `q[end_date]`.","x-meaning-ar":"تاريخ ليس بالصيغة `YYYY-MM-DD`، أو `q[start_date]` بعد `q[end_date]`.","x-fix":"Send both dates as `YYYY-MM-DD`, the first on or before the second.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`، والأول في الثاني أو قبله."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"start_date must be on or before end_date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/holidays/{id}":{"patch":{"summary":"Change a public holiday","operationId":"holidays.update","tags":["Public holidays"],"description":"Changes the fields you send — names, dates, country or dashboard visibility — and leaves the rest as they\nare.\n\n**When to use:** to move or lengthen a holiday (e.g. when the Eid dates are confirmed) or to correct its\nname. To add a new one, use `holidays.create`.\n\n**Prerequisites:** the holiday's `id` from `holidays.list`. The token's owner must be linked to an employee\nrecord.\n\n**Side effects:** when the dates or the country change, the leave of the employees in the old and new\ncountries is recalculated, and in the background the attendance \"holiday\" days move with it: days no longer\ncovered go back to normal working days (and may raise an absence again), new days are marked \"holiday\".\nRefused if a new date falls in a payroll period already paid. Not offered to\nClaude, because it changes the attendance and leave of everyone in the country.","x-summary-ar":"تعديل عطلة رسمية","x-description-ar":"يعدّل الحقول التي ترسلها — الاسمين أو التواريخ أو الدولة أو الظهور في لوحة المعلومات — ويترك الباقي كما هو.\n\n**متى تستخدمه:** لنقل عطلة أو تمديدها (مثلاً عند تأكيد موعد العيد) أو لتصحيح اسمها. لإضافة عطلة جديدة استخدم\n`holidays.create`.\n\n**المتطلبات:** رقم `id` العطلة من `holidays.list`. ويجب أن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** عند تغيير التواريخ أو الدولة يُعاد احتساب إجازات موظفي الدولة القديمة والجديدة، وفي\nالخلفية تنتقل أيام «العطلة» في الحضور معها: الأيام التي لم تعد مشمولة ترجع أيام عمل عادية (وقد يُسجَّل فيها غياب\nمن جديد)، والأيام الجديدة تُعلَّم «عطلة». تُرفض إن وقع تاريخ جديد في فترة رواتب صُرفت بالفعل.\nلا تُعرض على Claude لأنها تغيّر حضور وإجازات كل الموظفين في الدولة.","x-access":"write","x-permission":{"key":"public_holiday/edit","label":"Edit public holidays","x-label-ar":"تعديل العطل الرسمية"},"x-feature":"public_holiday","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/holiday_id"}],"responses":{"200":{"description":"The holiday after the change.","x-description-ar":"العطلة بعد التعديل.","content":{"application/json":{"example":{"id":41,"name":"Saudi National Day","name_en":"Saudi National Day","name_ar":"اليوم الوطني السعودي","start_date":"2026-09-23","end_date":"2026-09-23","country":"SA","country_name":"Saudi Arabia","show_on_dashboard_for_assigned_users":true},"schema":{"$ref":"#/components/schemas/holiday"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"A field is missing or not valid: a blank name, an unknown country code, `end_date` before `start_date`, dates overlapping another holiday of the same country, or a date in a payroll period that has already been paid (`error` names the payroll run).","x-meaning-ar":"حقل ناقص أو غير صحيح: اسم فارغ، أو رمز دولة غير معروف، أو `end_date` قبل `start_date`، أو تواريخ تتداخل مع عطلة أخرى للدولة نفسها، أو تاريخ ضمن فترة رواتب صُرفت بالفعل (يذكر `error` مسير الرواتب).","x-fix":"Fix the field named in `error`. For an overlap, change the dates or edit the existing holiday; for a paid period, revert that payroll run first.","x-fix-ar":"صحّح الحقل المذكور في `error`. عند التداخل غيّر التواريخ أو عدّل العطلة الموجودة؛ وعند الفترة المصروفة تراجع عن مسير الرواتب أولاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company. Adding, changing or deleting a holiday re-prices employees' upcoming leave and records who did it, which needs one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. إضافة العطلة أو تعديلها أو حذفها يعيد احتساب الإجازات القادمة للموظفين ويسجّل من قام بذلك، وهذا يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["holiday"],"properties":{"holiday":{"$ref":"#/components/schemas/holiday_input"}}},"example":{"holiday":{"start_date":"2026-09-23","end_date":"2026-09-24"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a public holiday","operationId":"holidays.delete","tags":["Public holidays"],"description":"Deletes a public holiday for good. Its days become normal working days again for the employees of its\ncountry.\n\n**When to use:** when a holiday was added by mistake or cancelled. To move it to other dates, use\n`holidays.update` instead.\n\n**Prerequisites:** the holiday's `id` from `holidays.list`. The token's owner must be linked to an employee\nrecord.\n\n**Side effects:** the upcoming leave of the employees in that country is recalculated, so a leave spanning\nthe former holiday now counts those days. In the background the \"holiday\" attendance days are removed, and\nthe days are judged again like any working day: an employee with no attendance on them can be marked\nabsent and get an absence deduction to review (see Time incidents). Answers 204 with no body.\nNot offered to Claude: it cannot be undone and changes attendance and pay for a whole\ncountry.","x-summary-ar":"حذف عطلة رسمية","x-description-ar":"يحذف العطلة الرسمية نهائياً، فتعود أيامها أيام عمل عادية لموظفي دولتها.\n\n**متى تستخدمه:** عند إضافة عطلة بالخطأ أو إلغائها. لنقلها إلى تواريخ أخرى استخدم `holidays.update`.\n\n**المتطلبات:** رقم `id` العطلة من `holidays.list`. ويجب أن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يُعاد احتساب الإجازات القادمة لموظفي تلك الدولة، فالإجازة التي تشمل أيام العطلة السابقة\nتحتسبها الآن. وفي الخلفية تُزال أيام «العطلة» من الحضور، وتُقيَّم الأيام كأي يوم عمل: الموظف الذي لا حضور له\nفيها قد يُسجَّل غائباً ويظهر له خصم غياب للمراجعة (انظر مخالفات الوقت). تُرجع 204 دون محتوى.\nلا تُعرض على Claude: لا يمكن التراجع عنها وتغيّر الحضور والرواتب لدولة كاملة.","x-access":"write","x-permission":{"key":"public_holiday/delete","label":"Delete public holidays","x-label-ar":"حذف العطل الرسمية"},"x-feature":"public_holiday","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/holiday_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The holiday cannot be deleted.","x-description-ar":"لا يمكن حذف العطلة.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company. Adding, changing or deleting a holiday re-prices employees' upcoming leave and records who did it, which needs one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. إضافة العطلة أو تعديلها أو حذفها يعيد احتساب الإجازات القادمة للموظفين ويسجّل من قام بذلك، وهذا يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/hr_attendance_log/export":{"get":{"summary":"Download the HR attendance log as Excel or CSV","operationId":"attendance_log.export","tags":["Attendance log"],"description":"Builds a spreadsheet of the rows of `attendance_log.records` for a period: one row per employee per day with check-in and check-out (in the company's timezone), hours, punch source, location and status. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** to hand HR or an auditor the raw attendance of a period. To answer a question, `attendance_log.records` is lighter.\n\n**Prerequisites:** at least one column key from `attendance_log.export_columns`. Needs the HR data export permission.\nThe period defaults to the current month in the company's timezone, as in the log.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل سجل الحضور التفصيلي بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـصفوف `attendance_log.records` خلال فترة: صف لكل موظف في كل يوم مع وقتي الحضور والانصراف (بتوقيت الشركة) والساعات ومصدر التسجيل والموقع والحالة. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** لتسليم الموارد البشرية أو المدقق الحضور التفصيلي لفترة. للإجابة عن سؤال `attendance_log.records` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `attendance_log.export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\nالفترة افتراضياً هي الشهر الحالي بتوقيت الشركة، كما في السجل.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"}]},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `attendance_log.export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `attendance_log.export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["date","employee","department","check_in","check_out","hours","status"]},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_log_status"},{"$ref":"#/components/parameters/attendance_log_source"},{"$ref":"#/components/parameters/attendance_log_location"}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"hr_attendance_log","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي سجل.","x-fix":"Widen the filters or the period.","x-fix-ar":"وسّع المرشحات أو الفترة."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters or shorten the period.","x-fix-ar":"ضيّق المرشحات أو قصّر الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/hr_attendance_log/export/columns":{"get":{"summary":"List the columns of the HR attendance log export","operationId":"attendance_log.export_columns","tags":["Attendance log"],"description":"Lists the columns you may put in `attendance_log.export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `attendance_log.export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير سجل الحضور التفصيلي","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `attendance_log.export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `attendance_log.export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"}]},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"date","label":"Date","default":true,"type":"date"},{"key":"employee","label":"Employee","default":true,"type":"string"},{"key":"check_in","label":"Check-in","default":true,"type":"datetime"},{"key":"check_out","label":"Check-out","default":true,"type":"datetime"},{"key":"status","label":"Status","default":true,"type":"enum"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_attendance_log/overview":{"get":{"summary":"Count attendance log rows by status, per day","operationId":"attendance_log.overview","tags":["Attendance log"],"description":"Counts the detailed log's rows (one per employee per working day) by day status over the period and\nfor each date: present, late, early leave, still working, missing check-out, absent, on leave. Also\nlists the rest days (dates that were a weekend or holiday for everyone recorded).\n\nRows are working days only: weekends and holidays are never rows (a check-in on one still shows as a\nrow). Employees who have since left keep their past rows. Today is partial — absences are recorded\neach night for the previous day — and future dates appear only where approved leave is already\nwritten. A day counts as `late` when it has a counted late arrival (pending with a manager or HR, or\ndeducted; not one HR excused); late wins over early leave. `status` is deliberately not a filter here,\nso the counts show what a status filter would choose between.\n\n**When to use:** \"how many late arrivals were there this month, and on which days?\". For per-person\ntotals use `attendance_reports.employees`; for the rows themselves, `attendance_log.records`.\n\n**Prerequisites:** none. `department_id` and location ids from `employees.meta_data`.\n\n**Side effects:** none.","x-summary-ar":"عدّ صفوف سجل الحضور حسب الحالة لكل يوم","x-description-ar":"يعدّ صفوف السجل التفصيلي (صف لكل موظف في كل يوم عمل) حسب حالة اليوم خلال الفترة ولكل تاريخ: حاضر،\nمتأخر، خروج مبكر، ما زال يعمل، لم يسجل خروجه، غائب، في إجازة. ويذكر أيضاً أيام الراحة (التواريخ التي\nكانت عطلة نهاية أسبوع أو عطلة رسمية لكل المسجلين).\n\nالصفوف أيام عمل فقط: عطل نهاية الأسبوع والعطل الرسمية ليست صفوفاً (ويظهر تسجيل الدخول فيها صفاً). يبقى\nلمن غادر لاحقاً صفوفه السابقة. أرقام اليوم جزئية — إذ يُسجَّل الغياب كل ليلة عن اليوم السابق — ولا تظهر\nالتواريخ المستقبلية إلا حيث سُجّلت إجازة معتمدة مسبقاً. يُعدّ اليوم `late` إن كان فيه تأخر محتسب (معلق لدى\nالمدير أو الموارد البشرية، أو مخصوم؛ لا الذي عذرته الموارد البشرية)، والتأخر يتقدم على الخروج المبكر.\nلا يقبل `status` عمداً، لتُظهر الأعداد ما يمكن أن يختار بينه مرشح الحالة.\n\n**متى تستخدمه:** \"كم حالة تأخير حصلت هذا الشهر وفي أي أيام؟\". لمجاميع كل شخص استخدم\n`attendance_reports.employees`، وللصفوف نفسها `attendance_log.records`.\n\n**المتطلبات:** لا شيء. `department_id` وأرقام المواقع من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_log_source"},{"$ref":"#/components/parameters/attendance_log_location"}],"responses":{"200":{"description":"Counts per status, overall and per day.","x-description-ar":"الأعداد لكل حالة إجمالاً ولكل يوم.","content":{"application/json":{"example":{"counts":{"all":64,"present":51,"late":6,"early_leave":2,"working":0,"missing_check_out":1,"absent":2,"on_leave":2},"days":[{"date":"2026-07-01","present":25,"late":3,"early_leave":1,"working":0,"missing_check_out":1,"absent":1,"on_leave":1},{"date":"2026-07-02","present":26,"late":3,"early_leave":1,"working":0,"missing_check_out":0,"absent":1,"on_leave":1}],"rest_days":["2026-07-03","2026-07-04"],"period":{"from":"2026-07-01","to":"2026-07-31"},"today":"2026-07-02"},"schema":{"$ref":"#/components/schemas/attendance_log_overview"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, a `department_id` that does not exist, or a `status`, `source` or `location` outside its list. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود، أو `status` أو `source` أو `location` خارج قائمته. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Location must be a location id or remote.","code":"validation_failed"}}}}}}},"/hr_attendance_log/records":{"get":{"summary":"List attendance log rows: each employee's working days","operationId":"attendance_log.records","tags":["Attendance log"],"description":"Returns the detailed attendance log: one row per employee per working day in the period, newest day\nfirst, with the check-in and check-out (time in UTC, minutes late or left early, source, location,\nremote flag, distance from the location), minutes worked and the day's status. Show times in the\n`timezone` the response gives (the company's).\n\nWeekends and holidays are not rows (a check-in on one still shows). Employees who have since left\nkeep their past rows. Today has no absence rows until the nightly run, and an open day is `working`\nuntil it ends, then `missing_check_out`. `late_minutes` / `early_minutes` count only incidents still\npending or deducted, never one HR excused.\n\n**When to use:** \"who was late on Monday and by how much?\" — filter `status=late` and a one-day\nperiod; \"who checked in remotely?\" — `location=remote`. For totals per person use\n`attendance_reports.employees`.\n\n**Prerequisites:** none. `department_id` and location ids from `employees.meta_data`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض صفوف سجل الحضور: أيام عمل كل موظف","x-description-ar":"يعيد سجل الحضور التفصيلي: صف لكل موظف في كل يوم عمل في الفترة، الأحدث أولاً، مع تسجيل الدخول والخروج\n(الوقت بتوقيت UTC، ودقائق التأخير أو الخروج المبكر، والمصدر، والموقع، وعلامة العمل عن بُعد، والمسافة عن\nالموقع)، ودقائق العمل، وحالة اليوم. اعرض الأوقات بالمنطقة الزمنية `timezone` الواردة في الإجابة (منطقة\nالشركة).\n\nعطل نهاية الأسبوع والعطل الرسمية ليست صفوفاً (ويظهر تسجيل الدخول فيها). يبقى لمن غادر لاحقاً صفوفه\nالسابقة. لا صفوف غياب لليوم الحالي حتى التشغيل الليلي، واليوم المفتوح يكون `working` حتى ينتهي ثم\n`missing_check_out`. لا تُحتسب في `late_minutes` و`early_minutes` إلا الحالات المعلقة أو المخصومة، لا\nالتي عذرتها الموارد البشرية.\n\n**متى تستخدمه:** \"من تأخر يوم الاثنين وبكم؟\" — صفِّ بـ `status=late` وفترة يوم واحد؛ \"من سجّل عن بُعد؟\"\n— `location=remote`. لمجاميع كل شخص استخدم `attendance_reports.employees`.\n\n**المتطلبات:** لا شيء. `department_id` وأرقام المواقع من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_log_status"},{"$ref":"#/components/parameters/attendance_log_source"},{"$ref":"#/components/parameters/attendance_log_location"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of log rows.","x-description-ar":"صفحة من صفوف السجل.","content":{"application/json":{"example":{"timezone":"Asia/Riyadh","records":[{"id":88412,"date":"2026-07-02","employee":{"id":1203,"name":"Sara Ahmed","employee_no":"E-0042","department":"Finance"},"check_in":{"at":"2026-07-02T06:15:00Z","late_minutes":15,"source":"mobile","location":{"id":3,"name":"Riyadh HQ"},"remote":false,"distance_m":40},"check_out":{"at":"2026-07-02T14:15:00Z","early_minutes":null,"source":"web","location":{"id":3,"name":"Riyadh HQ"},"remote":false,"distance_m":35},"worked_minutes":480,"status":"late"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_log_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, a `department_id` that does not exist, or a `status`, `source` or `location` outside its list. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود، أو `status` أو `source` أو `location` خارج قائمته. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Status must be one of: present, late, early_leave, working, missing_check_out, absent, on_leave.","code":"validation_failed"}}}}}}},"/hr_attendance_log/summary":{"get":{"summary":"Get punctuality and punch-source insights","operationId":"attendance_log.summary","tags":["Attendance log"],"description":"Over the log rows matching every filter (status included): how many completed days started on time\nand the on-time rate, the median check-in time (`HH:MM` in the company's timezone), and how people\npunched (mobile app, web, device, manual entry, automatic close).\n\nCompleted days are those with status present, early leave or late; days still open or missing a\ncheck-out are left out so today does not read 100%. On time = no counted late arrival (pending or\ndeducted; one HR excused is on time). Sources count punches, not days: a check-in and a check-out are\ntwo. Weekends and holidays are not rows.\n\n**When to use:** \"what share of check-ins were on time in July?\", \"when do people usually arrive?\",\n\"how many still punch on the web?\".\n\n**Prerequisites:** none. `department_id` and location ids from `employees.meta_data`.\n\n**Side effects:** none.","x-summary-ar":"عرض مؤشرات الانضباط في المواعيد ومصادر التسجيل","x-description-ar":"على صفوف السجل المطابقة لكل المرشحات (ومنها الحالة): كم يوماً مكتملاً بدأ في الموعد ونسبة ذلك، والوسيط\nلوقت تسجيل الدخول (`HH:MM` بتوقيت الشركة)، وطريقة التسجيل (تطبيق الجوال، الويب، الجهاز، الإدخال اليدوي،\nالإغلاق التلقائي).\n\nالأيام المكتملة هي ذات الحالة present أو early_leave أو late؛ وتُستبعد الأيام المفتوحة وحالات عدم تسجيل\nالخروج كي لا تظهر نسبة اليوم ١٠٠٪. في الموعد = دون تأخر محتسب (معلق أو مخصوم؛ والذي عذرته الموارد\nالبشرية يُعدّ في الموعد). تُعدّ المصادر بالتسجيلات لا بالأيام: الدخول والخروج تسجيلان. عطل نهاية الأسبوع\nوالعطل الرسمية ليست صفوفاً.\n\n**متى تستخدمه:** \"ما نسبة تسجيلات الدخول في الموعد في يوليو؟\"، \"متى يصل الموظفون عادةً؟\"، \"كم ما زال\nيسجل عبر الويب؟\".\n\n**المتطلبات:** لا شيء. `department_id` وأرقام المواقع من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_log_status"},{"$ref":"#/components/parameters/attendance_log_source"},{"$ref":"#/components/parameters/attendance_log_location"}],"responses":{"200":{"description":"The insights.","x-description-ar":"المؤشرات.","content":{"application/json":{"example":{"punctuality":{"completed_check_ins":59,"on_time":53,"on_time_rate":89.8,"median_check_in":"08:54"},"sources":{"total":118,"items":[{"source":"mobile","count":70},{"source":"device","count":40},{"source":"web","count":8}]}},"schema":{"$ref":"#/components/schemas/attendance_log_summary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, a `department_id` that does not exist, or a `status`, `source` or `location` outside its list. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود، أو `status` أو `source` أو `location` خارج قائمته. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Punch source must be one of: mobile, web, app, device, manual, system.","code":"validation_failed"}}}}}}},"/hr_attendance_reports/by_department":{"get":{"summary":"Compare attendance rates by department","operationId":"attendance_reports.by_department","tags":["Attendance reports"],"description":"Returns, for each department with active employees (alphabetically), the days attended and absent in\nthe period and the attendance rate, plus a company-wide `total` row.\n\n`rate` = attendance_days ÷ (attendance_days + absent_days) × 100, one decimal — the same formula as\neach employee's `commitment_percentage`, so `total.rate` is the company's commitment. Leave days,\nweekends and holidays are outside the ratio; a check-in on a rest day counts as attended. `rate` is\nnull for a department with no expected day. Absences are recorded each night for the previous day,\nso today's absences are not counted yet.\n\n**When to use:** \"which department has the worst attendance this month?\". For the trend over time use\n`attendance_reports.trend`; for the people behind a department, `attendance_reports.employees` with\n`department_id`.\n\n**Prerequisites:** none. Takes only the period — it is the department breakdown.\n\n**Side effects:** none.","x-summary-ar":"مقارنة نسب الحضور حسب القسم","x-description-ar":"يعيد لكل قسم فيه موظفون نشطون (مرتبة أبجدياً) أيام الحضور والغياب في الفترة ونسبة الحضور، مع صف\n`total` للشركة كلها.\n\n`rate` = أيام الحضور ÷ (أيام الحضور + أيام الغياب) × ١٠٠ بمنزلة عشرية واحدة — المعادلة نفسها لنسبة\n`commitment_percentage` لكل موظف، فتكون `total.rate` نسبة التزام الشركة. أيام الإجازة وعطل نهاية الأسبوع\nوالعطل الرسمية خارج النسبة، ويُحتسب تسجيل الدخول في يوم راحة حضوراً. تكون `rate` قيمة null للقسم الذي\nلا يوم مطلوب فيه. يُسجَّل الغياب كل ليلة عن اليوم السابق، فلا يُحتسب غياب اليوم بعد.\n\n**متى تستخدمه:** \"أي قسم حضوره الأسوأ هذا الشهر؟\". للاتجاه عبر الزمن استخدم `attendance_reports.trend`،\nولموظفي قسم بعينه `attendance_reports.employees` مع `department_id`.\n\n**المتطلبات:** لا شيء. يقبل الفترة فقط — فهو بنفسه التقسيم حسب القسم.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"}],"responses":{"200":{"description":"The rate per department and in total.","x-description-ar":"النسبة لكل قسم وللشركة كلها.","content":{"application/json":{"example":{"departments":[{"department_id":4,"name":"Finance","attendance_days":198,"absent_days":4,"expected_days":202,"rate":98.0},{"department_id":7,"name":"Sales","attendance_days":310,"absent_days":22,"expected_days":332,"rate":93.4}],"total":{"attendance_days":508,"absent_days":26,"expected_days":534,"rate":95.1}},"schema":{"type":"object","properties":{"departments":{"type":"array","description":"One row per department, alphabetically.","x-description-ar":"صف لكل قسم، أبجدياً.","items":{"type":"object","properties":{"department_id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم."},"attendance_days":{"type":"integer","description":"Days attended.","x-description-ar":"أيام الحضور."},"absent_days":{"type":"integer","description":"Days absent.","x-description-ar":"أيام الغياب."},"expected_days":{"type":"integer","description":"attendance_days + absent_days.","x-description-ar":"أيام الحضور + أيام الغياب."},"rate":{"type":"number","description":"Attendance rate, %, one decimal; null when expected_days is 0.","x-description-ar":"نسبة الحضور ٪ بمنزلة عشرية واحدة؛ null إن كانت expected_days صفراً.","nullable":true}}}},"total":{"type":"object","description":"The whole company.","x-description-ar":"الشركة كلها.","properties":{"attendance_days":{"type":"integer","description":"Days attended.","x-description-ar":"أيام الحضور."},"absent_days":{"type":"integer","description":"Days absent.","x-description-ar":"أيام الغياب."},"expected_days":{"type":"integer","description":"attendance_days + absent_days.","x-description-ar":"أيام الحضور + أيام الغياب."},"rate":{"type":"number","description":"Attendance rate, %, one decimal; null when expected_days is 0.","x-description-ar":"نسبة الحضور ٪ بمنزلة عشرية واحدة؛ null إن كانت expected_days صفراً.","nullable":true}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A date is not valid.","x-description-ar":"تاريخ غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, or a `department_id` that does not exist. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The start date must be on or before the end date.","code":"validation_failed"}}}}}}},"/hr_attendance_reports/employees":{"get":{"summary":"List each employee's attendance totals for a period","operationId":"attendance_reports.employees","tags":["Attendance reports"],"description":"Returns every active employee of the company (people who have left or are serving notice are not\nlisted) with their totals over the period: days attended, days absent, days late and hours late,\napproved overtime and permission hours, and the commitment (attendance) rate. Alphabetical by name\nunless `sort` says otherwise.\n\nHow the numbers count: a day is *attended* when it has a check-in (on time, late, or without a\ncheck-out), including on a weekend or holiday. A day is *absent* only when it was a working day for the\nemployee with no check-in and no approved leave; absences are recorded each night for the previous\nday, so today is never an absence here. Weekends (per the employee's attendance profile), public\nholidays and leave days count neither way. *Late* counts the late arrivals still pending with a\nmanager or HR and those deducted, never one HR excused. `commitment_percentage` = attended ÷ (attended\n+ absent) × 100.\n\n**When to use:** \"who was late most this month?\", \"who has the most absences in Finance?\" — read\n`delay_days`, `delay_hours`, `absent_days`. For one person's exact dates, `attendance_reports.employee`;\nfor each day's punches, `attendance_log.records`.\n\n**Prerequisites:** none. `department_id` from `employees.meta_data`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مجاميع حضور كل موظف خلال فترة","x-description-ar":"يعيد كل موظفي الشركة النشطين (لا يظهر من غادر أو في فترة الإشعار) مع مجاميعهم في الفترة: أيام الحضور،\nوأيام الغياب، وأيام التأخير وساعاته، وساعات العمل الإضافي والاستئذانات المعتمدة، ونسبة الالتزام\n(الحضور). مرتبون أبجدياً بالاسم ما لم يحدد `sort` غير ذلك.\n\nطريقة العدّ: يُعدّ اليوم *حضوراً* إن كان فيه تسجيل دخول (في الموعد أو متأخراً أو دون تسجيل خروج)، ولو في\nعطلة نهاية الأسبوع أو عطلة رسمية. ويُعدّ *غياباً* فقط إن كان يوم عمل للموظف دون تسجيل دخول ودون إجازة\nمعتمدة؛ ويُسجَّل الغياب كل ليلة عن اليوم السابق، فلا يكون اليوم الحالي غياباً هنا أبداً. عطل نهاية\nالأسبوع (حسب ملف حضور الموظف) والعطل الرسمية وأيام الإجازة لا تُحتسب في أي منهما. *التأخير* يشمل\nحالات التأخير المعلقة لدى المدير أو الموارد البشرية والمخصومة، لا التي عذرتها الموارد البشرية.\n`commitment_percentage` = الحضور ÷ (الحضور + الغياب) × ١٠٠.\n\n**متى تستخدمه:** \"من الأكثر تأخيراً هذا الشهر؟\"، \"من لديه أكثر غياب في المالية؟\" — اقرأ `delay_days`\nو`delay_hours` و`absent_days`. لتواريخ شخص بعينه `attendance_reports.employee`، ولتسجيلات كل يوم\n`attendance_log.records`.\n\n**المتطلبات:** لا شيء. `department_id` من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_report_sort"},{"$ref":"#/components/parameters/attendance_report_direction"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of employees with their totals.","x-description-ar":"صفحة من الموظفين مع مجاميعهم.","content":{"application/json":{"example":{"records":[{"employee_id":1203,"name":"Sara Ahmed","employee_no":"E-0042","department":"Finance","employee_image":null,"attendance_days":20,"absent_days":1,"delay_days":3,"delay_hours":0.75,"overtime_hours":4.0,"permission_hours":1.5,"commitment_percentage":95.2}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_report_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, or a `department_id` that does not exist. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The start date must be on or before the end date.","code":"validation_failed"}}}}}}},"/hr_attendance_reports/employees/{employee_id}":{"get":{"summary":"Get one employee's attendance totals and the days behind them","operationId":"attendance_reports.employee","tags":["Attendance reports"],"description":"Returns one active employee's totals for the period (the same numbers as their row in\n`attendance_reports.employees`) and the exact days behind them: each absent day (and whether HR\nexcused it), each counted late day with the check-in time (UTC) and minutes late, and each approved\novertime with its hours. Lists are oldest first and cover the whole period (at most 366 days).\n\n**When to use:** \"which days was Sara late in July?\", \"were her absences excused?\".\n\n**Prerequisites:** the `employee_id`, from `attendance_reports.employees` or `employees.list`. An\nemployee who has left, or is outside `department_id` when you send it, answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض مجاميع حضور موظف والأيام التي تقف خلفها","x-description-ar":"يعيد مجاميع موظف نشط في الفترة (الأرقام نفسها في صفه ضمن `attendance_reports.employees`) والأيام التي\nتقف خلفها بالضبط: كل يوم غياب (وهل عذرته الموارد البشرية)، وكل يوم تأخير محتسب مع وقت تسجيل الدخول\n(UTC) ودقائق التأخير، وكل عمل إضافي معتمد مع ساعاته. القوائم الأقدم أولاً وتغطي الفترة كلها (حتى ٣٦٦\nيوماً).\n\n**متى تستخدمه:** \"في أي أيام تأخرت سارة في يوليو؟\"، \"هل كان غيابها بعذر؟\".\n\n**المتطلبات:** رقم `employee_id` من `attendance_reports.employees` أو `employees.list`. الموظف الذي غادر،\nأو الذي ليس في `department_id` عند إرساله، يعيد ٤٠٤.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_employee_id"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Optional. When sent, the employee must belong to this department or the answer is 404.","x-description-ar":"اختياري. عند إرساله يجب أن يكون الموظف في هذا القسم وإلا كانت الإجابة ٤٠٤.","example":4}],"responses":{"200":{"description":"The employee's totals and days.","x-description-ar":"مجاميع الموظف وأيامه.","content":{"application/json":{"example":{"employee":{"id":1203,"name":"Sara Ahmed","employee_no":"E-0042","department":"Finance","employee_image":null,"employment_status":"active"},"period":{"from":"2026-07-01","to":"2026-07-31"},"summary":{"attendance_days":20,"absent_days":1,"delay_days":1,"delay_hours":0.25,"overtime_hours":2.0,"permission_hours":0.0,"commitment_percentage":95.2},"absent_days":[{"date":"2026-07-14","excused":false}],"delay_days":[{"date":"2026-07-08","check_in_at":"2026-07-08T06:15:00.000Z","minutes_late":15}],"overtime_days":[{"date":"2026-07-01","start_time":"17:00","end_time":"19:00","hours":2.0}],"total_overtime_hours":2.0},"schema":{"$ref":"#/components/schemas/attendance_report_employee_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, or a `department_id` that does not exist. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The start date must be on or before the end date.","code":"validation_failed"}}}}}}},"/hr_attendance_reports/export":{"get":{"summary":"Download the HR attendance report as Excel or CSV","operationId":"attendance_reports.export","tags":["Attendance reports"],"description":"Builds a spreadsheet of the per-employee rows of `attendance_reports.employees` for a period: attendance, absent and late days, late, overtime and permission hours, and the commitment percentage. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** to hand management a file of the month's attendance. To answer a question, `attendance_reports.employees` is lighter.\n\n**Prerequisites:** at least one column key from `attendance_reports.export_columns`. Needs the HR data export permission.\nThe period defaults to the current month in the company's timezone, as in the report.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل تقرير الحضور للموارد البشرية بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـصفوف `attendance_reports.employees` لكل موظف خلال فترة: أيام الحضور والغياب والتأخير، وساعات التأخير والعمل الإضافي والاستئذان، ونسبة الالتزام. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** لتسليم الإدارة ملفاً بحضور الشهر. للإجابة عن سؤال `attendance_reports.employees` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `attendance_reports.export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\nالفترة افتراضياً هي الشهر الحالي بتوقيت الشركة، كما في التقرير.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"}]},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `attendance_reports.export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `attendance_reports.export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["employee_no","name","attendance_days","absent_days","delay_days","commitment_percentage"]},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_report_sort"},{"$ref":"#/components/parameters/attendance_report_direction"},{"$ref":"#/components/parameters/attendance_report_department_id"}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"hr_attendance_report","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي سجل.","x-fix":"Widen the filters or the period.","x-fix-ar":"وسّع المرشحات أو الفترة."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters or shorten the period.","x-fix-ar":"ضيّق المرشحات أو قصّر الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/hr_attendance_reports/export/columns":{"get":{"summary":"List the columns of the HR attendance report export","operationId":"attendance_reports.export_columns","tags":["Attendance reports"],"description":"Lists the columns you may put in `attendance_reports.export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `attendance_reports.export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير تقرير الحضور للموارد البشرية","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `attendance_reports.export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `attendance_reports.export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"}]},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"employee_no","label":"Employee number","default":true,"type":"string"},{"key":"name","label":"Name","default":true,"type":"string"},{"key":"attendance_days","label":"Attendance days","default":true,"type":"integer"},{"key":"absent_days","label":"Absent days","default":true,"type":"integer"},{"key":"delay_days","label":"Delay days","default":true,"type":"integer"},{"key":"commitment_percentage","label":"Commitment %","default":true,"type":"number"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_attendance_reports/stat_cards":{"get":{"summary":"Get today's company attendance headcount","operationId":"attendance_reports.stat_cards","tags":["Attendance reports"],"description":"Counts the company's active employees for TODAY, in the company's timezone: how many have checked in,\nare on approved leave, are absent, are not due yet, are on a public holiday, or have a day off. It\ntakes no dates — it is always today, live.\n\n`absent` is worked out live: an employee is absent once their own shift start plus the company's\nauto-absent delay has passed with no check-in and no leave; before that they count as `not_yet_due`.\nWeekends are per employee (their attendance profile), holidays per country of residence. When nobody\nis due in today, `working_day` is false and every card but `total_employees` is 0. Employees who\nhave left or are serving notice are not counted.\n\n**When to use:** \"who is in today?\", \"how many are absent right now?\". For a past period use\n`attendance_reports.employees`; for one manager's team, `team_attendance_reports.stat_cards`.\n\n**Prerequisites:** none. Optional `department_id` from `employees.meta_data`.\n\n**Side effects:** none.","x-summary-ar":"عرض أعداد الحضور في الشركة اليوم","x-description-ar":"يعدّ موظفي الشركة النشطين لليوم الحالي بتوقيت الشركة: كم منهم سجّل دخوله، وكم في إجازة معتمدة، وكم\nغائب، وكم لم يحن موعده بعد، وكم في عطلة رسمية، وكم في يوم راحة. لا يقبل تواريخ — فهو لليوم دائماً\nوبشكل مباشر.\n\nيُحتسب `absent` لحظياً: يُعدّ الموظف غائباً بعد مرور بداية ورديته مضافاً إليها مهلة الغياب التلقائي\nفي الشركة دون تسجيل دخول ودون إجازة؛ وقبل ذلك يُعدّ ضمن `not_yet_due`. عطلة نهاية الأسبوع خاصة بكل\nموظف (حسب ملف حضوره)، والعطل الرسمية حسب بلد الإقامة. إن لم يُطلب حضور أحد اليوم تكون `working_day`\nخطأ وكل البطاقات صفراً عدا `total_employees`. لا يُحتسب من غادر أو في فترة الإشعار.\n\n**متى تستخدمه:** \"من حضر اليوم؟\"، \"كم غائباً الآن؟\". لفترة سابقة استخدم `attendance_reports.employees`،\nولفريق مدير بعينه `team_attendance_reports.stat_cards`.\n\n**المتطلبات:** لا شيء. `department_id` اختياري من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_department_id"},{"$ref":"#/components/parameters/attendance_report_search"}],"responses":{"200":{"description":"Today's headcount.","x-description-ar":"أعداد اليوم.","content":{"application/json":{"example":{"total_employees":42,"present":31,"on_leave":3,"absent":2,"not_yet_due":4,"on_holiday":0,"on_day_off":2,"working_day":true},"schema":{"$ref":"#/components/schemas/attendance_report_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A filter is not valid.","x-description-ar":"مرشح غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A filter is not valid: a date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, or a `department_id` that does not exist. `error` says which.","x-meaning-ar":"مرشح غير صحيح: تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `department_id` غير موجود. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The selected department does not exist.","code":"validation_failed"}}}}}}},"/hr_attendance_reports/trend":{"get":{"summary":"Chart the company attendance rate over a period","operationId":"attendance_reports.trend","tags":["Attendance reports"],"description":"Returns one point per day, week or month in the period with three rates that add up to 100: attended\n(on time, late or without a check-out), absent, and on leave. Covers every active employee.\n\nWeekends and holidays are left out entirely, so a bucket made only of rest days has no point at all\n(do not draw a zero there). Leave IS part of the total here, unlike `commitment_percentage`. Weekly\nbuckets start on `from` (1–7, 8–14…), not on a calendar week; `date` is the bucket's first day.\nAbsences are recorded each night for the previous day, so today is never in the chart.\n\n**When to use:** \"is attendance getting better?\", \"which week was worst?\". For one number per\ndepartment use `attendance_reports.by_department`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض منحنى نسبة الحضور في الشركة خلال فترة","x-description-ar":"يعيد نقطة لكل يوم أو أسبوع أو شهر في الفترة بثلاث نسب مجموعها ١٠٠: الحضور (في الموعد أو متأخراً أو دون\nتسجيل خروج)، والغياب، والإجازة. يشمل كل الموظفين النشطين.\n\nتُستبعد عطل نهاية الأسبوع والعطل الرسمية كلياً، فلا نقطة لفترة كل أيامها راحة (لا ترسم صفراً مكانها).\nالإجازة هنا جزء من المجموع، بخلاف `commitment_percentage`. يبدأ الأسبوع من `from` (١–٧، ٨–١٤…) لا من\nأسبوع التقويم، و`date` هو أول يوم في الفترة الجزئية. يُسجَّل الغياب كل ليلة عن اليوم السابق، فلا يظهر\nاليوم الحالي في المنحنى أبداً.\n\n**متى تستخدمه:** \"هل يتحسن الحضور؟\"، \"أي أسبوع كان الأسوأ؟\". لرقم واحد لكل قسم استخدم\n`attendance_reports.by_department`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"name":"granularity","in":"query","required":false,"schema":{"type":"string","enum":["daily","weekly","monthly"]},"description":"One point per `daily` (default), `weekly` or `monthly` bucket.","x-description-ar":"نقطة لكل يوم `daily` (الافتراضي) أو أسبوع `weekly` أو شهر `monthly`.","example":"weekly"}],"responses":{"200":{"description":"The chart points, oldest first.","x-description-ar":"نقاط المنحنى، الأقدم أولاً.","content":{"application/json":{"example":{"granularity":"weekly","points":[{"date":"2026-07-01","attendance_rate":92.5,"absent_rate":3.0,"on_leave_rate":4.5},{"date":"2026-07-08","attendance_rate":95.1,"absent_rate":1.2,"on_leave_rate":3.7}]},"schema":{"type":"object","properties":{"granularity":{"type":"string","description":"The bucket size used.","x-description-ar":"حجم الفترة الجزئية المستخدم."},"points":{"type":"array","description":"One per bucket that has a working day, oldest first.","x-description-ar":"نقطة لكل فترة جزئية فيها يوم عمل، الأقدم أولاً.","items":{"type":"object","properties":{"date":{"type":"string","description":"First day of the bucket.","x-description-ar":"أول يوم في الفترة الجزئية.","format":"date"},"attendance_rate":{"type":"number","description":"% of employee-days attended.","x-description-ar":"نسبة أيام الحضور من أيام الموظفين."},"absent_rate":{"type":"number","description":"% absent.","x-description-ar":"نسبة الغياب."},"on_leave_rate":{"type":"number","description":"% on leave.","x-description-ar":"نسبة الإجازة."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A parameter is not valid.","x-description-ar":"معامل غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"A date not in `YYYY-MM-DD`, `from` after `to`, a period longer than 366 days, or a `granularity` other than daily, weekly or monthly. `error` says which.","x-meaning-ar":"تاريخ ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً، أو `granularity` غير daily وweekly وmonthly. توضح `error` أيها.","x-fix":"Fix the parameter named in `error` and send again.","x-fix-ar":"صحّح المعامل المذكور في `error` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Granularity must be one of: daily, weekly, monthly.","code":"validation_failed"}}}}}}},"/hr_leaves/employees":{"get":{"summary":"List employees with their leave balances","operationId":"hr_leaves.employees","tags":["HR leave overview"],"description":"Returns the employees still employed (active or on notice), alphabetically, each with their headline\nbalance (annual leave, or the policy named in `leave_policy_id`), their other balances, the leave they are on\ntoday, their pending requests and, when leaving, their last working day. `counts` gives the totals for the\nsearch: all, on leave today, with pending requests (the two switches do not change them).\n\n**When to use:** for \"who is on leave today?\" (`on_leave_today=true`), \"who has requests waiting?\"\n(`has_pending=true`) or \"how much annual leave does everyone have left?\". For one employee, use\n`hr_leaves.employee` or `time_off.balances`.\n\n**Prerequisites:** none. Needs \"View others' time off\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين مع أرصدة إجازاتهم","x-description-ar":"يعرض الموظفين الذين ما زالوا على رأس العمل (نشطين أو في فترة الإشعار) مرتبين أبجدياً، ولكل منهم رصيده الرئيسي\n(الإجازة السنوية، أو السياسة المحددة في `leave_policy_id`)، وأرصدته الأخرى، والإجازة التي هو فيها اليوم،\nوطلباته المعلّقة، وآخر يوم عمل إن كان مغادراً. ويعطي `counts` إجماليات البحث: الكل، ومن في إجازة اليوم، ومن\nلديهم طلبات معلّقة (ولا يغيّرها المفتاحان).\n\n**متى تستخدمه:** لسؤال «من في إجازة اليوم؟» (`on_leave_today=true`)، أو «من لديه طلبات منتظرة؟»\n(`has_pending=true`)، أو «كم بقي لكل موظف من إجازته السنوية؟». لموظف واحد استخدم `hr_leaves.employee` أو\n`time_off.balances`.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ موظفاً في الصفحة.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"on_leave_today","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only employees on approved leave today.","x-description-ar":"`true`: من هم في إجازة معتمدة اليوم فقط.","example":true},{"name":"has_pending","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only employees with requests waiting on a decision.","x-description-ar":"`true`: من لديهم طلبات تنتظر القرار فقط.","example":true},{"name":"leave_policy_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Show this policy as each row's `primary_balance` (null where not held).","x-description-ar":"اعرض هذه السياسة في `primary_balance` لكل صف (وnull لمن لا يملكها).","example":7},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains (English or Arabic).","x-description-ar":"الاسم يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string","enum":["employee_name asc","employee_name desc","pending_count desc"]},"description":"Sort. `employee_name asc` when omitted.","x-description-ar":"الترتيب. `employee_name asc` إن لم يُرسل.","example":"pending_count desc"}],"responses":{"200":{"description":"A page of employees, with the counts.","x-description-ar":"صفحة من الموظفين مع الإجماليات.","content":{"application/json":{"example":{"counts":{"total":86,"on_leave_today":3,"has_pending":7},"records":[{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","job_title":"Accountant","department":{"id":4,"name":"Finance"},"manager":{"id":88,"full_name":"Omar Ali"},"employment_status":"active","last_working_day":null,"on_leave":{"leave_type":"Annual Leave","until":"2026-11-30"},"pending":{"count":1,"days":"3.0"},"primary_balance":{"leave_policy_id":7,"name":"Annual Leave","unit":"days","unmetered":false,"available":"18.0","entitled":"25.0","taken":"4.0","pending_days":"3.0"},"other_balances":[{"leave_policy_id":9,"name":"Sick Leave","unit":"days","unmetered":false,"available":"30.0"}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":3,"pages":1}},"schema":{"type":"object","required":["counts","records","pagination"],"properties":{"counts":{"type":"object","description":"Totals for the search.","x-description-ar":"إجماليات البحث.","properties":{"total":{"type":"integer","description":"Employees matching the search.","x-description-ar":"الموظفون المطابقون للبحث."},"on_leave_today":{"type":"integer","description":"Of those, on leave today.","x-description-ar":"منهم في إجازة اليوم."},"has_pending":{"type":"integer","description":"Of those, with pending requests.","x-description-ar":"منهم لديهم طلبات معلّقة."}}},"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_leave_employee_row"},"description":"The employees on this page.","x-description-ar":"الموظفون في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_leaves/employees/{id}":{"get":{"summary":"Get one employee's leave summary","operationId":"hr_leaves.employee","tags":["HR leave overview"],"description":"Returns one employee's leave picture, the same row as `hr_leaves.employees`: headline and other balances,\nleave they are on today, pending requests and, when leaving, the last working day. Works for employees who\nhave left too.\n\n**When to use:** for a quick \"where does Sara stand on leave?\". For every policy's full figures use\n`time_off.balances`; for the requests themselves `time_off.leave_requests`.\n\n**Prerequisites:** the employee's `id` from `hr_leaves.employees` or `employees.list`. Needs \"View others'\ntime off\".\n\n**Side effects:** none.","x-summary-ar":"عرض ملخص إجازات موظف","x-description-ar":"يعرض وضع إجازات موظف واحد، وهو الصف نفسه في `hr_leaves.employees`: الرصيد الرئيسي والأرصدة الأخرى، والإجازة التي\nهو فيها اليوم، والطلبات المعلّقة، وآخر يوم عمل إن كان مغادراً. ويعمل أيضاً لمن غادروا.\n\n**متى تستخدمه:** لسؤال سريع مثل «ما وضع سارة في الإجازات؟». للأرقام الكاملة لكل سياسة استخدم\n`time_off.balances`، وللطلبات نفسها `time_off.leave_requests`.\n\n**المتطلبات:** رقم `id` الموظف من `hr_leaves.employees` أو `employees.list`. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_leave_employee_id"},{"name":"leave_policy_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Show this policy as `primary_balance` (null if not held).","x-description-ar":"اعرض هذه السياسة في `primary_balance` (وnull إن لم تكن مسندة).","example":7}],"responses":{"200":{"description":"The employee's leave summary.","x-description-ar":"ملخص إجازات الموظف.","content":{"application/json":{"example":{"record":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","job_title":"Accountant","department":{"id":4,"name":"Finance"},"manager":{"id":88,"full_name":"Omar Ali"},"employment_status":"active","last_working_day":null,"on_leave":{"leave_type":"Annual Leave","until":"2026-11-30"},"pending":{"count":1,"days":"3.0"},"primary_balance":{"leave_policy_id":7,"name":"Annual Leave","unit":"days","unmetered":false,"available":"18.0","entitled":"25.0","taken":"4.0","pending_days":"3.0"},"other_balances":[{"leave_policy_id":9,"name":"Sick Leave","unit":"days","unmetered":false,"available":"30.0"}]}},"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/hr_leave_employee_row"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/hr_leaves/export":{"get":{"summary":"Export the company's leave requests to Excel or CSV","operationId":"hr_leaves.export","tags":["HR leave overview"],"description":"Builds a file of the leave requests `hr_leaves.requests` would list for the same filters (the waiting queue\nby default), with the columns you choose: Excel with `format=xlsx`, CSV with `format=csv`. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background and the answer is `202` with the\nexport record (its `download_url` is set once the file is ready); above 20,000 it is refused.\n\n**When to use:** when someone wants the list as a file. To answer a question, read `hr_leaves.requests`\ninstead.\n\n**Prerequisites:** column keys from `hr_leaves.export_columns`. Needs \"Export HR data\" and \"View others'\ntime off\".\n\n**Side effects:** every attempt past the parameter checks is recorded as an export of the token's owner and\nin the audit log. One export of this list per person runs at a time.\n\n**Not offered to Claude:** it returns a file, not JSON, and copies the company's leave data out of QHR.","x-summary-ar":"تصدير طلبات الإجازة في الشركة إلى Excel أو CSV","x-description-ar":"يُنشئ ملفاً بطلبات الإجازة التي يعرضها `hr_leaves.requests` للتصفيات نفسها (قائمة الانتظار افتراضياً)، بالأعمدة\nالتي تختارها: Excel مع `format=xlsx`، وCSV مع `format=csv`. حتى ١٠٬٠٠٠ صف يعود الملف فوراً، وفوق ذلك يُبنى في\nالخلفية ويكون الرد `202` مع سجل التصدير (ويُملأ `download_url` حين يجهز الملف)، وفوق ٢٠٬٠٠٠ يُرفض.\n\n**متى تستخدمه:** حين يريد شخص القائمة ملفاً. وللإجابة عن سؤال اقرأ `hr_leaves.requests` بدلاً منه.\n\n**المتطلبات:** مفاتيح الأعمدة من `hr_leaves.export_columns`. يحتاج صلاحيتي «تصدير بيانات الموارد البشرية» و«عرض\nإجازات الآخرين».\n\n**الآثار الجانبية:** تُسجَّل كل محاولة تتجاوز فحص المعاملات تصديراً لصاحب الرمز وفي سجل التدقيق. ولا يعمل لكل شخص\nإلا تصدير واحد لهذه القائمة في الوقت نفسه.\n\n**لا يُعرض على Claude:** لأنه يعيد ملفاً لا JSON، وينسخ بيانات إجازات الشركة خارج QHR.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"}]},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File type: `xlsx` (Excel) or `csv`. Without it the answer is 400 `bad_format`.","x-description-ar":"نوع الملف: `xlsx` (Excel) أو `csv`. ودونه يكون الرد 400 بالرمز `bad_format`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"style":"form","explode":true,"schema":{"type":"array","items":{"type":"string"}},"description":"Column keys from `hr_leaves.export_columns`, in the order wanted; repeat the parameter per column.","x-description-ar":"مفاتيح الأعمدة من `hr_leaves.export_columns` بالترتيب المطلوب؛ كرّر المعامل لكل عمود.","example":["employee_name","start_date","end_date","status"]},{"name":"stage","in":"query","required":false,"schema":{"type":"string","enum":["hr","manager"]},"description":"As in `hr_leaves.requests`.","x-description-ar":"كما في `hr_leaves.requests`.","example":"hr"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","cancelled","revoked"]},"description":"Only this status, as in `hr_leaves.requests`.","x-description-ar":"حالة محددة فقط، كما في `hr_leaves.requests`.","example":"approved"},{"name":"q[start_date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or after this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو بعده.","example":"2026-01-01"},{"name":"q[start_date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or before this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو قبله.","example":"2026-12-31"}],"responses":{"200":{"description":"The file: Excel for `format=xlsx`, CSV (`text/csv`) for `format=csv`.","x-description-ar":"الملف: Excel مع `format=xlsx`، وCSV (`text/csv`) مع `format=csv`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows to build at once: the export is queued.","x-description-ar":"الصفوف أكثر من أن يُبنى الملف فوراً: التصدير في قائمة الانتظار.","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"type":"object","description":"The queued export.","x-description-ar":"التصدير المنتظر.","properties":{"id":{"type":"integer","description":"Export id.","x-description-ar":"رقم التصدير."},"page":{"type":"string","description":"Always `hr_leaves`.","x-description-ar":"دائماً `hr_leaves`."},"format":{"type":"string","description":"`xlsx` or `csv`.","x-description-ar":"`xlsx` أو `csv`."},"status":{"type":"string","description":"`queued`, `processing`, then `ready` or `failed`.","x-description-ar":"`queued` منتظر، `processing` قيد البناء، ثم `ready` جاهز أو `failed` فشل."},"total_records":{"type":"integer","description":"Requests to export.","x-description-ar":"الطلبات المراد تصديرها.","nullable":true},"total_rows":{"type":"integer","description":"Rows written, once built.","x-description-ar":"الصفوف المكتوبة بعد البناء.","nullable":true},"processed_rows":{"type":"integer","description":"Rows done so far.","x-description-ar":"الصفوف المنجزة حتى الآن.","nullable":true},"filename":{"type":"string","description":"The file's name.","x-description-ar":"اسم الملف."},"error_code":{"type":"string","description":"Why it failed, if it did.","x-description-ar":"سبب الفشل إن فشل.","nullable":true},"created_at":{"type":"string","description":"When it was asked for (UTC, ISO 8601).","x-description-ar":"وقت طلبه (UTC بصيغة ISO 8601)."},"snapshot_at":{"type":"string","description":"The moment the data is taken from.","x-description-ar":"لحظة أخذ البيانات.","nullable":true},"finished_at":{"type":"string","description":"When it finished.","x-description-ar":"وقت انتهائه.","nullable":true},"expires_at":{"type":"string","description":"When the file is deleted.","x-description-ar":"وقت حذف الملف.","nullable":true},"download_url":{"type":"string","description":"Where to download it once ready; null until then and after expiry.","x-description-ar":"رابط تنزيله حين يجهز؛ وnull قبل ذلك وبعد انتهاء صلاحيته.","nullable":true}}}}},"example":{"export":{"id":412,"page":"hr_leaves","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":null,"filename":"QHR_HR_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T09:00:00Z","snapshot_at":"2026-11-27T09:00:00Z","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The request is not complete.","x-description-ar":"الطلب غير مكتمل.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` sent.","x-meaning-ar":"لم تُرسل `columns[]`.","x-fix":"Send column keys from `hr_leaves.export_columns`.","x-fix-ar":"أرسل مفاتيح أعمدة من `hr_leaves.export_columns`."},{"code":"unknown_column","meaning":"A column key is not offered to you on this list.","x-meaning-ar":"مفتاح عمود غير متاح لك في هذه القائمة.","x-fix":"Use only keys from `hr_leaves.export_columns`.","x-fix-ar":"استخدم المفاتيح الواردة في `hr_leaves.export_columns` فقط."},{"code":"bad_filters","meaning":"A filter is malformed.","x-meaning-ar":"تصفية بصيغة غير صحيحة.","x-fix":"Check the filters against `hr_leaves.requests`.","x-fix-ar":"راجع التصفيات حسب `hr_leaves.requests`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","error_code":"bad_format","code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this list is already running.","x-description-ar":"يوجد تصدير لهذه القائمة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"The token's owner already has an export of this list being built; `export` describes it.","x-meaning-ar":"لدى صاحب الرمز تصدير لهذه القائمة قيد البناء؛ ويصفه `export`.","x-fix":"Wait for that export to finish, then try again.","x-fix-ar":"انتظر انتهاء ذلك التصدير ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress"}}}},"422":{"description":"There is nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"No request matches the filters.","x-meaning-ar":"لا يوجد طلب يطابق التصفيات.","x-fix":"Widen the filters.","x-fix-ar":"وسّع التصفيات."},{"code":"too_large","meaning":"More than 20,000 rows would be written; `row_count` and `max_rows` say how many.","x-meaning-ar":"سيُكتب أكثر من ٢٠٬٠٠٠ صف؛ ويوضح `row_count` و`max_rows` العدد.","x-fix":"Narrow the filters or the date range.","x-fix-ar":"ضيّق التصفيات أو الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/hr_leaves/export/columns":{"get":{"summary":"List the columns of the leave request export","operationId":"hr_leaves.export_columns","tags":["HR leave overview"],"description":"Returns the columns `hr_leaves.export` can put in the file, in order, with their label in the requested\nlanguage, their type and whether they are ticked by default.\n\n**When to use:** before `hr_leaves.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs \"Export HR data\" and \"View others' time off\".\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير طلبات الإجازة","x-description-ar":"يعرض الأعمدة التي يستطيع `hr_leaves.export` وضعها في الملف، بالترتيب، مع تسميتها بلغة الطلب ونوعها وهل هي\nمختارة افتراضياً.\n\n**متى تستخدمه:** قبل `hr_leaves.export` لاختيار `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. يحتاج صلاحيتي «تصدير بيانات الموارد البشرية» و«عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"}]},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns.","x-description-ar":"الأعمدة.","content":{"application/json":{"example":{"columns":[{"key":"employee_no","label":"Employee ID","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"start_date","label":"Start Date","default":true,"type":"date"},{"key":"compensation_type","label":"Compensation","default":false,"type":"enum"}]},"schema":{"type":"object","required":["columns"],"properties":{"columns":{"type":"array","description":"The columns, in file order.","x-description-ar":"الأعمدة بترتيبها في الملف.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Column header, in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default.","x-description-ar":"مختار افتراضياً."},"type":{"type":"string","description":"`string`, `date`, `datetime`, `number`, `integer`, `boolean` or `enum`.","x-description-ar":"`string` أو `date` أو `datetime` أو `number` أو `integer` أو `boolean` أو `enum`."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_leaves/requests":{"get":{"summary":"List the company's leave requests","operationId":"hr_leaves.requests","tags":["HR leave overview"],"description":"Returns leave requests across the whole company, newest first. By default only the waiting queue: requests\nstill pending, and approved ones whose cancellation is under review. Send a status filter (`q[status_eq]`)\nto see decided requests too. `stage=hr` narrows to what waits on HR, `stage=manager` to what waits on\nmanagers, and `overdue=true` to pending requests whose first day has passed. Each row says where it waits\nand whether the token's owner can decide it now (`can_act`).\n\n**When to use:** for \"which leave requests are waiting?\" or \"who asked for leave in December?\". For one\nemployee's history, `time_off.leave_requests` is lighter; for the counts only, `hr_leaves.stat_cards`.\n\n**Prerequisites:** none. Ids for `q[leave_policy_id_eq]` come from `time_off.balances`. Needs \"View others'\ntime off\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الإجازة في الشركة","x-description-ar":"يعرض طلبات الإجازة في الشركة كلها، الأحدث أولاً. افتراضياً قائمة الانتظار فقط: الطلبات المعلّقة، والمعتمدة التي\nعليها طلب إلغاء قيد المراجعة. أرسل تصفية بالحالة (`q[status_eq]`) لرؤية الطلبات المحسومة أيضاً. ويقصر\n`stage=hr` القائمة على ما ينتظر الموارد البشرية، و`stage=manager` على ما ينتظر المديرين، و`overdue=true` على\nالطلبات المعلّقة التي مضى أول أيامها. ويوضح كل صف أين ينتظر الطلب وهل يستطيع صاحب الرمز البت فيه الآن (`can_act`).\n\n**متى تستخدمه:** لسؤال «ما طلبات الإجازة المنتظرة؟» أو «من طلب إجازة في ديسمبر؟». لسجل موظف واحد،\n`time_off.leave_requests` أخف؛ وللأرقام فقط `hr_leaves.stat_cards`.\n\n**المتطلبات:** لا شيء. أرقام `q[leave_policy_id_eq]` من `time_off.balances`. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"stage","in":"query","required":false,"schema":{"type":"string","enum":["hr","manager"]},"description":"`hr`: only what waits on HR. `manager`: only what waits on managers.","x-description-ar":"`hr`: ما ينتظر الموارد البشرية فقط. `manager`: ما ينتظر المديرين فقط.","example":"hr"},{"name":"overdue","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only pending requests whose first day has passed.","x-description-ar":"`true`: الطلبات المعلّقة التي مضى أول أيامها فقط.","example":true},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","cancelled","revoked"]},"description":"Only this status. Sending any status filter lifts the waiting-queue default.","x-description-ar":"حالة محددة فقط. وإرسال أي تصفية بالحالة يلغي اقتصار القائمة على الانتظار.","example":"approved"},{"name":"q[leave_policy_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this leave policy.","x-description-ar":"سياسة إجازة محددة فقط.","example":7},{"name":"q[start_date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or after this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو بعده.","example":"2026-12-01"},{"name":"q[start_date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Leave starting on or before this date.","x-description-ar":"الإجازات التي تبدأ في هذا التاريخ أو قبله.","example":"2026-12-31"},{"name":"q[employee_employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee name contains (English or Arabic).","x-description-ar":"اسم الموظف يحتوي على (بالعربية أو الإنجليزية).","example":"Sara"},{"name":"q[employee_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc` on `created_at`, `start_date`, `end_date` or `status`. Newest first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` على `created_at` أو `start_date` أو `end_date` أو `status`. الأحدث أولاً إن لم يُرسل.","example":"start_date asc"}],"responses":{"200":{"description":"A page of leave requests.","x-description-ar":"صفحة من طلبات الإجازة.","content":{"application/json":{"example":{"records":[{"id":5521,"employee_id":1203,"start_date":"2026-12-14","end_date":"2026-12-16","balance":"3.0","status":"pending","created_at":"2026-11-20 08:15:00 UTC","days_pending":7,"employee_no":"E-0042","employee_name":"Sara Ahmed","employee_image":null,"leave_type_name":"Annual Leave","compensation_type":"fully_paid","compensation_type_label":"Fully Paid","current_stage":"awaiting_hr","overdue":false,"can_act":true,"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_leave_request_row"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_leaves/stat_cards":{"get":{"summary":"Get the HR leave headline counts","operationId":"hr_leaves.stat_cards","tags":["HR leave overview"],"description":"Returns the counts at the top of HR's Leaves page in one call: requests waiting on HR (`needs_my_action`) and\nhow many of them came in today and yesterday; everything waiting on anyone (`all_pending`, cancellations\nunder review included); pending requests whose first day has passed (`overdue`); requests approved this\nmonth and last month; and the number of employees. Days are the company's own time zone.\n\n**When to use:** for \"how many leave requests are waiting?\" or a quick daily summary. To see the requests\nthemselves, use `hr_leaves.requests`.\n\n**Prerequisites:** none. Needs \"View others' time off\".\n\n**Side effects:** none.","x-summary-ar":"عرض أرقام الإجازات الرئيسية للموارد البشرية","x-description-ar":"يعرض الأرقام أعلى صفحة الإجازات لدى الموارد البشرية في استدعاء واحد: الطلبات التي تنتظر الموارد البشرية\n(`needs_my_action`) وكم منها ورد اليوم وأمس؛ وكل ما ينتظر أي معتمِد (`all_pending`، بما فيه طلبات الإلغاء قيد\nالمراجعة)؛ والطلبات المعلّقة التي مضى أول أيامها (`overdue`)؛ والطلبات المعتمدة هذا الشهر والشهر الماضي؛ وعدد\nالموظفين. الأيام بتوقيت الشركة.\n\n**متى تستخدمه:** لسؤال «كم طلب إجازة ينتظر؟» أو لملخص يومي سريع. لرؤية الطلبات نفسها استخدم\n`hr_leaves.requests`.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية «عرض إجازات الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/view_others","label":"View others' time off","x-label-ar":"عرض إجازات الآخرين"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأرقام.","content":{"application/json":{"example":{"data":{"needs_my_action":4,"submitted_today":1,"submitted_yesterday":2,"submitted_delta":-1,"all_pending":9,"overdue":1,"approved_this_month":12,"approved_last_month":15,"approved_delta":-3,"total_employees":86}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The counts.","x-description-ar":"الأرقام.","properties":{"needs_my_action":{"type":"integer","description":"Requests waiting at the HR stage.","x-description-ar":"الطلبات المنتظرة في مرحلة الموارد البشرية."},"submitted_today":{"type":"integer","description":"Of those, submitted today.","x-description-ar":"منها ما قُدّم اليوم."},"submitted_yesterday":{"type":"integer","description":"Of those, submitted yesterday.","x-description-ar":"منها ما قُدّم أمس."},"submitted_delta":{"type":"integer","description":"Today minus yesterday.","x-description-ar":"اليوم ناقص أمس."},"all_pending":{"type":"integer","description":"Everything waiting on anyone, cancellations under review included.","x-description-ar":"كل ما ينتظر أي معتمِد، بما فيه طلبات الإلغاء قيد المراجعة."},"overdue":{"type":"integer","description":"Pending requests whose first day has passed.","x-description-ar":"الطلبات المعلّقة التي مضى أول أيامها."},"approved_this_month":{"type":"integer","description":"Requests finally approved this month.","x-description-ar":"الطلبات المعتمدة نهائياً هذا الشهر."},"approved_last_month":{"type":"integer","description":"Requests finally approved last month.","x-description-ar":"الطلبات المعتمدة نهائياً الشهر الماضي."},"approved_delta":{"type":"integer","description":"This month minus last month.","x-description-ar":"هذا الشهر ناقص الشهر الماضي."},"total_employees":{"type":"integer","description":"Employees still employed (active or on notice).","x-description-ar":"الموظفون الذين ما زالوا على رأس العمل (نشطون أو في فترة الإشعار)."}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans":{"post":{"summary":"Lend to an employee directly","operationId":"hr_loans.create","tags":["Loans"],"description":"Creates a loan for an employee and approves it in one step: the request (`amount`, `description`,\n`needed_on`) and HR's terms (`channel` and its dates) together. With no accounting approval it comes out\n`approved` — a direct loan is paid out at once (a payment is recorded), a payroll loan gets its monthly\ninstallments for the coming runs. In a company connected to Qoyod it comes out `pending_accounting` until\nan accountant approves it. A refused request leaves no loan behind.\n\n**When to use:** when HR lends without the employee filing a request. To decide an employee's own request,\nuse `hr_loans.approve`.\n\n**Prerequisites:** `employee_id` of an employed person, from `employees.list` (a leaver answers 404). The\ntoken's owner must be an employee: the loan is recorded as requested and approved by them.\n\n**Side effects:** lends company money: a payout payment or installments deducted from future payslips; the\npayout is sent to Qoyod accounting when connected; the employee is emailed the decision. Recorded in the\naudit log. Not offered to Claude, because it moves company money.","x-summary-ar":"منح سلفة لموظف مباشرةً","x-description-ar":"ينشئ سلفة لموظف ويعتمدها في خطوة واحدة: الطلب (`amount` و`description` و`needed_on`) وشروط الموارد البشرية\n(`channel` وتواريخه) معاً. دون اعتماد محاسبي تصدر `approved` — تُصرف السلفة المباشرة فوراً (وتُسجَّل دفعة)،\nوتحصل السلفة عبر الرواتب على أقساطها الشهرية للمسيّرات القادمة. وفي الشركة المرتبطة بقيود تصدر\n`pending_accounting` حتى يعتمدها محاسب. الطلب المرفوض لا يترك سلفة خلفه.\n\n**متى تستخدمه:** عندما تُقرض الموارد البشرية دون طلب من الموظف. للبتّ في طلب قدّمه الموظف استخدم\n`hr_loans.approve`.\n\n**المتطلبات:** `employee_id` لموظف على رأس العمل، من `employees.list` (من غادر يُرجع 404). يجب أن يكون صاحب\nالرمز موظفاً، إذ تُسجَّل السلفة بأنه طلبها واعتمدها.\n\n**الآثار الجانبية:** يُقرض مال الشركة: دفعة صرف أو أقساط تُستقطع من القسائم القادمة؛ ويُرسل الصرف إلى محاسبة\nقيود عند الربط؛ ويصل الموظفَ بريد بالقرار. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يحرّك مال الشركة.","x-access":"write","x-permission":{"key":"loan/approve","label":"Approve loan requests","x-label-ar":"الموافقة على طلبات السلف"},"x-feature":"loan","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The approved loan.","x-description-ar":"السلفة المعتمدة.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"approved","channel":"payroll","description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","repayment":null,"payments":[],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[{"id":9001,"sequence":1,"payroll_id":null,"due_on":"2027-01-01","amount":"2083.33","currency":"SAR","status":"due"}],"accounting_mode":"legacy","accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The loan was refused; nothing was created.","x-description-ar":"رُفضت السلفة ولم يُنشأ شيء.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"The terms are refused: no `channel`; a direct loan without `repayment_due_on` or repaid before it is paid out; a payroll loan without both installment months, starting before the payout month, paid out in a period a payroll run has locked, or with a month's installments above the employee's net pay (or no active salary).","x-meaning-ar":"رُفضت الشروط: لا يوجد `channel`؛ أو سلفة مباشرة بلا `repayment_due_on` أو يسبق سدادُها صرفَها؛ أو سلفة عبر الرواتب بلا شهري القسط الأول والأخير، أو تبدأ قبل شهر الصرف، أو تُصرف في فترة أقفلها مسيّر رواتب، أو تتجاوز أقساط أحد أشهرها صافي راتب الموظف (أو لا يوجد راتب نشط).","x-fix":"Fix the field named in `error` — usually a longer repayment period or a later disbursement date.","x-fix-ar":"صحّح الحقل المذكور في `error` — غالباً بمدة سداد أطول أو تاريخ صرف لاحق."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","loan"],"properties":{"employee_id":{"type":"integer","description":"The borrower, from `employees.list`.","x-description-ar":"المستفيد، من `employees.list`."},"loan":{"type":"object","required":["amount","description","needed_on","channel"],"description":"Request and terms.","x-description-ar":"الطلب والشروط.","properties":{"amount":{"type":"string","description":"Amount, decimal string, more than 0.","x-description-ar":"المبلغ، نص عشري أكبر من 0."},"description":{"type":"string","description":"Purpose, up to 1000 characters.","x-description-ar":"الغرض، حتى ١٠٠٠ حرف."},"needed_on":{"type":"string","description":"Date the money is needed.","x-description-ar":"تاريخ الحاجة.","format":"date"},"channel":{"type":"string","description":"`payroll` (paid on a payslip, repaid in monthly installments) or `direct` (paid and repaid in one payment outside payroll).","x-description-ar":"`payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب.","enum":["payroll","direct"]},"disbursement_date":{"type":"string","description":"Payout date; defaults to the date the employee asked for.","x-description-ar":"تاريخ الصرف؛ الافتراضي هو التاريخ الذي طلبه الموظف.","format":"date"},"installments_start_on":{"type":"string","description":"Payroll loans: first installment month (any day; the 1st is used).","x-description-ar":"للسلفة عبر الرواتب: شهر أول قسط (أي يوم، ويُعتمد أول الشهر).","format":"date"},"installments_end_on":{"type":"string","description":"Payroll loans: last installment month. Installments are equal.","x-description-ar":"للسلفة عبر الرواتب: شهر آخر قسط. الأقساط متساوية.","format":"date"},"repayment_due_on":{"type":"string","description":"Direct loans: date the whole amount is to be repaid.","x-description-ar":"للسلفة المباشرة: تاريخ سداد المبلغ كاملاً.","format":"date"},"decision_note":{"type":"string","description":"Note shown to the employee.","x-description-ar":"ملاحظة تظهر للموظف."}}}}},"example":{"employee_id":1203,"loan":{"amount":"5000.00","description":"Rent advance.","needed_on":"2026-12-01","channel":"direct","repayment_due_on":"2027-03-01","decision_note":"Repay in March."}}}},"required":true,"description":"The employee, the request and the terms."}}},"/hr_loans/accounting_sync":{"get":{"summary":"List loans' delivery to Qoyod accounting","operationId":"hr_loans.accounting_sync","tags":["Loans"],"description":"Returns every decided loan and whether its accounting events — the payout (`loan.disbursed`) and, for a\ndirect loan, the repayment (`loan.repaid`) — reached Qoyod: one roll-up `sync_state` per loan (`problem`,\n`syncing`, `awaiting_accounting`, `synced`) with the per-event detail, and a `summary` of the counts. A\ncompany not connected to Qoyod gets an empty list and `connection_status: not_connected`.\n\n**When to use:** for \"did all our loans reach the books?\" or to find loans to re-send with\n`hr_loans.resync` (`can_sync: true`).\n\n**Prerequisites:** none. Re-sending needs \"Connect, configure and send to the accounting integration\".\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض حالة إرسال السلف إلى محاسبة قيود","x-description-ar":"يعرض كل سلفة بُتّ فيها وهل وصلت أحداثها المحاسبية إلى قيود — الصرف (`loan.disbursed`) والسداد (`loan.repaid`)\nللسلفة المباشرة — مع حالة إجمالية `sync_state` لكل سلفة (`problem`، `syncing`، `awaiting_accounting`،\n`synced`) وتفاصيل كل حدث، و`summary` بالأعداد. الشركة غير المرتبطة بقيود تحصل على قائمة فارغة و\n`connection_status: not_connected`.\n\n**متى تستخدمه:** لسؤال «هل وصلت كل سلفنا إلى الدفاتر؟» أو لإيجاد السلف التي يمكن إعادة إرسالها عبر\n`hr_loans.resync` (`can_sync: true`).\n\n**المتطلبات:** لا شيء. إعادة الإرسال تحتاج صلاحية «ربط تكامل المحاسبة وإعداده والإرسال إليه».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"sync_state","in":"query","required":false,"schema":{"type":"string","enum":["all","problem","syncing","awaiting_accounting","synced"]},"description":"Only loans in this roll-up state (or an event state such as `failed`, `posted`). `all` by default.","x-description-ar":"السلف بهذه الحالة الإجمالية فقط (أو حالة حدث مثل `failed` و`posted`). الافتراضي `all`.","example":"problem"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["all","pending_accounting","pending_settlement","approved","repaying","settled"]},"description":"Only loans in this status.","x-description-ar":"السلف بهذه الحالة فقط.","example":"approved"},{"name":"period","in":"query","required":false,"schema":{"type":"string"},"description":"Month of the latest event, `YYYY-MM`.","x-description-ar":"شهر آخر حدث بالشكل `YYYY-MM`.","example":"2026-11"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["event_at","decided_at","amount"]},"description":"Sort field; `event_at` (latest event) by default.","x-description-ar":"حقل الترتيب؛ الافتراضي `event_at`.","example":"event_at"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]},"description":"Sort direction; `desc` by default.","x-description-ar":"اتجاه الترتيب؛ الافتراضي `desc`.","example":"desc"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The sync list.","x-description-ar":"قائمة الإرسال.","content":{"application/json":{"example":{"connection_status":"connected","sync_enabled":true,"summary":{"total":1,"synced":0,"syncing":0,"awaiting_accounting":0,"problem":1},"records":[{"loan_id":419,"reference":"LON-0043","employee_id":1203,"status":"approved","channel":"direct","employee_no":"E-0042","employee_name":"Sara Ahmed","currency":"SAR","amount":"5000.00","disbursement_date":"2026-09-10","decided_at":"2026-09-08T10:00:00Z","sync_state":"problem","can_sync":true,"events":[{"event_type":"loan.disbursed","event_id":null,"state":"not_sent","title":"Loan payout LON-0043","amount":"5000.00","currency":"SAR","occurred_at":null,"can_sync":true,"sync_reason":"never_sent","reason":null,"journal_entry":null,"attempts":0,"next_attempt_at":null}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"connection_status":{"type":"string","description":"`connected`, `needs_reauth`, `disconnected` or `not_connected`.","x-description-ar":"`connected` مرتبط، `needs_reauth` يحتاج إعادة تفويض، `disconnected` مفصول، `not_connected` غير مرتبط."},"sync_enabled":{"type":"boolean","description":"True when sending to Qoyod is switched on.","x-description-ar":"صحيح إن كان الإرسال إلى قيود مفعّلاً."},"summary":{"type":"object","description":"Counts: `total`, `synced`, `syncing`, `awaiting_accounting`, `problem`.","x-description-ar":"الأعداد: `total` و`synced` و`syncing` و`awaiting_accounting` و`problem`."},"records":{"type":"array","description":"One row per loan.","x-description-ar":"صف لكل سلفة.","items":{"type":"object","properties":{"loan_id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference.","x-description-ar":"مرجع السلفة."},"employee_id":{"type":"integer","description":"Borrower.","x-description-ar":"المستفيد."},"status":{"type":"string","description":"Loan status.","x-description-ar":"حالة السلفة."},"channel":{"type":"string","description":"`payroll` or `direct`.","x-description-ar":"`payroll` أو `direct`."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Borrower's name.","x-description-ar":"اسم المستفيد."},"currency":{"type":"string","description":"Currency.","x-description-ar":"العملة."},"amount":{"type":"string","description":"Amount, decimal string.","x-description-ar":"المبلغ، نص عشري."},"disbursement_date":{"type":"string","description":"Payout date.","x-description-ar":"تاريخ الصرف.","nullable":true},"decided_at":{"type":"string","description":"When HR decided.","x-description-ar":"وقت قرار الموارد البشرية.","nullable":true},"sync_state":{"type":"string","description":"`problem`, `syncing`, `awaiting_accounting` or `synced`.","x-description-ar":"`problem` مشكلة، `syncing` قيد الإرسال، `awaiting_accounting` بانتظار المحاسبة، `synced` مُرسل."},"can_sync":{"type":"boolean","description":"True when `hr_loans.resync` would send something.","x-description-ar":"صحيح إن كانت `hr_loans.resync` سترسل شيئاً."},"events":{"type":"array","description":"Per event: `event_type`, `state`, `sync_reason`, `reason`, `journal_entry`, `attempts`, `can_sync`…","x-description-ar":"لكل حدث: `event_type` و`state` و`sync_reason` و`reason` و`journal_entry` و`attempts` و`can_sync`…","items":{"type":"object"}}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans/employees_with_loans":{"get":{"summary":"List employees who still owe on a loan","operationId":"hr_loans.employees_with_loans","tags":["Loans"],"description":"Returns the employees who still owe money on a loan, with how many loans can be settled now, how many wait\nfor an accountant to approve a settlement, and the total still owed. Anyone whose loans are all settled is\nleft out.\n\n**When to use:** for \"who still owes the company money?\", or to pick an employee before\n`hr_loans.for_employee`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين عليهم سلف متبقية","x-description-ar":"يعرض الموظفين الذين ما زال عليهم مال من سلفة، مع عدد السلف القابلة للتسوية الآن، وعدد التسويات بانتظار اعتماد\nالمحاسب، وإجمالي المتبقي. يُستبعد من سُوّيت كل سلفه.\n\n**متى تستخدمه:** لسؤال «من ما زال مديناً للشركة؟»، أو لاختيار موظف قبل `hr_loans.for_employee`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains.","x-description-ar":"الاسم يحتوي على.","example":"Sara"},{"name":"q[employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of employees.","x-description-ar":"صفحة من الموظفين.","content":{"application/json":{"example":{"records":[{"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","department":"Finance","currency":"SAR","open_loans_count":1,"pending_settlement_count":0,"outstanding":"8333.34"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"Employees who still owe.","x-description-ar":"الموظفون المدينون.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Name.","x-description-ar":"الاسم."},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"currency":{"type":"string","description":"Pay currency.","x-description-ar":"عملة الراتب."},"open_loans_count":{"type":"integer","description":"Loans that can be settled now.","x-description-ar":"السلف القابلة للتسوية الآن."},"pending_settlement_count":{"type":"integer","description":"Settlements waiting for the accountant.","x-description-ar":"التسويات بانتظار المحاسب."},"outstanding":{"type":"string","description":"Total still owed, decimal string.","x-description-ar":"إجمالي المتبقي، نص عشري."}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans/export":{"get":{"summary":"Export the loan queue to Excel or CSV","operationId":"hr_loans.export","tags":["Loans"],"description":"Builds a file of the company's loans, newest submitted first, one row per loan, with the columns you choose\n(reference, employee, status, channel, currency, amount, needed date, payout and repayment dates, settlement\namount…) and a total of the amounts per currency. It holds the same loans as `hr_loans.list` with the same\n`q[…]` filters.\n\n**When to use:** to hand the loan book to finance or to archive it. To read loans, `hr_loans.list` is lighter.\n\n**Prerequisites:** column keys from `hr_loans.export_columns`. You need \"Export payroll data\" as well as\n\"View all employees' loans\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير قائمة السلف إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بسلف الشركة، الأحدث تقديماً أولاً، صف لكل سلفة، بالأعمدة التي تختارها (المرجع والموظف والحالة\nوطريقة السداد والعملة والمبلغ وتاريخ الحاجة وتواريخ الصرف والسداد ومبلغ التسوية…) مع مجموع المبالغ لكل عملة.\nيضم السلف نفسها التي تعرضها `hr_loans.list` بفلاتر `q[…]` نفسها.\n\n**متى تستخدمه:** لتسليم سجل السلف إلى المالية أو لأرشفته. لقراءة السلف `hr_loans.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `hr_loans.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض\nسلف جميع الموظفين» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"}]},"x-feature":"loan","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this status, as in `hr_loans.list`.","x-description-ar":"هذه الحالة فقط، كما في `hr_loans.list`.","example":"approved"}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/hr_loans/export/columns":{"get":{"summary":"List the columns a loans export can have","operationId":"hr_loans.export_columns","tags":["Loans"],"description":"Returns the columns of the loans export, in screen order, with their header in the requested language and\nwhether QHR ticks them by default.\n\n**When to use:** before `hr_loans.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View all employees' loans\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير السلف","x-description-ar":"يعرض أعمدة تصدير السلف بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب، وهل يحددها QHR افتراضياً.\n\n**متى تستخدمه:** قبل `hr_loans.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض سلف جميع الموظفين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"}]},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"status","label":"Status","default":true,"type":"enum"},{"key":"amount","label":"Amount","default":true,"type":"money"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans/for_employee":{"get":{"summary":"List one employee's loans for settlement","operationId":"hr_loans.for_employee","tags":["Loans"],"description":"Returns every loan one employee has, newest first, with what was repaid, what is outstanding, the schedule,\nand for each one whether it can be settled now or why not (`settlement_block`). The top level adds the\nemployee, the total outstanding on the loans that can be settled, and the company's `accounting_mode`.\n\n**When to use:** for \"what does Sara still owe, and on which loans?\".\n\n**Prerequisites:** `employee_id` from `hr_loans.employees_with_loans` or `employees.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض سلف موظف واحد للتسوية","x-description-ar":"يعرض كل سلف موظف واحد، الأحدث أولاً، مع المسدَّد والمتبقي والجدول، وهل يمكن تسوية كلٍّ منها الآن أو سبب\nالتعذر (`settlement_block`). ويضيف المستوى الأعلى بيانات الموظف وإجمالي المتبقي على السلف القابلة للتسوية\nو`accounting_mode` للشركة.\n\n**متى تستخدمه:** لسؤال «كم بقي على سارة، وعلى أي سلف؟».\n\n**المتطلبات:** `employee_id` من `hr_loans.employees_with_loans` أو `employees.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"employee_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The employee, from `hr_loans.employees_with_loans`.","x-description-ar":"الموظف، من `hr_loans.employees_with_loans`.","example":1203},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The employee's loans.","x-description-ar":"سلف الموظف.","content":{"application/json":{"example":{"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","department":"Finance","currency":"SAR"},"totals":{"outstanding":"5000.00","settleable_count":1},"accounting_mode":"legacy","records":[{"id":419,"reference":"LON-0043","status":"approved","channel":"direct","installments_count":null,"currency":"SAR","amount":"5000.00","amount_repaid":"0.00","outstanding":"5000.00","disbursement_date":"2026-09-10","installments_paid":0,"installments_remaining":0,"settlement_amount":null,"settlement_date":null,"repaid_on":null,"repayment":{"due_on":"2026-12-10","repaid_on":null,"state":"not_due","days":13},"payments":[],"can_settle":true,"settlement_block":null,"accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"installments":[]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"employee":{"type":"object","description":"The employee: `id`, `employee_no`, `name`, `department`, `currency`.","x-description-ar":"الموظف: `id` و`employee_no` و`name` و`department` و`currency`."},"totals":{"type":"object","description":"`outstanding` (decimal string) and `settleable_count`, over the loans that can be settled.","x-description-ar":"`outstanding` (نص عشري) و`settleable_count` على السلف القابلة للتسوية."},"accounting_mode":{"type":"string","description":"`approval` (an accountant approves settlements) or `legacy`.","x-description-ar":"`approval` يعتمد محاسب التسويات، أو `legacy`."},"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_employee_loan"},"description":"The loans.","x-description-ar":"السلف."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/hr_loans/requests":{"get":{"summary":"List every employee's loans","operationId":"hr_loans.list","tags":["Loans"],"description":"Returns the company's loans and loan requests, newest submitted first, in every status, with the borrower,\nwho asked on their behalf, the amount, how it is repaid and whether the token's owner may approve, reject\nor settle each one now.\n\n**When to use:** to see what waits for a decision (`q[status_eq]=pending`), who has loans, or a loan's\n`id` for the other `hr_loans` operations. For totals use `hr_loans.stat_cards`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض سلف جميع الموظفين","x-description-ar":"يعرض سلف الشركة وطلباتها، الأحدث تقديماً أولاً، بكل الحالات، مع المستفيد ومن طلبها نيابةً عنه والمبلغ وطريقة\nالسداد، وهل يستطيع صاحب الرمز اعتماد كلٍّ منها أو رفضها أو تسويتها الآن.\n\n**متى تستخدمه:** لمعرفة ما ينتظر القرار (`q[status_eq]=pending`)، ومن لديه سلف، أو للحصول على رقم `id`\nالسلفة لعمليات `hr_loans` الأخرى. للإجماليات استخدم `hr_loans.stat_cards`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this status (`pending`, `approved`, `repaying`…).","x-description-ar":"هذه الحالة فقط (`pending`، `approved`، `repaying`…).","example":"pending"},{"name":"q[created_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or after.","x-description-ar":"قُدّمت في هذا التاريخ أو بعده.","example":"2026-11-01"},{"name":"q[created_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or before.","x-description-ar":"قُدّمت في هذا التاريخ أو قبله.","example":"2026-11-30"},{"name":"q[employee_employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Borrower's name contains.","x-description-ar":"اسم المستفيد يحتوي على.","example":"Sara"},{"name":"q[employee_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc` (`amount`, `needed_on`, `created_at`…). Newest first otherwise.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` (`amount`، `needed_on`، `created_at`…). الأحدث أولاً بخلاف ذلك.","example":"amount desc"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of loans.","x-description-ar":"صفحة من السلف.","content":{"application/json":{"example":{"records":[{"id":418,"reference":"LON-0042","employee_id":1203,"status":"pending","channel":null,"installments_count":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","repayment":null,"can_approve":true,"can_reject":true,"can_settle":false}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_loan_row"},"description":"The loans.","x-description-ar":"السلف."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans/settle":{"post":{"summary":"Settle several loans the employees paid back","operationId":"hr_loans.settle_batch","tags":["Loans"],"description":"Records that one or more loans were paid back outside payroll, all on the same `repaid_on`. All or nothing:\nif any loan cannot be settled, none is, and the refusal names that loan. A direct loan is settled for its whole amount; a payroll loan for what its installments have not collected yet, and\nits remaining installments are cancelled so nothing more is deducted from pay. Without accounting approval it is\nfinal at once: the loan becomes `settled` and a received payment is recorded on `repaid_on` (today by default, never\nin the future). In a company connected to Qoyod the loan becomes `pending_settlement` and nothing is recorded until an\naccountant approves; the answer is then 202 instead of 200.\n\n**When to use:** to settle everything an employee owes at once (e.g. before they leave), or several\nemployees' repayments in one go.\n\n**Prerequisites:** `loan_ids` from `hr_loans.for_employee` (loans with `can_settle: true`). The token's owner\nmust be an employee.\n\n**Side effects:** for each loan a received payment and cancelled installments, and the repayment\n(`loan.repaid`) sent to Qoyod accounting when connected. Recorded in the audit log. Cannot be undone and acts\non many loans, so it is not offered to Claude.","x-summary-ar":"تسوية عدة سلف سددها الموظفون","x-description-ar":"يسجّل أن سلفة أو أكثر سُدّدت خارج الرواتب، كلها بتاريخ `repaid_on` واحد. الكل أو لا شيء: إن تعذرت تسوية أي\nسلفة لا تُسوّى أي منها، ويذكر الرفض تلك السلفة. تُسوّى السلفة المباشرة بكامل مبلغها، وسلفة الرواتب بما لم تحصّله أقساطها بعد، وتُلغى أقساطها المتبقية فلا يُستقطع شيء\nآخر من الراتب. دون اعتماد محاسبي تكون التسوية نهائية فوراً: تصبح السلفة `settled` وتُسجَّل دفعة مقبوضة بتاريخ `repaid_on`\n(اليوم افتراضياً، ولا يكون في المستقبل). وفي الشركة المرتبطة بقيود تصبح السلفة `pending_settlement` ولا يُسجَّل شيء حتى\nيعتمد محاسب، ويكون الرد 202 بدلاً من 200.\n\n**متى تستخدمه:** لتسوية كل ما على الموظف دفعة واحدة (مثلاً قبل مغادرته)، أو سدادات عدة موظفين معاً.\n\n**المتطلبات:** `loan_ids` من `hr_loans.for_employee` (السلف التي `can_settle: true`). يجب أن يكون صاحب الرمز\nموظفاً.\n\n**الآثار الجانبية:** لكل سلفة دفعة مقبوضة وأقساط ملغاة، ويُرسل السداد (`loan.repaid`) إلى محاسبة قيود عند\nالربط. يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه ويشمل عدة سلف، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"loan/settle","label":"Settle loans (record a repayment)","x-label-ar":"تسوية السلف (تسجيل السداد)"},"x-feature":"loan","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Settled: `accounting_mode: legacy`, every loan `settled`.","x-description-ar":"سُوّيت: `accounting_mode: legacy` وكل السلف `settled`.","content":{"application/json":{"example":{"accounting_mode":"legacy","records":[{"id":419,"reference":"LON-0043","status":"settled","channel":"direct","currency":"SAR","settlement_amount":"5000.00","settlement_date":"2026-11-25","repaid_on":"2026-11-25","installments_voided":0,"payments":[{"id":701,"reference":"PAY-0701","kind":"paid","purpose":"disbursement","date":"2026-09-10","amount":"5000.00","currency":"SAR"},{"id":702,"reference":"PAY-0702","kind":"received","purpose":"repayment","date":"2026-11-25","amount":"5000.00","currency":"SAR"}],"accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null}}]},"schema":{"type":"object","properties":{"accounting_mode":{"type":"string","description":"`legacy` (settled now) or `approval` (waiting for the accountant).","x-description-ar":"`legacy` سُوّيت الآن، أو `approval` بانتظار المحاسب."},"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_loan_settlement"},"description":"Each loan after the settlement.","x-description-ar":"كل سلفة بعد التسوية."}}}}}},"202":{"description":"Submitted to the accountant: `accounting_mode: approval`, loans `pending_settlement`, nothing recorded yet.","x-description-ar":"أُرسلت إلى المحاسب: `accounting_mode: approval` والسلف `pending_settlement` ولم يُسجَّل شيء بعد.","content":{"application/json":{"example":{"accounting_mode":"approval","records":[{"id":419,"reference":"LON-0043","status":"pending_settlement","channel":"direct","currency":"SAR","settlement_amount":"5000.00","settlement_date":"2026-11-25","repaid_on":null,"installments_voided":0,"payments":[{"id":701,"reference":"PAY-0701","kind":"paid","purpose":"disbursement","date":"2026-09-10","amount":"5000.00","currency":"SAR"}],"accounting":{"gate":"loan","state":"queued","event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null}}]},"schema":{"type":"object","properties":{"accounting_mode":{"type":"string","description":"`approval`.","x-description-ar":"`approval`."},"records":{"type":"array","items":{"$ref":"#/components/schemas/hr_loan_settlement"},"description":"Each loan, waiting for the accountant.","x-description-ar":"كل سلفة بانتظار المحاسب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The settlement was refused; nothing was recorded.","x-description-ar":"رُفضت التسوية ولم يُسجَّل شيء.","x-codes":[{"code":"not_settleable","meaning":"The loan is not `approved` or `repaying`. `loan_id` and `reference` name the loan.","x-meaning-ar":"السلفة ليست `approved` أو `repaying`. يحدد `loan_id` و`reference` السلفة.","x-fix":"Settle only loans with `can_settle: true` in `hr_loans.for_employee`.","x-fix-ar":"سوِّ فقط السلف التي `can_settle: true` في `hr_loans.for_employee`."},{"code":"already_pending_settlement","meaning":"A settlement of the loan already waits for the accountant. `loan_id` and `reference` name the loan.","x-meaning-ar":"تسوية السلفة بانتظار المحاسب أصلاً. يحدد `loan_id` و`reference` السلفة.","x-fix":"Wait for the accountant's decision in Qoyod.","x-fix-ar":"انتظر قرار المحاسب في قيود."},{"code":"nothing_outstanding","meaning":"Nothing is left to repay on the loan. `loan_id` and `reference` name the loan.","x-meaning-ar":"لا يتبقى شيء للسداد على السلفة. يحدد `loan_id` و`reference` السلفة.","x-fix":"Leave that loan out.","x-fix-ar":"استبعد تلك السلفة."},{"code":"payout_not_delivered","meaning":"A payroll loan whose payout has not reached the employee yet. `loan_id` and `reference` name the loan.","x-meaning-ar":"سلفة رواتب لم يصل صرفها إلى الموظف بعد. يحدد `loan_id` و`reference` السلفة.","x-fix":"Pay the payroll run that carries the payout first, or cancel the loan.","x-fix-ar":"اصرف مسيّر الرواتب الذي يحمل الصرف أولاً، أو ألغِ السلفة."},{"code":"installment_in_flight","meaning":"An installment sits on a payroll run that has not been paid (named in `error`). `loan_id` and `reference` name the loan.","x-meaning-ar":"قسط على مسيّر رواتب لم يُصرف بعد (مذكور في `error`). يحدد `loan_id` و`reference` السلفة.","x-fix":"Pay or revert that payroll run first.","x-fix-ar":"اصرف ذلك المسيّر أو أرجعه أولاً."},{"code":"repaid_before_disbursement","meaning":"`repaid_on` is before the loan was paid out. `loan_id` and `reference` name the loan.","x-meaning-ar":"`repaid_on` يسبق صرف السلفة. يحدد `loan_id` و`reference` السلفة.","x-fix":"Send a `repaid_on` on or after the payout date.","x-fix-ar":"أرسل `repaid_on` في تاريخ الصرف أو بعده."},{"code":"repaid_in_future","meaning":"`repaid_on` is after today. `loan_id` and `reference` name the loan.","x-meaning-ar":"`repaid_on` بعد اليوم. يحدد `loan_id` و`reference` السلفة.","x-fix":"Record the repayment once the money has arrived.","x-fix-ar":"سجّل السداد بعد وصول المال."},{"code":"repaid_on_unreadable","meaning":"`repaid_on` is not a date.","x-meaning-ar":"`repaid_on` ليس تاريخاً.","x-fix":"Send `repaid_on` as `YYYY-MM-DD`.","x-fix-ar":"أرسل `repaid_on` بالشكل `YYYY-MM-DD`."},{"code":"no_loans","meaning":"`loan_ids` is empty.","x-meaning-ar":"`loan_ids` فارغة.","x-fix":"Send at least one loan id from `hr_loans.for_employee`.","x-fix-ar":"أرسل رقم سلفة واحداً على الأقل من `hr_loans.for_employee`."},{"code":"unknown_loans","meaning":"Some ids name no loan; they are listed in `loan_ids`. Nothing was settled.","x-meaning-ar":"بعض الأرقام لا تطابق أي سلفة، وهي مذكورة في `loan_ids`. لم يُسوَّ شيء.","x-fix":"Refresh the list with `hr_loans.for_employee` and send existing ids.","x-fix-ar":"حدّث القائمة عبر `hr_loans.for_employee` وأرسل أرقاماً موجودة."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a settlement is recorded in the name of the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والتسوية تُسجَّل باسم الموظف الذي أجراها.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required","error_code":"unknown_loans","loan_ids":["999"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["loan_ids"],"properties":{"loan_ids":{"type":"array","items":{"type":"integer"},"description":"Loans to settle, from `hr_loans.for_employee`.","x-description-ar":"السلف المراد تسويتها، من `hr_loans.for_employee`."},"repaid_on":{"type":"string","description":"Date the employee repaid; today when omitted. Not in the future, not before the payout.","x-description-ar":"تاريخ سداد الموظف؛ اليوم إن لم يُرسل. لا يكون في المستقبل ولا قبل الصرف.","format":"date"}}},"example":{"loan_ids":[419,420],"repaid_on":"2026-11-25"}}},"required":true,"description":"The loans and the repayment date."}}},"/hr_loans/stat_cards":{"get":{"summary":"Count and total loans by status","operationId":"hr_loans.stat_cards","tags":["Loans"],"description":"Returns how many loans were submitted and for how much, per status bucket (`pending`, `pending_accounting`,\n`pending_settlement`, `approved` — which includes repaying and settled — `rejected`, `cancelled`), with the\namounts split by pay currency. Without a date filter it covers the current month.\n\n**When to use:** for \"how much did we lend this month?\" or \"how many requests are waiting?\". Takes the\nsame filters as `hr_loans.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عدد السلف وإجمالياتها حسب الحالة","x-description-ar":"يعرض عدد السلف المقدّمة ومبالغها لكل فئة حالة (`pending`، `pending_accounting`، `pending_settlement`،\n`approved` وتشمل قيد السداد والمسوّاة، `rejected`، `cancelled`) مع تقسيم المبالغ حسب عملة الراتب. دون فلتر\nتاريخ يغطي الشهر الحالي.\n\n**متى تستخدمه:** لأسئلة مثل «كم أقرضنا هذا الشهر؟» أو «كم طلباً ينتظر؟». يقبل فلاتر `hr_loans.list` نفسها.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[created_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or after; with neither bound, the current month.","x-description-ar":"قُدّمت في هذا التاريخ أو بعده؛ دون أي حد يُعتمد الشهر الحالي.","example":"2026-11-01"},{"name":"q[created_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or before.","x-description-ar":"قُدّمت في هذا التاريخ أو قبله.","example":"2026-11-30"}],"responses":{"200":{"description":"The figures.","x-description-ar":"الأرقام.","content":{"application/json":{"example":{"filters":{"submitted_from":"2026-11-01","submitted_to":"2026-11-30","status":"all","employee_name":null,"employee_no":null},"counts":{"total":5,"pending":2,"pending_accounting":0,"pending_settlement":0,"approved":2,"rejected":1,"cancelled":0},"amounts":{"SAR":{"total":"41000.00","pending":"17500.00","pending_accounting":"0.00","pending_settlement":"0.00","approved":"20000.00","rejected":"3500.00","cancelled":"0.00"}},"accounting_mode":false},"schema":{"type":"object","properties":{"filters":{"type":"object","description":"The filters applied, defaults included: `submitted_from`, `submitted_to`, `status`, `employee_name`, `employee_no`.","x-description-ar":"الفلاتر المطبّقة بما فيها الافتراضية: `submitted_from` و`submitted_to` و`status` و`employee_name` و`employee_no`."},"counts":{"type":"object","description":"Loans per bucket.","x-description-ar":"عدد السلف لكل فئة.","properties":{"total":{"type":"integer","description":"Count: `total`.","x-description-ar":"العدد: `total`."},"pending":{"type":"integer","description":"Count: `pending`.","x-description-ar":"العدد: `pending`."},"pending_accounting":{"type":"integer","description":"Count: `pending_accounting`.","x-description-ar":"العدد: `pending_accounting`."},"pending_settlement":{"type":"integer","description":"Count: `pending_settlement`.","x-description-ar":"العدد: `pending_settlement`."},"approved":{"type":"integer","description":"Count: `approved`.","x-description-ar":"العدد: `approved`."},"rejected":{"type":"integer","description":"Count: `rejected`.","x-description-ar":"العدد: `rejected`."},"cancelled":{"type":"integer","description":"Count: `cancelled`.","x-description-ar":"العدد: `cancelled`."}}},"amounts":{"type":"object","additionalProperties":{"type":"object"},"description":"Per currency, the amount per bucket as decimal strings.","x-description-ar":"لكل عملة، المبلغ لكل فئة كنص عشري."},"accounting_mode":{"type":"boolean","description":"True when an accountant in Qoyod approves loans.","x-description-ar":"صحيح إن كان محاسب في قيود يعتمد السلف."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_loans/{id}":{"get":{"summary":"Get a loan with everything needed to decide it","operationId":"hr_loans.show","tags":["Loans"],"description":"Returns one loan in full for HR: the request, the borrower, their active salary with monthly gross and net,\ninstallments they already owe per month for the next two years, their other loans, the decision and\nschedule, the payments, what Qoyod accounting says about it, and whether the token's owner may approve,\nreject or settle it.\n\n**When to use:** before `hr_loans.approve`, to judge whether the employee can afford the installments, or to\nanswer any question about a specific loan.\n\n**Prerequisites:** the loan `id` from `hr_loans.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض سلفة مع كل ما يلزم للبتّ فيها","x-description-ar":"يعرض سلفة واحدة كاملة للموارد البشرية: الطلب والمستفيد وراتبه النشط مع الإجمالي والصافي الشهري، والأقساط\nالمستحقة عليه شهرياً للسنتين القادمتين، وسلفه الأخرى، والقرار والجدول والدفعات، وما تقوله محاسبة قيود عنها،\nوهل يستطيع صاحب الرمز اعتمادها أو رفضها أو تسويتها.\n\n**متى تستخدمه:** قبل `hr_loans.approve` للحكم على قدرة الموظف على سداد الأقساط، أو للإجابة عن أي سؤال عن سلفة\nبعينها.\n\n**المتطلبات:** رقم `id` السلفة من `hr_loans.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_loan_id"}],"responses":{"200":{"description":"The loan.","x-description-ar":"السلفة.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"approved","channel":"payroll","description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","repayment":null,"payments":[],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[{"id":9001,"sequence":1,"payroll_id":null,"due_on":"2027-01-01","amount":"2083.33","currency":"SAR","status":"due"}],"accounting_mode":"legacy","accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/hr_loans/{id}/accounting_sync":{"post":{"summary":"Re-send a loan to Qoyod accounting","operationId":"hr_loans.resync","tags":["Loans"],"description":"Sends a loan's accounting events to Qoyod again after a delivery problem: one that never left QHR is sent\nfresh, a failed delivery is retried under the same event id (so it cannot post twice), and one Qoyod\nrejected is sent as a corrected replacement. Events that are posted, on their way or waiting for an\naccountant are left alone. `event_type` (`loan.disbursed` or `loan.repaid`) limits it to one event.\n\n**When to use:** for a loan `hr_loans.accounting_sync` shows with `can_sync: true`.\n\n**Prerequisites:** the loan `id` from `hr_loans.accounting_sync` (`loan_id`). Needs \"Connect, configure and\nsend to the accounting integration\" besides the loan permission, an employee record, and a live Qoyod\nconnection.\n\n**Side effects:** queues the events for delivery to Qoyod (answers 202 with how many). Not offered to Claude,\nbecause it posts to the company's books.","x-summary-ar":"إعادة إرسال سلفة إلى محاسبة قيود","x-description-ar":"يعيد إرسال الأحداث المحاسبية للسلفة إلى قيود بعد مشكلة في الإرسال: الحدث الذي لم يغادر QHR يُرسل من جديد،\nوالإرسال الفاشل يُعاد بالرقم نفسه (فلا يُرحَّل مرتين)، والحدث الذي رفضته قيود يُرسل بديلاً مصحّحاً. تُترك\nالأحداث المرحّلة أو التي في الطريق أو بانتظار محاسب. يقصر `event_type` (`loan.disbursed` أو `loan.repaid`)\nالعملية على حدث واحد.\n\n**متى تستخدمه:** للسلفة التي تظهر في `hr_loans.accounting_sync` مع `can_sync: true`.\n\n**المتطلبات:** رقم السلفة من `hr_loans.accounting_sync` (`loan_id`). تحتاج صلاحية «ربط تكامل المحاسبة وإعداده\nوالإرسال إليه» إضافةً إلى صلاحية السلف، وسجل موظف، وربطاً فعّالاً بقيود.\n\n**الآثار الجانبية:** تُدرج الأحداث في قائمة الإرسال إلى قيود (يُرجع 202 مع عددها). لا يُعرض على Claude لأنه\nيرحّل إلى دفاتر الشركة.","x-access":"write","x-permission":{"key":"loan/view_others","label":"View all employees' loans","x-label-ar":"عرض سلف جميع الموظفين"},"x-feature":"loan","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_loan_id"},{"name":"event_type","in":"query","required":false,"schema":{"type":"string","enum":["loan.disbursed","loan.repaid"]},"description":"Only this event.","x-description-ar":"هذا الحدث فقط.","example":"loan.disbursed"}],"responses":{"202":{"description":"Queued for delivery.","x-description-ar":"أُدرج للإرسال.","content":{"application/json":{"example":{"record":{"loan_id":419,"reference":"LON-0043","status":"approved","channel":"direct","sync_state":"syncing","can_sync":false,"events":[]},"queued":1},"schema":{"type":"object","properties":{"record":{"type":"object","description":"The loan's sync row, as in `hr_loans.accounting_sync`.","x-description-ar":"صف إرسال السلفة كما في `hr_loans.accounting_sync`."},"queued":{"type":"integer","description":"Events queued.","x-description-ar":"عدد الأحداث المُدرجة."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"409":{"description":"There is nothing to send.","x-description-ar":"لا يوجد ما يُرسل.","x-codes":[{"code":"nothing_to_sync","meaning":"Every event of the loan is posted, on its way or with an accountant; `error` says which.","x-meaning-ar":"كل أحداث السلفة مرحّلة أو في الطريق أو لدى محاسب؛ ويوضح `error` أيها.","x-fix":"Nothing to do. If an accountant declined it, correct and approve the loan again.","x-fix-ar":"لا يلزم شيء. إن رفضها المحاسب فصحّح السلفة واعتمدها مجدداً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"There is nothing to send for this loan — it is already posted.","code":"nothing_to_sync","error_code":"nothing_to_sync"}}}},"422":{"description":"The loan cannot be sent.","x-description-ar":"لا يمكن إرسال السلفة.","x-codes":[{"code":"not_connected","meaning":"The company is not connected to Qoyod, or the connection is not live.","x-meaning-ar":"الشركة غير مرتبطة بقيود، أو الربط غير فعّال.","x-fix":"Connect Qoyod in QHR › Accounting connection.","x-fix-ar":"اربط قيود من QHR › الربط المحاسبي."},{"code":"not_decided","meaning":"The loan has not been decided, so it owes accounting nothing.","x-meaning-ar":"لم يُبتّ في السلفة، فلا يوجد ما يُرسل إلى المحاسبة.","x-fix":"Decide it first with `hr_loans.approve`.","x-fix-ar":"بتّ فيها أولاً عبر `hr_loans.approve`."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This loan has not been decided yet, so there is nothing to send to accounting.","code":"not_decided","error_code":"not_decided"}}}}}}},"/hr_loans/{id}/approve":{"patch":{"summary":"Approve a loan request","operationId":"hr_loans.approve","tags":["Loans"],"description":"Approves a `pending` loan on HR's terms. `channel: payroll` pays it on a payslip and repays it in equal\nmonthly installments from `installments_start_on` to `installments_end_on`; each month's installments must\nfit within the employee's net pay. `channel: direct` pays it out on its own and expects the whole amount\nback on `repayment_due_on`. Without accounting approval the loan becomes `approved` at once (payout payment\nor installments created); in a company connected to Qoyod it becomes `pending_accounting` and nothing is\npaid until an accountant approves.\n\n**When to use:** to say yes to an employee's request. Check affordability first with `hr_loans.show`.\n\n**Prerequisites:** the loan `id` from `hr_loans.list` (`can_approve: true`). The token's owner must be an\nemployee: the decision is recorded in their name.\n\n**Side effects:** lends company money; the payout is sent to Qoyod accounting when connected; the employee\nis emailed once the loan is approved, and a manager who asked for it is emailed the decision. Recorded in\nthe audit log. Not offered to Claude, because it moves company money.","x-summary-ar":"اعتماد طلب سلفة","x-description-ar":"يعتمد سلفة `pending` بشروط الموارد البشرية. مع `channel: payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية\nمتساوية من `installments_start_on` إلى `installments_end_on`، ويجب ألا تتجاوز أقساط أي شهر صافي راتب\nالموظف. ومع `channel: direct` تُصرف وحدها ويُنتظر سداد المبلغ كاملاً في `repayment_due_on`. دون اعتماد محاسبي\nتصبح `approved` فوراً (تُنشأ دفعة الصرف أو الأقساط)، وفي الشركة المرتبطة بقيود تصبح `pending_accounting` ولا\nيُصرف شيء حتى يعتمدها محاسب.\n\n**متى تستخدمه:** للموافقة على طلب موظف. تحقق من القدرة على السداد أولاً عبر `hr_loans.show`.\n\n**المتطلبات:** رقم `id` السلفة من `hr_loans.list` (`can_approve: true`). يجب أن يكون صاحب الرمز موظفاً لأن\nالقرار يُسجَّل باسمه.\n\n**الآثار الجانبية:** يُقرض مال الشركة؛ ويُرسل الصرف إلى محاسبة قيود عند الربط؛ ويصل الموظفَ بريد عند اعتماد\nالسلفة، ويصل المديرَ الذي طلبها بريد بالقرار. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يحرّك مال الشركة.","x-access":"write","x-permission":{"key":"loan/approve","label":"Approve loan requests","x-label-ar":"الموافقة على طلبات السلف"},"x-feature":"loan","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_loan_id"}],"responses":{"200":{"description":"The approved loan.","x-description-ar":"السلفة المعتمدة.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"approved","channel":"payroll","description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","repayment":null,"payments":[],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[{"id":9001,"sequence":1,"payroll_id":null,"due_on":"2027-01-01","amount":"2083.33","currency":"SAR","status":"due"}],"accounting_mode":"legacy","accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The approval was refused; the loan stays pending.","x-description-ar":"رُفض الاعتماد وبقيت السلفة معلّقة.","x-codes":[{"code":"validation_failed","meaning":"The terms are refused: no `channel`; a direct loan without `repayment_due_on` or repaid before it is paid out; a payroll loan without both installment months, starting before the payout month, paid out in a period a payroll run has locked, or with a month's installments above the employee's net pay (or no active salary).","x-meaning-ar":"رُفضت الشروط: لا يوجد `channel`؛ أو سلفة مباشرة بلا `repayment_due_on` أو يسبق سدادُها صرفَها؛ أو سلفة عبر الرواتب بلا شهري القسط الأول والأخير، أو تبدأ قبل شهر الصرف، أو تُصرف في فترة أقفلها مسيّر رواتب، أو تتجاوز أقساط أحد أشهرها صافي راتب الموظف (أو لا يوجد راتب نشط).","x-fix":"Fix the field named in `error` — usually a longer repayment period or a later disbursement date.","x-fix-ar":"صحّح الحقل المذكور في `error` — غالباً بمدة سداد أطول أو تاريخ صرف لاحق."},{"code":"validation_failed","meaning":"The loan is no longer `pending`: it was already decided or withdrawn.","x-meaning-ar":"السلفة لم تعد `pending`: بُتّ فيها أو سُحبت.","x-fix":"Read its status with `hr_loans.show`; nothing more to decide.","x-fix-ar":"اقرأ حالتها عبر `hr_loans.show`؛ لا يوجد ما يُقرَّر."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["loan"],"properties":{"loan":{"type":"object","required":["channel"],"description":"The terms.","x-description-ar":"الشروط.","properties":{"channel":{"type":"string","description":"`payroll` (paid on a payslip, repaid in monthly installments) or `direct` (paid and repaid in one payment outside payroll).","x-description-ar":"`payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب.","enum":["payroll","direct"]},"disbursement_date":{"type":"string","description":"Payout date; defaults to the date the employee asked for.","x-description-ar":"تاريخ الصرف؛ الافتراضي هو التاريخ الذي طلبه الموظف.","format":"date"},"installments_start_on":{"type":"string","description":"Payroll loans: first installment month (any day; the 1st is used).","x-description-ar":"للسلفة عبر الرواتب: شهر أول قسط (أي يوم، ويُعتمد أول الشهر).","format":"date"},"installments_end_on":{"type":"string","description":"Payroll loans: last installment month. Installments are equal.","x-description-ar":"للسلفة عبر الرواتب: شهر آخر قسط. الأقساط متساوية.","format":"date"},"repayment_due_on":{"type":"string","description":"Direct loans: date the whole amount is to be repaid.","x-description-ar":"للسلفة المباشرة: تاريخ سداد المبلغ كاملاً.","format":"date"},"decision_note":{"type":"string","description":"Note shown to the employee.","x-description-ar":"ملاحظة تظهر للموظف."}}}}},"example":{"loan":{"channel":"payroll","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","decision_note":"Six equal installments from January."}}}},"required":true,"description":"HR's terms."}}},"/hr_loans/{id}/reject":{"patch":{"summary":"Reject a loan request","operationId":"hr_loans.reject","tags":["Loans"],"description":"Rejects a `pending` loan request, optionally with a note to the employee. It becomes `rejected` and can no\nlonger change; the employee may submit a new request.\n\n**When to use:** to say no to a request.\n\n**Prerequisites:** the loan `id` from `hr_loans.list` (`can_reject: true`). The token's owner must be an\nemployee: the decision is recorded in their name.\n\n**Side effects:** the employee is emailed the decision, and a manager who asked for it is told too. Recorded\nin the audit log. Not offered to Claude, because it decides on an employee's money request.","x-summary-ar":"رفض طلب سلفة","x-description-ar":"يرفض طلب سلفة `pending` مع ملاحظة اختيارية للموظف. يصبح `rejected` ولا يمكن تغييره، ويمكن للموظف تقديم طلب\nجديد.\n\n**متى تستخدمه:** لرفض طلب.\n\n**المتطلبات:** رقم `id` السلفة من `hr_loans.list` (`can_reject: true`). يجب أن يكون صاحب الرمز موظفاً لأن\nالقرار يُسجَّل باسمه.\n\n**الآثار الجانبية:** يصل الموظفَ بريد بالقرار، ويُبلَّغ المدير الذي طلبها أيضاً. يُسجَّل في سجل التدقيق. لا\nيُعرض على Claude لأنه يبتّ في طلب مالي لموظف.","x-access":"write","x-permission":{"key":"loan/reject","label":"Reject loan requests","x-label-ar":"رفض طلبات السلف"},"x-feature":"loan","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_loan_id"}],"responses":{"200":{"description":"The rejected loan.","x-description-ar":"السلفة المرفوضة.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"rejected","channel":null,"description":"Medical treatment for my father.","installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":null,"installments_start_on":null,"installments_end_on":null,"repayment":null,"payments":[],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"The amount exceeds this quarter's limit."},"installments":[],"accounting_mode":"legacy","accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The rejection was refused.","x-description-ar":"رُفض الرفض.","x-codes":[{"code":"validation_failed","meaning":"The loan is no longer `pending`: it was already decided or withdrawn.","x-meaning-ar":"السلفة لم تعد `pending`: بُتّ فيها أو سُحبت.","x-fix":"Read its status with `hr_loans.show`; nothing more to decide.","x-fix-ar":"اقرأ حالتها عبر `hr_loans.show`؛ لا يوجد ما يُقرَّر."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This loan has already been decided and can no longer be changed.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"loan":{"type":"object","description":"The note.","x-description-ar":"الملاحظة.","properties":{"decision_note":{"type":"string","description":"Note shown to the employee.","x-description-ar":"ملاحظة تظهر للموظف."}}}}},"example":{"loan":{"decision_note":"The amount exceeds this quarter's limit."}}}},"required":true,"description":"An optional note."}}},"/hr_loans/{id}/settle":{"patch":{"summary":"Settle a loan the employee paid back","operationId":"hr_loans.settle","tags":["Loans"],"description":"Records that an employee paid one loan back outside payroll (cash or transfer). A direct loan is settled for its whole amount; a payroll loan for what its installments have not collected yet, and\nits remaining installments are cancelled so nothing more is deducted from pay. Without accounting approval it is\nfinal at once: the loan becomes `settled` and a received payment is recorded on `repaid_on` (today by default, never\nin the future). In a company connected to Qoyod the loan becomes `pending_settlement` and nothing is recorded until an\naccountant approves; the answer is then 202 instead of 200.\n\n**When to use:** when an employee repays a loan early or on its due date. For several loans at once use\n`hr_loans.settle_batch`.\n\n**Prerequisites:** the loan `id` from `hr_loans.for_employee` or `hr_loans.list` (`can_settle: true`); it\nmust be `approved` or `repaying` with money outstanding. The token's owner must be an employee.\n\n**Side effects:** records a received payment, cancels remaining installments, and sends the repayment\n(`loan.repaid`) to Qoyod accounting when connected. Recorded in the audit log. Cannot be undone, so it is\nnot offered to Claude.","x-summary-ar":"تسوية سلفة سددها الموظف","x-description-ar":"يسجّل أن الموظف سدّد سلفة واحدة خارج الرواتب (نقداً أو تحويلاً). تُسوّى السلفة المباشرة بكامل مبلغها، وسلفة الرواتب بما لم تحصّله أقساطها بعد، وتُلغى أقساطها المتبقية فلا يُستقطع شيء\nآخر من الراتب. دون اعتماد محاسبي تكون التسوية نهائية فوراً: تصبح السلفة `settled` وتُسجَّل دفعة مقبوضة بتاريخ `repaid_on`\n(اليوم افتراضياً، ولا يكون في المستقبل). وفي الشركة المرتبطة بقيود تصبح السلفة `pending_settlement` ولا يُسجَّل شيء حتى\nيعتمد محاسب، ويكون الرد 202 بدلاً من 200.\n\n**متى تستخدمه:** عندما يسدد الموظف سلفة مبكراً أو في موعدها. لعدة سلف دفعة واحدة استخدم\n`hr_loans.settle_batch`.\n\n**المتطلبات:** رقم `id` السلفة من `hr_loans.for_employee` أو `hr_loans.list` (`can_settle: true`)، ويجب أن\nتكون `approved` أو `repaying` وعليها مبلغ متبقٍ. يجب أن يكون صاحب الرمز موظفاً.\n\n**الآثار الجانبية:** تُسجَّل دفعة مقبوضة وتُلغى الأقساط المتبقية ويُرسل السداد (`loan.repaid`) إلى محاسبة قيود\nعند الربط. يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"loan/settle","label":"Settle loans (record a repayment)","x-label-ar":"تسوية السلف (تسجيل السداد)"},"x-feature":"loan","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/hr_loan_id"}],"responses":{"200":{"description":"Settled: the loan is `settled` and the repayment recorded.","x-description-ar":"سُوّيت: السلفة `settled` وسُجّل السداد.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"settled","channel":"direct","description":"Medical treatment for my father.","installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":null,"installments_end_on":null,"repayment":{"due_on":"2026-11-20","repaid_on":"2026-11-25","state":"paid_late","days":5},"payments":[{"id":701,"reference":"PAY-0701","kind":"paid","purpose":"disbursement","date":"2026-09-10","amount":"5000.00","currency":"SAR"},{"id":702,"reference":"PAY-0702","kind":"received","purpose":"repayment","date":"2026-11-25","amount":"5000.00","currency":"SAR"}],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[],"accounting_mode":"legacy","accounting":{"gate":"none","state":null,"event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"202":{"description":"Submitted to the accountant: the loan is `pending_settlement` and nothing is recorded yet.","x-description-ar":"أُرسلت إلى المحاسب: السلفة `pending_settlement` ولم يُسجَّل شيء بعد.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"pending_settlement","channel":"direct","description":"Medical treatment for my father.","installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":null,"installments_end_on":null,"repayment":null,"payments":[{"id":701,"reference":"PAY-0701","kind":"paid","purpose":"disbursement","date":"2026-09-10","amount":"5000.00","currency":"SAR"}],"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[],"accounting_mode":"approval","accounting":{"gate":"loan","state":"queued","event_id":null,"reason_code":null,"reason":null,"decided_at":null,"decided_by":null,"resubmit_allowed":null,"journal_entry":null},"existing_commitments":[{"month":"2027-01","amount":"1000.00"}],"can_approve":false,"can_reject":false,"can_settle":false,"employee":{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","email":"sara@acme.example","job_title":"Accountant","department":"Finance","join_date":"2024-03-01"},"submitted_by":null,"salary":{"id":310,"status":"active","pay_frequency":"monthly","currency":"SAR","basic_salary_amount":"9000.00","benefits":[{"id":311,"kind":"housing","calculation_type":"fixed_monthly","description":"Housing","amount":"2250.00"}],"salary_deductions":[],"monthly_gross":"11250.00","monthly_net":"10237.50"},"other_loans":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/hr_loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The settlement was refused; nothing was recorded.","x-description-ar":"رُفضت التسوية ولم يُسجَّل شيء.","x-codes":[{"code":"not_settleable","meaning":"The loan is not `approved` or `repaying`. `loan_id` and `reference` name the loan.","x-meaning-ar":"السلفة ليست `approved` أو `repaying`. يحدد `loan_id` و`reference` السلفة.","x-fix":"Settle only loans with `can_settle: true` in `hr_loans.for_employee`.","x-fix-ar":"سوِّ فقط السلف التي `can_settle: true` في `hr_loans.for_employee`."},{"code":"already_pending_settlement","meaning":"A settlement of the loan already waits for the accountant. `loan_id` and `reference` name the loan.","x-meaning-ar":"تسوية السلفة بانتظار المحاسب أصلاً. يحدد `loan_id` و`reference` السلفة.","x-fix":"Wait for the accountant's decision in Qoyod.","x-fix-ar":"انتظر قرار المحاسب في قيود."},{"code":"nothing_outstanding","meaning":"Nothing is left to repay on the loan. `loan_id` and `reference` name the loan.","x-meaning-ar":"لا يتبقى شيء للسداد على السلفة. يحدد `loan_id` و`reference` السلفة.","x-fix":"Leave that loan out.","x-fix-ar":"استبعد تلك السلفة."},{"code":"payout_not_delivered","meaning":"A payroll loan whose payout has not reached the employee yet. `loan_id` and `reference` name the loan.","x-meaning-ar":"سلفة رواتب لم يصل صرفها إلى الموظف بعد. يحدد `loan_id` و`reference` السلفة.","x-fix":"Pay the payroll run that carries the payout first, or cancel the loan.","x-fix-ar":"اصرف مسيّر الرواتب الذي يحمل الصرف أولاً، أو ألغِ السلفة."},{"code":"installment_in_flight","meaning":"An installment sits on a payroll run that has not been paid (named in `error`). `loan_id` and `reference` name the loan.","x-meaning-ar":"قسط على مسيّر رواتب لم يُصرف بعد (مذكور في `error`). يحدد `loan_id` و`reference` السلفة.","x-fix":"Pay or revert that payroll run first.","x-fix-ar":"اصرف ذلك المسيّر أو أرجعه أولاً."},{"code":"repaid_before_disbursement","meaning":"`repaid_on` is before the loan was paid out. `loan_id` and `reference` name the loan.","x-meaning-ar":"`repaid_on` يسبق صرف السلفة. يحدد `loan_id` و`reference` السلفة.","x-fix":"Send a `repaid_on` on or after the payout date.","x-fix-ar":"أرسل `repaid_on` في تاريخ الصرف أو بعده."},{"code":"repaid_in_future","meaning":"`repaid_on` is after today. `loan_id` and `reference` name the loan.","x-meaning-ar":"`repaid_on` بعد اليوم. يحدد `loan_id` و`reference` السلفة.","x-fix":"Record the repayment once the money has arrived.","x-fix-ar":"سجّل السداد بعد وصول المال."},{"code":"repaid_on_unreadable","meaning":"`repaid_on` is not a date.","x-meaning-ar":"`repaid_on` ليس تاريخاً.","x-fix":"Send `repaid_on` as `YYYY-MM-DD`.","x-fix-ar":"أرسل `repaid_on` بالشكل `YYYY-MM-DD`."},{"code":"employee_required","meaning":"The token's owner has no employee record, and a settlement is recorded in the name of the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف، والتسوية تُسجَّل باسم الموظف الذي أجراها.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required","error_code":"repaid_in_future","loan_id":419,"reference":"LON-0043"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"loan":{"type":"object","description":"The settlement.","x-description-ar":"التسوية.","properties":{"repaid_on":{"type":"string","description":"Date the employee repaid; today when omitted. Not in the future, not before the payout.","x-description-ar":"تاريخ سداد الموظف؛ اليوم إن لم يُرسل. لا يكون في المستقبل ولا قبل الصرف.","format":"date"}}}}},"example":{"loan":{"repaid_on":"2026-11-25"}}}},"required":true,"description":"The repayment date."}}},"/hr_overtimes/requests":{"get":{"summary":"List the company's overtime requests for HR","operationId":"hr_overtimes.requests","tags":["Overtime"],"description":"HR's overtime queue, across the whole company, oldest work date first. Without a status filter it shows only\nthe requests waiting for HR (`pending_hr`, already approved by the manager or with no manager); send\n`q[status_eq]` to see another status, for example `approved` to review what payroll will pay. Each row says\nwhether the token owner may decide it now (`can_act`) and whether a payroll run has paid it (`payroll_id`).\n\n**When to use:** to answer \"what overtime is waiting for HR?\" or \"what overtime was approved in this period?\",\nthen decide with `overtime_requests.approve` or `overtime_requests.reject`. A manager's queue is\n`team_overtimes.pending_requests`.\n\n**Prerequisites:** \"View attendance reports\". The token owner does not need an employee record to read the\nqueue, but needs one to decide.\n\n**Side effects:** none. Up to 50 requests per page.","x-summary-ar":"عرض طلبات العمل الإضافي في الشركة للموارد البشرية","x-description-ar":"قائمة العمل الإضافي لدى الموارد البشرية على مستوى الشركة كلها، الأقدم تاريخ عمل أولاً. بلا تصفية بالحالة\nتعرض الطلبات التي تنتظر الموارد البشرية فقط (`pending_hr`، أي التي اعتمدها المدير أو لا مدير لصاحبها)؛ أرسل\n`q[status_eq]` لعرض حالة أخرى، مثل `approved` لمراجعة ما سيصرفه مسير الرواتب. يوضح كل سطر هل يستطيع صاحب\nالرمز البت فيه الآن (`can_act`) وهل صرفه مسير رواتب (`payroll_id`).\n\n**متى تستخدمه:** للإجابة عن «ما العمل الإضافي الذي ينتظر الموارد البشرية؟» أو «ما الذي اعتُمد في هذه الفترة؟»،\nثم البت عبر `overtime_requests.approve` أو `overtime_requests.reject`. قائمة المدير هي\n`team_overtimes.pending_requests`.\n\n**المتطلبات:** صلاحية «عرض تقارير الحضور». لا يحتاج صاحب الرمز سجلاً وظيفياً لقراءة القائمة، لكنه يحتاجه للبت.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","approved","rejected","cancelled"]},"description":"Only requests in this status. `pending_hr` when omitted.","x-description-ar":"الطلبات بهذه الحالة فقط. `pending_hr` إن لم يُرسل.","example":"approved"},{"$ref":"#/components/parameters/overtime_employee_filter"},{"$ref":"#/components/parameters/overtime_date_from_filter"},{"$ref":"#/components/parameters/overtime_date_to_filter"}],"responses":{"200":{"description":"A page of overtime requests.","x-description-ar":"صفحة من طلبات العمل الإضافي.","content":{"application/json":{"example":{"records":[{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_hr","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"HR","can_act":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-24T06:10:00Z","note":"Confirmed with finance."},"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/overtime_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_overtimes/stat_cards":{"get":{"summary":"Get the company's overtime totals for HR","operationId":"hr_overtimes.stat_cards","tags":["Overtime"],"description":"Company-wide overtime figures for HR: requests waiting for HR and waiting for anyone (any date) with their\nhours; requests approved for dates this month with their hours; hours approved for last month; and approved\nhours no payroll run has paid yet (any date), which is what the next payroll runs still have to pay.\n\n**When to use:** to answer \"how much overtime is waiting for HR?\" or \"how many approved overtime hours are not\npaid yet?\". The requests themselves are in `hr_overtimes.requests`.\n\n**Prerequisites:** \"View attendance reports\". No employee record needed.\n\n**Side effects:** none.","x-summary-ar":"عرض إجماليات العمل الإضافي في الشركة للموارد البشرية","x-description-ar":"أرقام العمل الإضافي على مستوى الشركة للموارد البشرية: الطلبات التي تنتظر الموارد البشرية والتي تنتظر أي جهة\n(أياً كان تاريخها) مع ساعاتها؛ والطلبات المعتمدة لتواريخ هذا الشهر مع ساعاتها؛ والساعات المعتمدة للشهر\nالماضي؛ والساعات المعتمدة التي لم يصرفها أي مسير رواتب بعد (أياً كان تاريخها)، وهي ما بقي على مسيرات الرواتب\nالقادمة صرفه.\n\n**متى تستخدمه:** للإجابة عن «كم من العمل الإضافي ينتظر الموارد البشرية؟» أو «كم ساعة عمل إضافي معتمدة لم\nتُصرف بعد؟». الطلبات نفسها في `hr_overtimes.requests`.\n\n**المتطلبات:** صلاحية «عرض تقارير الحضور». لا يلزم سجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The company's overtime totals.","x-description-ar":"إجماليات العمل الإضافي في الشركة.","content":{"application/json":{"example":{"needs_my_action":3,"all_pending":7,"pending_hours":18.5,"approved_this_month":12,"approved_hours_this_month":31.0,"approved_hours_last_month":27.5,"unconsumed_approved_hours":31.0},"schema":{"$ref":"#/components/schemas/overtime_hr_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_permissions/requests":{"get":{"summary":"List the company's permission requests for HR","operationId":"permission_requests.hr_list","tags":["Permission requests"],"description":"Returns permission requests (hourly leaves of absence) across the whole company, earliest window first. By\ndefault only those waiting for HR (`pending_hr`): requests on the `hr` route, requests the manager\nrecommended on `manager_and_hr`, and requests whose employee has no manager able to approve. Filter with\n`q[status_eq]` or `q[status_in][]` for the history (approved, rejected, withdrawn or revoked…). A request\nthe manager withdrew before HR decided shows as `revoked` with `revoke_type: withdrawn`.\n\n**When to use:** to answer \"which permissions are waiting for HR?\" before `permission_requests.approve` /\n`permission_requests.reject`, or to review who took time off in a period.\n\n**Prerequisites:** \"View attendance reports\". No employee record is needed to read; deciding needs one.\nWithout `from` / `to` there is no date limit.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الاستئذان في الشركة للموارد البشرية","x-description-ar":"يعرض طلبات الاستئذان (الغياب بالساعات) في الشركة كلها، الأقرب موعداً أولاً. افتراضياً يعرض ما ينتظر الموارد\nالبشرية فقط (`pending_hr`): طلبات مسار `hr`، والطلبات التي أوصى بها المدير في مسار `manager_and_hr`،\nوطلبات الموظفين الذين ليس لهم مدير يملك الاعتماد. صفِّ بـ `q[status_eq]` أو `q[status_in][]` لعرض السجل\n(المقبولة والمرفوضة والمسحوبة…). الطلب الذي تراجع عنه المدير قبل قرار الموارد البشرية يظهر `revoked` مع\n`revoke_type: withdrawn`.\n\n**متى تستخدمه:** للإجابة عن \"ما الاستئذانات التي تنتظر الموارد البشرية؟\" قبل `permission_requests.approve`\nأو `permission_requests.reject`، أو لمراجعة من استأذن في فترة ما.\n\n**المتطلبات:** صلاحية «عرض تقارير الحضور». لا يلزم سجل وظيفي للقراءة، أما القرار فيلزمه. بدون `from` و`to`\nلا يوجد حد للتاريخ.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First date (`YYYY-MM-DD`) of the permission's date. With only `to`, from the start of the current month.","x-description-ar":"أول تاريخ (`YYYY-MM-DD`) لتاريخ الاستئذان. مع `to` وحده يبدأ من أول الشهر الحالي.","example":"2026-11-01"},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last date, inclusive. With only `from`, to the end of the current month.","x-description-ar":"آخر تاريخ شاملاً. مع `from` وحده ينتهي بآخر الشهر الحالي.","example":"2026-11-30"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","approved","rejected","cancelled","revoked"]},"description":"Only this status. `pending_hr` when neither status filter is sent.","x-description-ar":"حالة محددة فقط. `pending_hr` إن لم يُرسل أي من مرشحي الحالة.","example":"approved"},{"name":"q[status_in][]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Any of these statuses, e.g. all of them for the full history.","x-description-ar":"أي من هذه الحالات، مثل جميعها لعرض السجل الكامل.","example":["approved","rejected"]},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee (id from `employees.list`).","x-description-ar":"موظف محدد فقط (الرقم من `employees.list`).","example":1203},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["late_arrival","early_leave","mid_shift","flexible"]},"description":"Only this kind.","x-description-ar":"نوع محدد فقط.","example":"late_arrival"}],"responses":{"200":{"description":"A page of requests.","x-description-ar":"صفحة من الطلبات.","content":{"application/json":{"example":{"records":[{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"pending_hr","approval_route":"manager_and_hr","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":"HR","actions":{"can_edit":false,"can_cancel":false,"can_approve":true,"can_reject":true,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":null},"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/permission_request_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_permissions/stat_cards":{"get":{"summary":"Count the company's permission requests for HR","operationId":"permission_requests.hr_stat_cards","tags":["Permission requests"],"description":"Counts permission requests (hourly leaves of absence) across the company: waiting for HR, waiting for\nmanagers, approved for dates in the current calendar month and their total hours, and the start of the\nsoonest window waiting for HR (UTC).\n\n**When to use:** to answer \"how many permissions wait for HR?\" or \"how many hours of permission were\napproved this month?\".\n\n**Prerequisites:** \"View attendance reports\".\n\n**Side effects:** none.","x-summary-ar":"إحصاءات طلبات الاستئذان في الشركة للموارد البشرية","x-description-ar":"يحسب طلبات الاستئذان (الغياب بالساعات) في الشركة كلها: ما ينتظر الموارد البشرية، وما ينتظر المديرين،\nوالمقبولة لتواريخ الشهر الحالي ومجموع ساعاتها، وبداية أقرب طلب ينتظر الموارد البشرية (بتوقيت UTC).\n\n**متى تستخدمه:** للإجابة عن \"كم استئذاناً ينتظر الموارد البشرية؟\" أو \"كم ساعة استئذان قُبلت هذا الشهر؟\".\n\n**المتطلبات:** صلاحية «عرض تقارير الحضور».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The company's counts.","x-description-ar":"أعداد الشركة.","content":{"application/json":{"example":{"pending_hr":3,"pending_managers":7,"approved_this_month":41,"approved_hours_this_month":76.5,"earliest_pending_start":"2026-11-30T12:00:00Z"},"schema":{"type":"object","properties":{"pending_hr":{"type":"integer","description":"Waiting for HR.","x-description-ar":"بانتظار الموارد البشرية."},"pending_managers":{"type":"integer","description":"Waiting for managers.","x-description-ar":"بانتظار المديرين."},"approved_this_month":{"type":"integer","description":"Approved for dates this month.","x-description-ar":"المقبولة لتواريخ هذا الشهر."},"approved_hours_this_month":{"type":"number","description":"Their total hours.","x-description-ar":"مجموع ساعاتها."},"earliest_pending_start":{"type":"string","description":"Start of the soonest window waiting for HR, in UTC; null when none waits.","x-description-ar":"بداية أقرب طلب ينتظر الموارد البشرية بتوقيت UTC؛ null إن لم يوجد.","nullable":true}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_tickets":{"get":{"summary":"List all requests in the company","operationId":"hr_tickets.list","tags":["All requests (HR)"],"description":"Returns every internal request in the company, whatever its department or status, including those still\nwaiting for approval. Latest activity first; up to 50 per page. Each row lists `available_actions`, what\nthe token owner may do on it now.\n\n**When to use:** for HR's overview: filter by department, type, status, priority, assignee or dates, or\n`overdue=true` for late work. Department members see their own queue with `department_tickets.list`;\nthe requests one person submitted are `tickets.list`. Open one with `tickets.show`.\n\n**Prerequisites:** none. Filter ids come from `ticket_categories.list`, `ticket_types.list`,\n`employees.meta_data` (departments) and `hr_tickets.assignees`.\n\n**Side effects:** none.","x-summary-ar":"عرض جميع الطلبات في الشركة","x-description-ar":"يعرض كل الطلبات الداخلية في الشركة أياً كان قسمها أو حالتها، بما فيها التي ما زالت بانتظار الاعتماد. الأحدث\nنشاطاً أولاً، حتى ٥٠ طلباً في الصفحة. يذكر كل صف `available_actions`، أي ما يستطيع صاحب الرمز فعله عليه الآن.\n\n**متى تستخدمه:** لنظرة الموارد البشرية الشاملة: صفِّ بالقسم أو النوع أو الحالة أو الأولوية أو المسند إليه أو\nالتواريخ، أو `overdue=true` للأعمال المتأخرة. يرى أعضاء الأقسام قوائمهم عبر `department_tickets.list`،\nوطلبات الشخص التي قدّمها هي `tickets.list`. افتح أي طلب عبر `tickets.show`.\n\n**المتطلبات:** لا شيء. أرقام التصفية من `ticket_categories.list` و`ticket_types.list` و`employees.meta_data`\n(الأقسام) و`hr_tickets.assignees`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"$ref":"#/components/parameters/department_ticket_overdue"},{"$ref":"#/components/parameters/hr_ticket_q_department_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_ticket_type_ticket_category_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_ticket_type_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_priority_eq"},{"$ref":"#/components/parameters/department_ticket_q_assignee_id_eq"},{"$ref":"#/components/parameters/department_ticket_q_assignee_id_null"},{"$ref":"#/components/parameters/department_ticket_q_status_eq"},{"$ref":"#/components/parameters/department_ticket_q_status_in"},{"$ref":"#/components/parameters/department_ticket_q_created_at_gteq"},{"$ref":"#/components/parameters/department_ticket_q_created_at_lteq"},{"$ref":"#/components/parameters/department_ticket_q_reference_or_subject_or_requester_name_cont"},{"$ref":"#/components/parameters/department_ticket_q_s"}],"responses":{"200":{"description":"A page of requests.","x-description-ar":"صفحة من الطلبات.","content":{"application/json":{"example":{"records":[{"id":3105,"reference":"TKT-000215","subject":"Laptop screen flickering","status":"open","priority":"high","target_days":3,"type":{"id":12,"name_en":"New device","name_ar":"جهاز جديد","name":"New device"},"category":{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":"2026-12-02","overdue":false,"last_activity_at":"2026-11-26T08:15:00Z","created_at":"2026-11-25T07:40:00Z","available_actions":["assign","priority","due_date"]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/department_ticket_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/hr_tickets/assignees":{"get":{"summary":"List the members of a department","operationId":"hr_tickets.assignees","tags":["All requests (HR)"],"description":"Returns the employed members of one department, by name: the people its requests can be assigned to.\n\n**When to use:** to choose `assignee_id` for `hr_tickets.bulk_assign` (the department that handles the\nselected requests), or for the `assignee_id_eq` filter of `hr_tickets.list`.\n\n**Prerequisites:** `department_id`, from `employees.meta_data` (departments) or the `department` of a row\nin `hr_tickets.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض أعضاء قسم","x-description-ar":"يعرض أعضاء قسم واحد الذين على رأس العمل مرتبين بالاسم: وهم من يمكن إسناد طلبات القسم إليهم.\n\n**متى تستخدمه:** لاختيار `assignee_id` في `hr_tickets.bulk_assign` (من القسم المنفّذ للطلبات المختارة)، أو\nلتصفية `assignee_id_eq` في `hr_tickets.list`.\n\n**المتطلبات:** `department_id` من `employees.meta_data` (الأقسام) أو من `department` في صف من\n`hr_tickets.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"department_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The department.","x-description-ar":"القسم.","example":7}],"responses":{"200":{"description":"The members.","x-description-ar":"الأعضاء.","content":{"application/json":{"example":{"records":[{"id":1207,"name":"Omar Khaled","department_name":"IT","label":"Omar Khaled - IT"},{"id":1211,"name":"Reem Nasser","department_name":"IT","label":"Reem Nasser - IT"}]},"schema":{"$ref":"#/components/schemas/department_ticket_assignees"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/hr_tickets/bulk_assign":{"patch":{"summary":"Assign many requests of one department","operationId":"hr_tickets.bulk_assign","tags":["All requests (HR)"],"description":"Assigns up to 50 requests to one employed member of the department that handles them, exactly as\n`tickets.assign` does one by one. All the requests must belong to the same department, or the whole\nbatch is refused. A request that is not open, assigned or in progress, or whose requester is the chosen\nperson, fails on its own and is reported in `failed`.\n\n**When to use:** to share out a backlog of one department. For one request use `tickets.assign`.\n\n**Prerequisites:** ids from `hr_tickets.list` (filtered by department); `assignee_id` from\n`hr_tickets.assignees`. The token owner must be linked to an employee.\n\n**Side effects:** the requester and the new assignee are notified (in QHR and by email). Each change is\nlogged in the request's activity (`tickets.events`).\n\n**Not offered to Claude:** a bulk change touching many requests and notifying many people at once; Claude\nuses `tickets.assign` one request at a time.","x-summary-ar":"إسناد عدة طلبات من قسم واحد","x-description-ar":"يُسند حتى ٥٠ طلباً إلى عضو واحد على رأس العمل من القسم المنفّذ لها، تماماً كما تفعل `tickets.assign` لكل\nطلب على حدة. يجب أن تتبع كل الطلبات القسم نفسه وإلا رُفضت الدفعة كاملة. والطلب غير المفتوح أو المسند أو قيد\nالتنفيذ، أو الذي قدّمه الشخص المختار نفسه، يفشل وحده ويُذكر في `failed`.\n\n**متى تستخدمه:** لتوزيع الطلبات المتراكمة في قسم. لطلب واحد استخدم `tickets.assign`.\n\n**المتطلبات:** الأرقام من `hr_tickets.list` (مصفّاة بالقسم)، و`assignee_id` من `hr_tickets.assignees`. يجب\nأن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُشعَر مقدّم الطلب والمسند إليه الجديد (داخل QHR وبالبريد). ويُسجَّل كل تغيير في سجل\nنشاط الطلب (`tickets.events`).\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس طلبات كثيرة ويُشعر أشخاصاً كثيرين دفعة واحدة؛ ويستخدم\nClaude `tickets.assign` لكل طلب على حدة.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3105],"failed":[{"id":3106,"error":"Already assigned to this person"}]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, no `assignee_id`, or requests of more than one department.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `assignee_id` ناقص، أو طلبات من أكثر من قسم.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile; a bulk change is recorded in each request's activity under an employee.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف؛ والتغيير الجماعي يُسجَّل في نشاط كل طلب باسم موظف.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","assignee_id"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"minItems":1,"maxItems":50,"description":"Request ids, 1 to 50, from the list.","x-description-ar":"أرقام الطلبات، من ١ إلى ٥٠، من القائمة."},"assignee_id":{"type":"integer","description":"The employee, from `hr_tickets.assignees`.","x-description-ar":"الموظف، من `hr_tickets.assignees`."}}},"example":{"ids":[3105,3106],"assignee_id":1207}}},"required":true,"description":"The requests and who gets them."}}},"/hr_tickets/bulk_due_date":{"patch":{"summary":"Change the due date of many requests","operationId":"hr_tickets.bulk_due_date","tags":["All requests (HR)"],"description":"Sets one new due date, with one reason, on up to 50 approved, unfinished requests, exactly as\n`tickets.due_date` does one by one. A request whose new date would be before the day it opened, that is\nfinished or still waiting for approval, or that the token owner submitted, fails on its own and is\nreported in `failed`.\n\n**When to use:** to extend (or bring forward) a batch of deadlines, for example after a holiday. For one\nrequest use `tickets.due_date`.\n\n**Prerequisites:** ids from `hr_tickets.list`. The token owner must be linked to an employee.\n\n**Side effects:** each change, with the old date, the new one and the reason, is logged in the request's\nactivity. A request in review gets its automatic-close date recalculated, and a request moved to today\nor later will be flagged overdue again if it slips. No one is notified.\n\n**Not offered to Claude:** a bulk change touching many requests' deadlines at once; Claude uses\n`tickets.due_date` one request at a time.","x-summary-ar":"تغيير تاريخ استحقاق عدة طلبات","x-description-ar":"يضع تاريخ استحقاق جديداً واحداً، مع سبب واحد، على حتى ٥٠ طلباً معتمداً لم ينتهِ، تماماً كما تفعل\n`tickets.due_date` لكل طلب على حدة. الطلب الذي يقع تاريخه الجديد قبل يوم فتحه، أو المنتهي أو الذي ما زال\nبانتظار الاعتماد، أو الذي قدّمه صاحب الرمز، يفشل وحده ويُذكر في `failed`.\n\n**متى تستخدمه:** لتمديد (أو تقديم) مواعيد مجموعة طلبات، مثلاً بعد عطلة. لطلب واحد استخدم\n`tickets.due_date`.\n\n**المتطلبات:** الأرقام من `hr_tickets.list`. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُسجَّل كل تغيير في سجل نشاط الطلب مع التاريخ القديم والجديد والسبب. ويُعاد حساب تاريخ\nالإغلاق التلقائي للطلب قيد المراجعة، والطلب المنقول إلى اليوم أو بعده يُنبَّه عليه مجدداً إن تأخر. لا يُرسَل\nأي إشعار.\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس مواعيد طلبات كثيرة دفعة واحدة؛ ويستخدم Claude\n`tickets.due_date` لكل طلب على حدة.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3105],"failed":[{"id":3106,"error":"The due date cannot be before the request was opened"}]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, no `due_on` or `reason`, or a date that is not `YYYY-MM-DD`.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `due_on` أو `reason` ناقص، أو تاريخ ليس بالصيغة `YYYY-MM-DD`.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile; a bulk change is recorded in each request's activity under an employee.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف؛ والتغيير الجماعي يُسجَّل في نشاط كل طلب باسم موظف.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","due_on","reason"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"minItems":1,"maxItems":50,"description":"Request ids, 1 to 50, from the list.","x-description-ar":"أرقام الطلبات، من ١ إلى ٥٠، من القائمة."},"due_on":{"type":"string","description":"New due date, `YYYY-MM-DD`.","x-description-ar":"تاريخ الاستحقاق الجديد `YYYY-MM-DD`.","format":"date"},"reason":{"type":"string","description":"Why, shown in each request's activity.","x-description-ar":"السبب، ويظهر في نشاط كل طلب."}}},"example":{"ids":[3105,3106],"due_on":"2026-12-10","reason":"Waiting for the supplier after the holiday"}}},"required":true,"description":"The requests, the new date and why."}}},"/hr_tickets/bulk_priority":{"patch":{"summary":"Change the priority of many requests","operationId":"hr_tickets.bulk_priority","tags":["All requests (HR)"],"description":"Sets one priority (`low`, `medium`, `high` or `highest`) on up to 50 unfinished requests, exactly as\n`tickets.priority` does one by one. A finished request, or one the token owner submitted, fails on its\nown and is reported in `failed`.\n\n**When to use:** to re-prioritise a batch, for example everything from one department. For one request\nuse `tickets.priority`.\n\n**Prerequisites:** ids from `hr_tickets.list`. The token owner must be linked to an employee.\n\n**Side effects:** each change, with the old and new priority, is logged in the request's activity. No one\nis notified.\n\n**Not offered to Claude:** a bulk change touching many requests at once; Claude uses `tickets.priority`\none request at a time.","x-summary-ar":"تغيير أولوية عدة طلبات","x-description-ar":"يضع أولوية واحدة (`low` أو `medium` أو `high` أو `highest`) على حتى ٥٠ طلباً لم ينتهِ، تماماً كما تفعل\n`tickets.priority` لكل طلب على حدة. الطلب المنتهي، أو الذي قدّمه صاحب الرمز، يفشل وحده ويُذكر في `failed`.\n\n**متى تستخدمه:** لإعادة ترتيب أولويات مجموعة طلبات، مثل كل طلبات قسم واحد. لطلب واحد استخدم\n`tickets.priority`.\n\n**المتطلبات:** الأرقام من `hr_tickets.list`. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** يُسجَّل كل تغيير في سجل نشاط الطلب مع الأولوية القديمة والجديدة. لا يُرسَل أي إشعار.\n\n**لا يُعرض على Claude:** لأنه تغيير جماعي يمس طلبات كثيرة دفعة واحدة؛ ويستخدم Claude `tickets.priority`\nلكل طلب على حدة.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were done and which were not, with the reason. Each request is handled on its own and checked exactly as its single operation would be.","x-description-ar":"الطلبات التي نُفّذت والتي لم تُنفَّذ مع السبب. يُعالَج كل طلب وحده ويُتحقق منه كما في عمليته المفردة تماماً.","content":{"application/json":{"example":{"succeeded":[3105],"failed":[{"id":3108,"error":"You cannot change this request"}]},"schema":{"$ref":"#/components/schemas/department_ticket_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The batch was refused, or the token's owner is not an employee.","x-description-ar":"رُفضت الدفعة، أو صاحب الرمز ليس موظفاً.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no id, more than 50 ids, or no or an unknown `priority`.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠ رقماً، أو `priority` ناقصة أو غير معروفة.","x-fix":"Fix the body as `error` says, then send again. Nothing was changed.","x-fix-ar":"صحّح الطلب كما يذكر `error` ثم أعد الإرسال. لم يتغير شيء."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile; a bulk change is recorded in each request's activity under an employee.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف؛ والتغيير الجماعي يُسجَّل في نشاط كل طلب باسم موظف.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","priority"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"minItems":1,"maxItems":50,"description":"Request ids, 1 to 50, from the list.","x-description-ar":"أرقام الطلبات، من ١ إلى ٥٠، من القائمة."},"priority":{"type":"string","description":"New priority.","x-description-ar":"الأولوية الجديدة.","enum":["low","medium","high","highest"]}}},"example":{"ids":[3105,3106],"priority":"highest"}}},"required":true,"description":"The requests and their new priority."}}},"/hr_tickets/stat_cards":{"get":{"summary":"Count the company's requests","operationId":"hr_tickets.stat_cards","tags":["All requests (HR)"],"description":"Returns company-wide counts: approved requests not finished, unassigned, overdue, resolved this week (sent\nfor review or closed since the company's week start), and requests waiting for HR's approval. List filters\nnever apply.\n\n**When to use:** for a quick \"how are requests going\" answer. To see the requests behind a number use\n`hr_tickets.list`; to act on those waiting for HR use `ticket_approvals.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"إحصاء طلبات الشركة","x-description-ar":"يعرض أعداداً على مستوى الشركة: الطلبات المعتمدة التي لم تنتهِ، وغير المستلمة، والمتأخرة، والمنجزة هذا\nالأسبوع (أُرسلت للمراجعة أو أُغلقت منذ بداية أسبوع الشركة)، والطلبات بانتظار اعتماد الموارد البشرية. لا تتأثر\nبتصفية القائمة.\n\n**متى تستخدمه:** لإجابة سريعة عن «كيف تسير الطلبات». لرؤية الطلبات وراء أي رقم استخدم `hr_tickets.list`،\nوللتصرف في الطلبات التي تنتظر الموارد البشرية استخدم `ticket_approvals.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"open":27,"unassigned":6,"overdue":3,"resolved_this_week":11,"pending_hr_approval":4},"schema":{"$ref":"#/components/schemas/hr_ticket_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/leave_categories":{"get":{"summary":"List leave categories","operationId":"leave_categories.list","tags":["Leave categories"],"description":"Returns every leave category of the company — the six default ones (annual, sick, maternity…) first, then\nthe company's own in the order they were added — with how many leave policies each holds and whether its\nunused days are carried over into the next year. The list is short and not paginated.\n\n**When to use:** to see which kinds of leave exist, or to find the `leave_category_id` that\n`leave_policies.create` and the `leave_category_id` filter of `leave_policies.list` need.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض فئات الإجازات","x-description-ar":"يعرض كل فئات الإجازات في الشركة — الفئات الست الافتراضية (سنوية، مرضية، أمومة…) أولاً، ثم فئات الشركة\nالخاصة بترتيب إضافتها — مع عدد سياسات الإجازة في كل فئة وهل تُرحَّل أيامها غير المستخدمة إلى السنة التالية.\nالقائمة قصيرة وغير مقسمة إلى صفحات.\n\n**متى تستخدمه:** لمعرفة أنواع الإجازات الموجودة، أو للحصول على `leave_category_id` الذي تحتاجه\n`leave_policies.create` ومرشح `leave_category_id` في `leave_policies.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_policy/view","label":"View leave policies","x-label-ar":"عرض سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Every leave category.","x-description-ar":"كل فئات الإجازات.","content":{"application/json":{"example":{"records":[{"id":1,"name":"Annual Leave","is_default":true,"policies_count":2,"carryover_eligible":true},{"id":7,"name":"Study Leave","is_default":false,"policies_count":0,"carryover_eligible":false}]},"schema":{"$ref":"#/components/schemas/leave_category_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a leave category","operationId":"leave_categories.create","tags":["Leave categories"],"description":"Adds a new kind of leave (for example \"Study Leave\") next to the six default ones. A category holds no rules\nitself: create the policies that define the days and pay with `leave_policies.create`.\n\n**When to use:** when the company grants a kind of leave none of the existing categories fits. Check them\nfirst with `leave_categories.list`.\n\n**Prerequisites:** none. Both names are required and must be unused in the company (case ignored).\n\n**Side effects:** recorded in the audit log. With `carryover_eligible: true`, unused days of this\ncategory's yearly policies are carried into the next year on 1 January. Not offered to Claude: it changes\nthe company's leave set-up, which HR configures on purpose.","x-summary-ar":"إضافة فئة إجازة","x-description-ar":"يضيف نوعاً جديداً من الإجازات (مثل «إجازة دراسية») إلى جانب الفئات الست الافتراضية. لا تحمل الفئة قواعد\nبذاتها: أنشئ السياسات التي تحدد الأيام والأجر عبر `leave_policies.create`.\n\n**متى تستخدمه:** عندما تمنح الشركة نوع إجازة لا تناسبه أي فئة موجودة. راجع الفئات أولاً عبر\n`leave_categories.list`.\n\n**المتطلبات:** لا شيء. الاسمان مطلوبان ويجب ألا يكونا مستخدمين في الشركة (دون اعتبار لحالة الأحرف).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. ومع `carryover_eligible: true` تُرحَّل الأيام غير المستخدمة من\nسياسات هذه الفئة السنوية إلى السنة التالية في ١ يناير. لا يُعرض على Claude: لأنه يغيّر إعداد الإجازات في\nالشركة، وهو أمر تضبطه الموارد البشرية عن قصد.","x-access":"write","x-permission":{"key":"leave_policy/create_category","label":"Create leave categories","x-label-ar":"إنشاء فئات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new category.","x-description-ar":"الفئة الجديدة.","content":{"application/json":{"example":{"id":7,"name":"Study Leave","is_default":false,"carryover_eligible":false},"schema":{"$ref":"#/components/schemas/leave_category"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The category cannot be added.","x-description-ar":"لا يمكن إضافة الفئة.","x-codes":[{"code":"validation_failed","meaning":"A name is missing, or another category already uses it.","x-meaning-ar":"اسم ناقص، أو تستخدمه فئة أخرى.","x-fix":"Send both names, different from every category in `leave_categories.list`.","x-fix-ar":"أرسل الاسمين مختلفين عن كل فئة في `leave_categories.list`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_category_input"},"example":{"leave_category":{"name_en":"Study Leave","name_ar":"إجازة دراسية","carryover_eligible":false}}}},"required":true,"description":"The new category."}}},"/leave_categories/{id}":{"patch":{"summary":"Rename a leave category or change its carry-over","operationId":"leave_categories.update","tags":["Leave categories"],"description":"Changes the fields you send: the English or Arabic name, or `carryover_eligible`. Default categories can be\nchanged too.\n\n**When to use:** to correct a name, or to decide whether unused days of this kind of leave carry over.\n\n**Prerequisites:** the category `id` from `leave_categories.list`.\n\n**Side effects:** a new name shows at once everywhere, past leave requests included (the old name stays in\nthe audit log). Switching `carryover_eligible` changes nothing today; it decides what the 1 January\ncarry-over run does for this category's yearly policies. Not offered to Claude: it changes the company's\nleave set-up, which HR configures on purpose.","x-summary-ar":"تغيير اسم فئة إجازة أو إعداد الترحيل فيها","x-description-ar":"يعدّل الحقول التي ترسلها: الاسم بالإنجليزية أو بالعربية، أو `carryover_eligible`. يمكن تعديل الفئات\nالافتراضية أيضاً.\n\n**متى تستخدمه:** لتصحيح اسم، أو لتحديد هل تُرحَّل الأيام غير المستخدمة من هذا النوع من الإجازات.\n\n**المتطلبات:** رقم `id` الفئة من `leave_categories.list`.\n\n**الآثار الجانبية:** يظهر الاسم الجديد فوراً في كل مكان، بما في ذلك طلبات الإجازة السابقة (ويبقى الاسم\nالقديم في سجل التدقيق). تغيير `carryover_eligible` لا يغيّر شيئاً اليوم؛ بل يحدد ما يفعله ترحيل ١ يناير\nلسياسات هذه الفئة السنوية. لا يُعرض على Claude: لأنه يغيّر إعداد الإجازات في الشركة، وهو أمر تضبطه الموارد\nالبشرية عن قصد.","x-access":"write","x-permission":{"key":"leave_policy/edit_category","label":"Rename leave categories","x-label-ar":"تعديل أسماء فئات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_category_id"}],"responses":{"200":{"description":"The category after the change.","x-description-ar":"الفئة بعد التعديل.","content":{"application/json":{"example":{"id":7,"name":"Study Leave","is_default":false,"carryover_eligible":true},"schema":{"$ref":"#/components/schemas/leave_category"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_category_input"},"example":{"leave_category":{"carryover_eligible":true}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a leave category","operationId":"leave_categories.delete","tags":["Leave categories"],"description":"Deletes a category the company added, for good.\n\n**When to use:** to remove a category created by mistake. It only works for a category that never had a\nleave policy (not even a deleted one), and never for the six default categories.\n\n**Prerequisites:** the category `id` from `leave_categories.list` (`is_default: false`, `policies_count: 0`).\n\n**Side effects:** the category is erased; this cannot be undone. Recorded in the audit log. Not offered to\nClaude: a permanent, company-wide deletion.","x-summary-ar":"حذف فئة إجازة","x-description-ar":"يحذف فئة أضافتها الشركة، حذفاً نهائياً.\n\n**متى تستخدمه:** لإزالة فئة أُنشئت خطأً. ينجح فقط مع فئة لم تكن لها أي سياسة إجازة قط (ولا حتى سياسة\nمحذوفة)، ولا ينجح أبداً مع الفئات الست الافتراضية.\n\n**المتطلبات:** رقم `id` الفئة من `leave_categories.list` (`is_default: false` و`policies_count: 0`).\n\n**الآثار الجانبية:** تُمحى الفئة ولا يمكن التراجع عن ذلك. يُسجَّل في سجل التدقيق. لا يُعرض على Claude:\nلأنه حذف نهائي على مستوى الشركة.","x-access":"write","x-permission":{"key":"leave_policy/delete_category","label":"Delete leave categories","x-label-ar":"حذف فئات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_category_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The category cannot be deleted.","x-description-ar":"لا يمكن حذف الفئة.","x-codes":[{"code":"validation_failed","meaning":"The category is a default one, or has (or had) leave policies.","x-meaning-ar":"الفئة افتراضية، أو لها (أو كانت لها) سياسات إجازة.","x-fix":"Keep it. A category with policies stays; stop using a policy with `leave_policies.update` (`active: false`).","x-fix-ar":"أبقِ عليها. الفئة التي لها سياسات تبقى؛ أوقف استخدام السياسة عبر `leave_policies.update` (`active: false`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This category still has leave policies and cannot be deleted. Delete or move its policies first.","code":"validation_failed"}}}}}}},"/leave_policies":{"get":{"summary":"List leave policies","operationId":"leave_policies.list","tags":["Leave policies"],"description":"Returns every leave policy of the company, newest first, with all its rules: entitlement (`duration`), how\nand how often days are granted, carry-over, pay, approver and how many employees hold it. Switched-off\npolicies (`active: false`) are included. The list is not paginated.\n\n**When to use:** to see what leave the company offers and on what terms, or to find a policy `id` for\n`leave_policies.show`, `leave_policies.update` or the assignment operations (`employee_leave_policies.list`).\nFilter by `leave_category_id` to see one kind of leave.\n\n**Prerequisites:** none. Category ids come from `leave_categories.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض سياسات الإجازات","x-description-ar":"يعرض كل سياسات الإجازات في الشركة، الأحدث أولاً، بكل قواعدها: الاستحقاق (`duration`)، وكيف ومتى تُمنح\nالأيام، والترحيل، والأجر، والمعتمد، وعدد الموظفين الذين يحملونها. تشمل السياسات المعطّلة (`active: false`).\nالقائمة غير مقسمة إلى صفحات.\n\n**متى تستخدمه:** لمعرفة الإجازات التي تقدمها الشركة وشروطها، أو للحصول على رقم `id` سياسة لاستخدامه في\n`leave_policies.show` أو `leave_policies.update` أو عمليات التعيين (`employee_leave_policies.list`). صفِّ بـ\n`leave_category_id` لعرض نوع واحد من الإجازات.\n\n**المتطلبات:** لا شيء. أرقام الفئات من `leave_categories.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_policy/view","label":"View leave policies","x-label-ar":"عرض سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"leave_category_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only the policies of this category (id from `leave_categories.list`).","x-description-ar":"سياسات هذه الفئة فقط (الرقم من `leave_categories.list`).","example":1}],"responses":{"200":{"description":"The leave policies.","x-description-ar":"سياسات الإجازات.","content":{"application/json":{"example":{"records":[{"id":12,"name":"Annual Leave — Staff","leave_category_id":1,"allow_past_dates":false,"allow_negative_balance":false,"requires_document":false,"show_used_balance":true,"carryover_usable":true,"duration":"21.0","active":true,"employees_count":34,"compensation_type":"Fully Paid","approver":"Manager","accrued_per":"Per Year","accrual_method":"Full Balance","carryover_max_days":5.0,"carryover_expires_end_of_month":3,"tiers":[]}]},"schema":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/leave_policy"},"description":"The policies, newest first.","x-description-ar":"السياسات، الأحدث أولاً."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create a leave policy","operationId":"leave_policies.create","tags":["Leave policies"],"description":"Creates a leave policy: the rules employees who hold it follow. Nobody holds it yet; assign it with\n`employee_leave_policies.assign`.\n\n**How the days are granted (accrual).** `accrued_per` and `accrual_method` together decide it:\n- `per_year` + `full_balance`: on assignment, `duration` pro-rated by the whole months left in the year,\n  counted from the employee's joining date (a mid-month start loses that month); topped back up to the full\n  `duration` every 1 January.\n- `per_year` + `monthly`: on assignment, the share of the current month still to come; then one twelfth of\n  `duration` on the 1st of each month, never above `duration`; a fresh balance every 1 January.\n- `one_time_only`: the full `duration` at once on assignment; it never renews.\n- `per_event`: no balance is ever granted; each occasion (bereavement, marriage…) is requested on its own,\n  so `allow_negative_balance` is always on.\nOnly active policies, and employees who are active or serving notice, accrue.\n\n**Carry-over.** Only for `per_year` policies whose category has `carryover_eligible`. On 1 January the\nunused days of the year just ended (balance plus carried days, minus days taken) move into the new year, up\nto `carryover_max_days` (null = no cap); anything above the cap is forfeited. With\n`carryover_expires_end_of_month` set, carried days still unused at the end of that month expire for good.\nWith `carryover_usable: false` carried days cannot be taken but are paid out when the employee leaves.\n\n**Prerequisites:** `leave_category_id` from `leave_categories.list`; the allowed keys and what each\ncombination does from `leave_policies.meta_data`; check the names with `leave_policies.validate_name`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it sets entitlements that become\nbalances and pay for every employee later assigned, which HR configures on purpose.","x-summary-ar":"إنشاء سياسة إجازة","x-description-ar":"ينشئ سياسة إجازة: القواعد التي يخضع لها من يحملها من الموظفين. لا يحملها أحد بعد؛ عيّنها عبر\n`employee_leave_policies.assign`.\n\n**كيف تُمنح الأيام (الاستحقاق).** يحددها `accrued_per` و`accrual_method` معاً:\n- `per_year` مع `full_balance`: عند التعيين تُمنح `duration` بنسبة الأشهر الكاملة المتبقية من السنة، محسوبة\n  من تاريخ التحاق الموظف (البدء في منتصف الشهر يُسقط ذلك الشهر)؛ ويُعاد الرصيد إلى `duration` كاملة كل ١ يناير.\n- `per_year` مع `monthly`: عند التعيين نصيب ما تبقى من الشهر الحالي؛ ثم جزء من اثني عشر من `duration` في\n  أول كل شهر دون تجاوز `duration`؛ ورصيد جديد كل ١ يناير.\n- `one_time_only`: `duration` كاملة دفعة واحدة عند التعيين، ولا تتجدد.\n- `per_event`: لا يُمنح رصيد أبداً؛ تُطلب كل حالة (وفاة، زواج…) على حدة، لذا يبقى `allow_negative_balance`\n  مفعّلاً دائماً.\nلا يستحق إلا في السياسات المفعّلة وللموظفين النشطين أو في فترة الإشعار.\n\n**الترحيل.** لسياسات `per_year` التي تحمل فئتها `carryover_eligible` فقط. في ١ يناير تنتقل الأيام غير\nالمستخدمة من السنة المنتهية (الرصيد مع الأيام المرحَّلة ناقص الأيام المأخوذة) إلى السنة الجديدة، حتى\n`carryover_max_days` (null بلا حد)، ويسقط ما يزيد على الحد. ومع ضبط `carryover_expires_end_of_month` تنتهي\nنهائياً الأيام المرحَّلة التي لم تُستخدم حتى نهاية ذلك الشهر. ومع `carryover_usable: false` لا يمكن أخذ الأيام\nالمرحَّلة، لكنها تُصرف مقابلاً مالياً عند ترك الموظف للشركة.\n\n**المتطلبات:** `leave_category_id` من `leave_categories.list`؛ والمفاتيح المسموحة وما تفعله كل تركيبة من\n`leave_policies.meta_data`؛ وتحقق من الاسمين عبر `leave_policies.validate_name`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يضع استحقاقات تصبح أرصدة وأجوراً لكل\nموظف يُعيَّن لاحقاً، وهو أمر تضبطه الموارد البشرية عن قصد.","x-access":"write","x-permission":{"key":"leave_policy/create","label":"Create leave policies","x-label-ar":"إنشاء سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new policy.","x-description-ar":"السياسة الجديدة.","content":{"application/json":{"example":{"id":12,"name":"Annual Leave — Staff","leave_category_id":1,"allow_past_dates":false,"allow_negative_balance":false,"requires_document":false,"show_used_balance":true,"carryover_usable":true,"duration":"21.0","active":true,"employees_count":34,"compensation_type":"Fully Paid","approver":"Manager","accrued_per":"Per Year","accrual_method":"Full Balance","carryover_max_days":5.0,"carryover_expires_end_of_month":3,"tiers":[]},"schema":{"$ref":"#/components/schemas/leave_policy"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The policy cannot be created.","x-description-ar":"لا يمكن إنشاء السياسة.","x-codes":[{"code":"validation_failed","meaning":"A field is missing or invalid: a name is taken in the category, `monthly` with anything but `per_year`, a tier ladder longer than `duration`, `tiers` on a policy that is not `tiered_pay`, or an expiry month outside 1–11.","x-meaning-ar":"حقل ناقص أو غير صحيح: اسم مستخدم في الفئة، أو `monthly` مع غير `per_year`، أو سلّم شرائح أطول من `duration`، أو `tiers` لسياسة ليست `tiered_pay`، أو شهر انتهاء خارج ١–١١.","x-fix":"Fix the field named in `error`; see `leave_policies.meta_data` for valid combinations.","x-fix-ar":"صحّح الحقل المذكور في `error`؛ وراجع `leave_policies.meta_data` للتركيبات الصحيحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Accrual method monthly accrual is only available when accrued per year","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_policy_input"},"example":{"leave_policy":{"name_en":"Annual Leave — Staff","name_ar":"الإجازة السنوية — الموظفون","leave_category_id":1,"duration":21,"accrued_per":"per_year","accrual_method":"full_balance","compensation_type":"fully_paid","approver":"manager","allow_past_dates":false,"allow_negative_balance":false,"requires_document":false,"show_used_balance":true,"carryover_usable":true,"carryover_max_days":5,"carryover_expires_end_of_month":3}}}},"required":true,"description":"The new policy."}}},"/leave_policies/meta_data":{"get":{"summary":"Get the choices for a leave policy's settings","operationId":"leave_policies.meta_data","tags":["Leave policies"],"description":"Returns the allowed keys for a policy's `compensation_type`, `approver`, `accrued_per` and `accrual_method`,\neach with a translated label and a plain-language explanation, and the accrual matrix: for each of the four\nvalid `accrued_per` + `accrual_method` pairs, what an employee receives on assignment, every month and on\n1 January.\n\n**When to use:** before `leave_policies.create` or `leave_policies.update`, to pick valid keys and explain\nto someone what a choice means for employees' balances.\n\n**Prerequisites:** none. Any member of the company may call it.\n\n**Side effects:** none.","x-summary-ar":"عرض الخيارات المتاحة لإعدادات سياسة الإجازة","x-description-ar":"يعرض المفاتيح المسموحة لحقول السياسة `compensation_type` و`approver` و`accrued_per` و`accrual_method`، لكلٍّ\nمنها تسمية مترجمة وشرح مبسط، ومصفوفة الاستحقاق: لكل واحد من الأزواج الأربعة الصحيحة من `accrued_per` و\n`accrual_method`، ما يحصل عليه الموظف عند التعيين وفي كل شهر وفي ١ يناير.\n\n**متى تستخدمه:** قبل `leave_policies.create` أو `leave_policies.update`، لاختيار مفاتيح صحيحة وشرح أثر\nكل خيار على أرصدة الموظفين.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The choices.","x-description-ar":"الخيارات.","content":{"application/json":{"example":{"data":{"compensation_types":[{"value":"fully_paid","label":"Fully Paid","description":"The employee is paid in full for every day of this leave."}],"approvers":[{"value":"manager","label":"Manager","description":"The employee's line manager signs off alone."}],"accrued_per":[{"value":"per_year","label":"Per Year","description":"The entitlement renews every 1 January and unused days can be carried over."}],"accrual_methods":[{"value":"monthly","label":"Monthly","description":"One twelfth of the entitlement is added on the 1st of each month, capped at the full duration. Requires a yearly entitlement."}],"accrual_matrix":[{"accrued_per":"per_year","accrual_method":"monthly","on_assignment":"Pro-rated by the days remaining in the current month.","monthly":"One twelfth of the duration is added, capped at the full duration.","on_renewal":"A fresh balance on 1 January, then monthly accrual resumes."}]}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"Choices per field.","x-description-ar":"الخيارات لكل حقل.","properties":{"compensation_types":{"type":"array","description":"Keys for `compensation_type`.","x-description-ar":"مفاتيح `compensation_type`.","items":{"type":"object","properties":{"value":{"type":"string","description":"The key to send.","x-description-ar":"المفتاح الذي يُرسل."},"label":{"type":"string","description":"Translated label.","x-description-ar":"التسمية المترجمة."},"description":{"type":"string","description":"What the choice means, in plain words.","x-description-ar":"معنى الخيار بكلمات بسيطة."}}}},"approvers":{"type":"array","description":"Keys for `approver`.","x-description-ar":"مفاتيح `approver`.","items":{"type":"object","properties":{"value":{"type":"string","description":"The key to send.","x-description-ar":"المفتاح الذي يُرسل."},"label":{"type":"string","description":"Translated label.","x-description-ar":"التسمية المترجمة."},"description":{"type":"string","description":"What the choice means, in plain words.","x-description-ar":"معنى الخيار بكلمات بسيطة."}}}},"accrued_per":{"type":"array","description":"Keys for `accrued_per`.","x-description-ar":"مفاتيح `accrued_per`.","items":{"type":"object","properties":{"value":{"type":"string","description":"The key to send.","x-description-ar":"المفتاح الذي يُرسل."},"label":{"type":"string","description":"Translated label.","x-description-ar":"التسمية المترجمة."},"description":{"type":"string","description":"What the choice means, in plain words.","x-description-ar":"معنى الخيار بكلمات بسيطة."}}}},"accrual_methods":{"type":"array","description":"Keys for `accrual_method`.","x-description-ar":"مفاتيح `accrual_method`.","items":{"type":"object","properties":{"value":{"type":"string","description":"The key to send.","x-description-ar":"المفتاح الذي يُرسل."},"label":{"type":"string","description":"Translated label.","x-description-ar":"التسمية المترجمة."},"description":{"type":"string","description":"What the choice means, in plain words.","x-description-ar":"معنى الخيار بكلمات بسيطة."}}}},"accrual_matrix":{"type":"array","description":"The four valid `accrued_per` + `accrual_method` pairs and what each grants.","x-description-ar":"الأزواج الأربعة الصحيحة من `accrued_per` و`accrual_method` وما يمنحه كل منها.","items":{"type":"object","properties":{"accrued_per":{"type":"string","description":"`accrued_per` key.","x-description-ar":"مفتاح `accrued_per`."},"accrual_method":{"type":"string","description":"`accrual_method` key.","x-description-ar":"مفتاح `accrual_method`."},"on_assignment":{"type":"string","description":"What is granted when the policy is assigned.","x-description-ar":"ما يُمنح عند تعيين السياسة."},"monthly":{"type":"string","description":"What is granted each month.","x-description-ar":"ما يُمنح كل شهر."},"on_renewal":{"type":"string","description":"What happens on 1 January.","x-description-ar":"ما يحدث في ١ يناير."}}}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/leave_policies/validate_name":{"get":{"summary":"Check whether a leave policy name is free","operationId":"leave_policies.validate_name","tags":["Leave policies"],"description":"Says, for the English and the Arabic name you send, whether another policy in the same category already\nuses it (case ignored). A name you leave out comes back with `provided: false`.\n\n**When to use:** before `leave_policies.create`, or before renaming with `leave_policies.update` — then send\nthe policy's own `id` so its current name does not count as taken.\n\n**Prerequisites:** `leave_category_id` from `leave_categories.list`; for a rename, the policy `id` from\n`leave_policies.list`.\n\n**Side effects:** none.","x-summary-ar":"التحقق من توفر اسم سياسة إجازة","x-description-ar":"يوضح لكلٍّ من الاسم الإنجليزي والعربي اللذين ترسلهما هل تستخدمه سياسة أخرى في الفئة نفسها (دون اعتبار\nلحالة الأحرف). الاسم الذي لا ترسله يعود بـ `provided: false`.\n\n**متى تستخدمه:** قبل `leave_policies.create`، أو قبل تغيير الاسم عبر `leave_policies.update` — وحينها أرسل\nرقم `id` السياسة نفسها حتى لا يُعد اسمها الحالي مستخدماً.\n\n**المتطلبات:** `leave_category_id` من `leave_categories.list`؛ ولتغيير الاسم، رقم `id` السياسة من\n`leave_policies.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_policy/create","label":"Create leave policies","x-label-ar":"إنشاء سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"leave_category_id","in":"query","required":true,"schema":{"type":"integer"},"description":"Category the name must be unique in (from `leave_categories.list`).","x-description-ar":"الفئة التي يجب أن يكون الاسم فريداً فيها (من `leave_categories.list`).","example":1},{"name":"name_en","in":"query","required":false,"schema":{"type":"string"},"description":"English name to check.","x-description-ar":"الاسم الإنجليزي المراد التحقق منه.","example":"Annual Leave — Staff"},{"name":"name_ar","in":"query","required":false,"schema":{"type":"string"},"description":"Arabic name to check.","x-description-ar":"الاسم العربي المراد التحقق منه.","example":"الإجازة السنوية — الموظفون"},{"name":"id","in":"query","required":false,"schema":{"type":"integer"},"description":"When renaming: the policy's own id, so its current name is not reported as taken.","x-description-ar":"عند تغيير الاسم: رقم السياسة نفسها، حتى لا يُعد اسمها الحالي مستخدماً.","example":12}],"responses":{"200":{"description":"Availability of each name.","x-description-ar":"توفر كل اسم.","content":{"application/json":{"example":{"data":{"name_en":{"provided":true,"duplicate":true,"available":false},"name_ar":{"provided":true,"duplicate":false,"available":true}}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"One answer per name.","x-description-ar":"إجابة لكل اسم.","properties":{"name_en":{"type":"object","properties":{"provided":{"type":"boolean","description":"A name was sent.","x-description-ar":"أُرسل اسم."},"duplicate":{"type":"boolean","description":"Another policy in the category already uses it.","x-description-ar":"تستخدمه سياسة أخرى في الفئة."},"available":{"type":"boolean","description":"Sent and free to use.","x-description-ar":"أُرسل ومتاح للاستخدام."}}},"name_ar":{"type":"object","properties":{"provided":{"type":"boolean","description":"A name was sent.","x-description-ar":"أُرسل اسم."},"duplicate":{"type":"boolean","description":"Another policy in the category already uses it.","x-description-ar":"تستخدمه سياسة أخرى في الفئة."},"available":{"type":"boolean","description":"Sent and free to use.","x-description-ar":"أُرسل ومتاح للاستخدام."}}}}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/leave_policies/{id}":{"get":{"summary":"Get a leave policy's summary","operationId":"leave_policies.show","tags":["Leave policies"],"description":"Returns a short summary of one policy: name, entitlement (`duration`), whether it is active, how it is\ngranted and paid, its pay tiers and how many employees hold it.\n\n**When to use:** for a quick look at one policy. For every rule (approver, carry-over, past dates, negative\nbalance…) use `leave_policies.list`, which returns the full record.\n\n**Prerequisites:** the policy `id` from `leave_policies.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض ملخص سياسة إجازة","x-description-ar":"يعرض ملخصاً قصيراً لسياسة واحدة: الاسم، والاستحقاق (`duration`)، وهل هي مفعّلة، وطريقة منحها ودفعها،\nوشرائح الأجر، وعدد الموظفين الذين يحملونها.\n\n**متى تستخدمه:** لنظرة سريعة على سياسة واحدة. لكل القواعد (المعتمد، الترحيل، التواريخ الماضية، الرصيد\nالسالب…) استخدم `leave_policies.list` التي تعيد السجل الكامل.\n\n**المتطلبات:** رقم `id` السياسة من `leave_policies.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_policy/view","label":"View leave policies","x-label-ar":"عرض سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_policy_id"}],"responses":{"200":{"description":"The policy's summary.","x-description-ar":"ملخص السياسة.","content":{"application/json":{"example":{"id":12,"duration":"21.0","active":true,"name":"Annual Leave — Staff","accrual_method":"Full Balance","compensation_type":"Fully Paid","employees_count":34,"tiers":[]},"schema":{"type":"object","required":["id","name","duration","active"],"properties":{"id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Name in the language of the request.","x-description-ar":"الاسم بلغة الطلب."},"duration":{"type":"string","description":"Entitlement in days, as a decimal string.","x-description-ar":"الاستحقاق بالأيام، نصاً عشرياً."},"active":{"type":"boolean","description":"False when switched off.","x-description-ar":"خطأ إن كانت معطّلة."},"accrual_method":{"type":"string","description":"Full Balance or Monthly (translated).","x-description-ar":"الرصيد كاملاً أو شهرياً (مترجمة)."},"compensation_type":{"type":"string","description":"Fully Paid, Tiered Pay or Unpaid (translated).","x-description-ar":"مدفوعة بالكامل أو أجر متدرج أو غير مدفوعة (مترجمة)."},"employees_count":{"type":"integer","description":"Employees currently holding the policy.","x-description-ar":"عدد الموظفين الذين يحملون السياسة حالياً."},"tiers":{"type":"array","description":"Pay tiers of a `tiered_pay` policy; empty otherwise.","x-description-ar":"شرائح الأجر لسياسة `tiered_pay`؛ فارغة لغيرها.","items":{"type":"object","properties":{"days":{"type":"integer","description":"Days in the tier.","x-description-ar":"أيام الشريحة."},"percentage":{"type":"integer","description":"Percentage paid.","x-description-ar":"نسبة الأجر."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Update a leave policy","operationId":"leave_policies.update","tags":["Leave policies"],"description":"Changes the fields you send; the rest stay as they are. See `leave_policies.create` for what each rule means.\n\n**What happens to balances:** nothing is recalculated. Employees who hold the policy keep their current\nbalance, and a new `duration`, `accrued_per` or `accrual_method` applies from the next accrual (the 1st of\nthe month or 1 January). In that case the answer carries `warnings` saying how many employees are affected.\nMoving `per_event` → `per_year` grants nothing until the next accrual run; `per_year` → `per_event` leaves\ncurrent balances and carried days spendable but never accrued again.\n\n**Switching off:** `active: false` is refused while any employee holds the policy — remove them first with\n`employee_leave_policies.remove`, so their remaining balance is acknowledged.\n\n**Prerequisites:** the policy `id` from `leave_policies.list`; keys from `leave_policies.meta_data`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it changes the entitlements of every\nemployee holding the policy.","x-summary-ar":"تعديل سياسة إجازة","x-description-ar":"يعدّل الحقول التي ترسلها ويترك الباقي كما هو. راجع `leave_policies.create` لمعنى كل قاعدة.\n\n**ماذا يحدث للأرصدة:** لا يُعاد حساب شيء. يحتفظ الموظفون الحاملون للسياسة برصيدهم الحالي، وتسري القيمة\nالجديدة لـ `duration` أو `accrued_per` أو `accrual_method` من الاستحقاق التالي (أول الشهر أو ١ يناير). وفي هذه\nالحالة تحمل الإجابة `warnings` بعدد الموظفين المتأثرين. الانتقال من `per_event` إلى `per_year` لا يمنح شيئاً\nحتى دورة الاستحقاق التالية؛ ومن `per_year` إلى `per_event` يُبقي الأرصدة والأيام المرحَّلة الحالية قابلة\nللاستخدام لكنها لن تُستحق مجدداً.\n\n**التعطيل:** يُرفض `active: false` ما دام أي موظف يحمل السياسة — أزلهم أولاً عبر\n`employee_leave_policies.remove` ليُقَرّ برصيدهم المتبقي.\n\n**المتطلبات:** رقم `id` السياسة من `leave_policies.list`؛ والمفاتيح من `leave_policies.meta_data`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يغيّر استحقاقات كل موظف يحمل السياسة.","x-access":"write","x-permission":{"key":"leave_policy/edit","label":"Edit leave policies","x-label-ar":"تعديل سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_policy_id"}],"responses":{"200":{"description":"The policy after the change, with `warnings` when employees' entitlement is affected.","x-description-ar":"السياسة بعد التعديل، مع `warnings` عندما يتأثر استحقاق الموظفين.","content":{"application/json":{"example":{"id":12,"name":"Annual Leave — Staff","leave_category_id":1,"allow_past_dates":false,"allow_negative_balance":false,"requires_document":false,"show_used_balance":true,"carryover_usable":true,"duration":"25.0","active":true,"employees_count":34,"compensation_type":"Fully Paid","approver":"Manager","accrued_per":"Per Year","accrual_method":"Full Balance","carryover_max_days":5.0,"carryover_expires_end_of_month":3,"tiers":[],"warnings":["You changed the entitlement duration. 34 enrolled employee(s) keep their existing balance — it was not recalculated. The new rule applies from the next accrual event."]},"schema":{"$ref":"#/components/schemas/leave_policy_update_result"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"A field is invalid, or `active: false` was sent while employees still hold the policy.","x-meaning-ar":"حقل غير صحيح، أو أُرسل `active: false` والسياسة ما زال يحملها موظفون.","x-fix":"Fix the field named in `error`. To switch the policy off, remove every employee with `employee_leave_policies.remove` first.","x-fix-ar":"صحّح الحقل المذكور في `error`. لتعطيل السياسة أزل كل الموظفين أولاً عبر `employee_leave_policies.remove`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This policy is still assigned to 3 employee(s). Unassign it from each of them before deactivating it, so their remaining balance is acknowledged rather than hidden.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_policy_input"},"example":{"leave_policy":{"duration":25}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a leave policy","operationId":"leave_policies.delete","tags":["Leave policies"],"description":"Deletes a policy that was never used: it disappears from every list and cannot be restored through the API.\n\n**When to use:** only to remove a policy created by mistake. A policy that was ever assigned to anyone, or\never had a leave request, cannot be deleted; switch it off instead with `leave_policies.update`\n(`active: false`).\n\n**Prerequisites:** the policy `id` from `leave_policies.list`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: a permanent, company-wide deletion.","x-summary-ar":"حذف سياسة إجازة","x-description-ar":"يحذف سياسة لم تُستخدم قط: تختفي من كل القوائم ولا يمكن استعادتها عبر الواجهة البرمجية.\n\n**متى تستخدمه:** فقط لإزالة سياسة أُنشئت خطأً. السياسة التي عُيّنت لأي شخص يوماً، أو كان عليها أي طلب\nإجازة، لا يمكن حذفها؛ عطّلها بدلاً من ذلك عبر `leave_policies.update` (`active: false`).\n\n**المتطلبات:** رقم `id` السياسة من `leave_policies.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه حذف نهائي على مستوى الشركة.","x-access":"write","x-permission":{"key":"leave_policy/delete","label":"Delete leave policies","x-label-ar":"حذف سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_policy_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The policy cannot be deleted.","x-description-ar":"لا يمكن حذف السياسة.","x-codes":[{"code":"validation_failed","meaning":"The policy was assigned to employees or has leave requests.","x-meaning-ar":"عُيّنت السياسة لموظفين أو عليها طلبات إجازة.","x-fix":"Switch it off instead with `leave_policies.update` (`active: false`).","x-fix-ar":"عطّلها بدلاً من ذلك عبر `leave_policies.update` (`active: false`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This policy has been assigned to employees and cannot be deleted. Unassign it from every employee, then deactivate it to stop new requests.","code":"validation_failed"}}}}}}},"/leave_policies/{leave_policy_id}/employees":{"get":{"summary":"List the employees holding a leave policy","operationId":"employee_leave_policies.list","tags":["Employee leave policies"],"description":"Returns the employees who currently hold one leave policy, most recently assigned first, each with this\nyear's balance on it (taken, entitled, available) and how many of their requests on it are pending or\napproved for the future.\n\n**When to use:** to see who is covered by a policy and how much leave they have left, or to find an\n`employee_id` for `employee_leave_policies.remove`. For one employee's own view, they use\n`employee_leave_policies.my_list`.\n\n**Prerequisites:** `leave_policy_id` from `leave_policies.list`. Department ids for the filter come from\n`employees.meta_data` (`departments`).\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين يحملون سياسة إجازة","x-description-ar":"يعرض الموظفين الذين يحملون حالياً سياسة إجازة واحدة، الأحدث تعييناً أولاً، ومع كل منهم رصيده فيها لهذه\nالسنة (المأخوذ والمستحق والمتاح) وعدد طلباته عليها المعلقة أو المعتمدة لتواريخ قادمة.\n\n**متى تستخدمه:** لمعرفة من تشملهم السياسة وكم بقي لهم من الإجازات، أو للحصول على `employee_id` لاستخدامه\nفي `employee_leave_policies.remove`. أما الموظف نفسه فيستخدم `employee_leave_policies.my_list`.\n\n**المتطلبات:** `leave_policy_id` من `leave_policies.list`. أرقام الأقسام للتصفية من `employees.meta_data`\n(`departments`).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"leave_policy/view","label":"View leave policies","x-label-ar":"عرض سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_leave_policy_policy_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string","maxLength":100},"description":"Name (English or Arabic) or employee number contains.","x-description-ar":"الاسم (بالعربية أو الإنجليزية) أو الرقم الوظيفي يحتوي على.","example":"Sara"},{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department.","x-description-ar":"قسم محدد فقط.","example":4}],"responses":{"200":{"description":"A page of the policy's holders.","x-description-ar":"صفحة من حاملي السياسة.","content":{"application/json":{"example":{"records":[{"employee_id":1203,"name":"Sara Ahmed","department":"Finance","residence_country":"Saudi Arabia","employee_image":null,"balance_used":5.0,"balance_entitled":25.0,"balance_available":18.0,"pending_requests_count":1,"approved_future_requests_count":0}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/employee_leave_policy_holder_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Assign a leave policy to employees","operationId":"employee_leave_policies.assign","tags":["Employee leave policies"],"description":"Gives a leave policy to the employees in `employee_ids`, or to every active employee who can take it with\n`\"all\"`. Each employee is handled on their own: those who already hold a policy of the same leave category,\nor do not exist, are skipped with a reason, and the rest are assigned.\n\n**What happens to the balance:** each new holder gets their first grant at once, following the policy's\naccrual (see `leave_policies.create`): a pro-rated share of the year counted from their joining date for\n`per_year` + `full_balance`, the rest of the current month for `monthly`, the full entitlement for\n`one_time_only`, nothing for `per_event`. Accrual then continues on its schedule. Re-assigning someone the\npolicy was removed from restores their previous balance and history instead of granting again; accrual\nrestarts from today.\n\n**Prerequisites:** `leave_policy_id` from `leave_policies.list`; employee ids from\n`employee_leave_policies.eligible`.\n\n**Side effects:** balances created and the assignment written to each employee's statement; recorded in the\naudit log. Not offered to Claude: it grants paid leave entitlements, possibly to the whole company at once.","x-summary-ar":"تعيين سياسة إجازة لموظفين","x-description-ar":"يمنح سياسة إجازة للموظفين في `employee_ids`، أو لكل موظف نشط يمكنه أخذها مع `\"all\"`. يُعامل كل موظف على حدة:\nمن يحمل أصلاً سياسة من فئة الإجازة نفسها أو غير موجود يُتخطى مع ذكر السبب، ويُعيَّن الباقون.\n\n**ماذا يحدث للرصيد:** يحصل كل حامل جديد على أول منحة فوراً حسب استحقاق السياسة (راجع\n`leave_policies.create`): نصيب من السنة محسوب من تاريخ التحاقه لـ `per_year` مع `full_balance`، وما تبقى من\nالشهر الحالي لـ `monthly`، والاستحقاق كاملاً لـ `one_time_only`، ولا شيء لـ `per_event`. ثم يستمر الاستحقاق\nحسب جدوله. إعادة تعيين موظف أُزيلت منه السياسة تستعيد رصيده وسجله السابقين بدلاً من منحه مجدداً، ويبدأ\nالاستحقاق من اليوم.\n\n**المتطلبات:** `leave_policy_id` من `leave_policies.list`؛ وأرقام الموظفين من `employee_leave_policies.eligible`.\n\n**الآثار الجانبية:** تُنشأ الأرصدة ويُكتب التعيين في كشف كل موظف؛ ويُسجَّل في سجل التدقيق. لا يُعرض على Claude:\nلأنه يمنح استحقاقات إجازة مدفوعة، وقد يكون ذلك للشركة كلها دفعة واحدة.","x-access":"write","x-permission":{"key":"leave_policy/assign","label":"Assign policies to employees","x-label-ar":"تعيين سياسات للموظفين"},"x-feature":"leave_policy","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_leave_policy_policy_id"}],"responses":{"201":{"description":"Who was assigned and who was skipped.","x-description-ar":"من عُيّن ومن تُخطي.","content":{"application/json":{"example":{"message":"Employees assigned successfully","assigned":[{"employee_id":1203,"name":"Sara Ahmed","restored":false}],"skipped":[{"employee_id":1204,"name":"Omar Ali","reason":"Already has an active assignment in this leave category"}]},"schema":{"type":"object","properties":{"message":{"type":"string","description":"Confirmation.","x-description-ar":"رسالة التأكيد."},"assigned":{"type":"array","description":"Employees now holding the policy.","x-description-ar":"الموظفون الذين يحملون السياسة الآن.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name; null when the employee does not exist.","x-description-ar":"الاسم الكامل؛ null إن لم يوجد الموظف.","nullable":true},"restored":{"type":"boolean","description":"Assigned items only: true when a previous assignment and its balance were restored.","x-description-ar":"للمعيَّنين فقط: صحيح إن استُعيد تعيين سابق ورصيده."},"reason":{"type":"string","description":"Skipped items only: why.","x-description-ar":"للمتخطَّين فقط: السبب."}}}},"skipped":{"type":"array","description":"Employees not assigned, with the reason.","x-description-ar":"الموظفون الذين لم يُعيَّنوا، مع السبب.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name; null when the employee does not exist.","x-description-ar":"الاسم الكامل؛ null إن لم يوجد الموظف.","nullable":true},"restored":{"type":"boolean","description":"Assigned items only: true when a previous assignment and its balance were restored.","x-description-ar":"للمعيَّنين فقط: صحيح إن استُعيد تعيين سابق ورصيده."},"reason":{"type":"string","description":"Skipped items only: why.","x-description-ar":"للمتخطَّين فقط: السبب."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"Nobody could be assigned.","x-description-ar":"لم يمكن تعيين أحد.","x-codes":[{"code":"validation_failed","meaning":"No employee was assigned. `skipped` gives each one's reason (already holds a policy of this category, or not found).","x-meaning-ar":"لم يُعيَّن أي موظف. يذكر `skipped` سبب كل واحد (يحمل أصلاً سياسة من هذه الفئة، أو غير موجود).","x-fix":"Pick employees from `employee_leave_policies.eligible`.","x-fix-ar":"اختر الموظفين من `employee_leave_policies.eligible`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Already has an active assignment in this leave category","code":"validation_failed","assigned":[],"skipped":[{"employee_id":1203,"name":"Sara Ahmed","reason":"Already has an active assignment in this leave category"}]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_ids"],"properties":{"employee_ids":{"oneOf":[{"type":"array","items":{"type":"integer"}},{"type":"string","enum":["all"]}],"description":"Employee ids, or the string `\"all\"` for every active employee who holds no policy of this category yet.","x-description-ar":"أرقام الموظفين، أو النص `\"all\"` لكل موظف نشط لا يحمل بعد سياسة من هذه الفئة."}}},"example":{"employee_ids":[1203,1204]}}},"required":true,"description":"Who to assign."}}},"/leave_policies/{leave_policy_id}/employees/eligible":{"get":{"summary":"List the employees who can be given a leave policy","operationId":"employee_leave_policies.eligible","tags":["Employee leave policies"],"description":"Returns the employees who hold no policy of this policy's leave category yet, so can be given it. An\nemployee holds at most one policy per category. Former employees are included; filter by name, department\nor country.\n\n**When to use:** before `employee_leave_policies.assign`, to choose who to assign. To see who already holds\nthe policy, use `employee_leave_policies.list`.\n\n**Prerequisites:** `leave_policy_id` from `leave_policies.list`. Department ids from `employees.meta_data`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين يمكن تعيين سياسة إجازة لهم","x-description-ar":"يعرض الموظفين الذين لا يحملون بعد أي سياسة من فئة إجازة هذه السياسة، فيمكن تعيينها لهم. لا يحمل الموظف أكثر\nمن سياسة واحدة في الفئة. يشمل الموظفين السابقين؛ صفِّ بالاسم أو القسم أو الدولة.\n\n**متى تستخدمه:** قبل `employee_leave_policies.assign` لاختيار من تعيّنه. لمعرفة من يحمل السياسة أصلاً استخدم\n`employee_leave_policies.list`.\n\n**المتطلبات:** `leave_policy_id` من `leave_policies.list`. أرقام الأقسام من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"leave_policy/assign","label":"Assign policies to employees","x-label-ar":"تعيين سياسات للموظفين"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_leave_policy_policy_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string","maxLength":100},"description":"Name (English or Arabic) or employee number contains.","x-description-ar":"الاسم (بالعربية أو الإنجليزية) أو الرقم الوظيفي يحتوي على.","example":"Omar"},{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department.","x-description-ar":"قسم محدد فقط.","example":4},{"name":"q[residence_country_eq]","in":"query","required":false,"schema":{"type":"string"},"description":"Only this country of residence, ISO code.","x-description-ar":"بلد إقامة محدد فقط، برمز ISO.","example":"SA"}],"responses":{"200":{"description":"A page of eligible employees.","x-description-ar":"صفحة من الموظفين المؤهلين.","content":{"application/json":{"example":{"records":[{"id":1204,"name":"Omar Ali","department":"Finance","residence_country":"Saudi Arabia","employee_image":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/employee_leave_policy_eligible_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/leave_policies/{leave_policy_id}/employees/{employee_id}":{"delete":{"summary":"Remove a leave policy from an employee","operationId":"employee_leave_policies.remove","tags":["Employee leave policies"],"description":"Takes a leave policy away from one employee, in two steps. Called without `acknowledge_balance_loss=true`\nit changes nothing and answers 422 with a `preview` of the balance being given up (accrued, carried over,\ntaken, pending, available). Called again with `acknowledge_balance_loss=true`, the policy is removed.\n\n**What happens to the balance:** the policy leaves the employee's balance list and stops accruing, and they\ncan no longer request leave on it. Nothing is erased: the balance and its history stay readable in the\nbalance statement, and assigning the policy again with `employee_leave_policies.assign` restores them.\n\n**Prerequisites:** `leave_policy_id` from `leave_policies.list`; `employee_id` from\n`employee_leave_policies.list`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it withdraws an employee's leave\nentitlement.","x-summary-ar":"إزالة سياسة إجازة من موظف","x-description-ar":"يسحب سياسة إجازة من موظف واحد على خطوتين. عند الاستدعاء دون `acknowledge_balance_loss=true` لا يتغير شيء\nويعود 422 مع `preview` للرصيد الذي سيُتخلى عنه (المستحق والمرحَّل والمأخوذ والمعلق والمتاح). وعند إعادة\nالاستدعاء مع `acknowledge_balance_loss=true` تُزال السياسة.\n\n**ماذا يحدث للرصيد:** تخرج السياسة من قائمة أرصدة الموظف ويتوقف استحقاقها، ولا يعود بإمكانه طلب إجازة عليها.\nلا يُمحى شيء: يبقى الرصيد وسجله مقروءين في كشف الرصيد، وإعادة تعيين السياسة عبر\n`employee_leave_policies.assign` تستعيدهما.\n\n**المتطلبات:** `leave_policy_id` من `leave_policies.list`؛ و`employee_id` من `employee_leave_policies.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يسحب استحقاق إجازة من موظف.","x-access":"write","x-permission":{"key":"leave_policy/remove","label":"Remove policy assignments","x-label-ar":"إزالة تعيينات السياسة"},"x-feature":"leave_policy","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_leave_policy_policy_id"},{"name":"employee_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `employee_leave_policies.list` (`employee_id`).","x-description-ar":"رقم الموظف، من `employee_leave_policies.list` (`employee_id`).","example":1203},{"name":"acknowledge_balance_loss","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` to confirm the removal after seeing the `preview`. Without it nothing changes.","x-description-ar":"`true` لتأكيد الإزالة بعد الاطلاع على `preview`. بدونه لا يتغير شيء.","example":true}],"responses":{"200":{"description":"Removed.","x-description-ar":"أُزيلت.","content":{"application/json":{"example":{"message":"Employee unassigned successfully"},"schema":{"type":"object","properties":{"message":{"type":"string","description":"Confirmation.","x-description-ar":"رسالة التأكيد."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"Confirmation needed.","x-description-ar":"يلزم التأكيد.","x-codes":[{"code":"validation_failed","meaning":"`acknowledge_balance_loss=true` was not sent. Nothing changed; `preview` shows the balance the employee would lose access to.","x-meaning-ar":"لم يُرسل `acknowledge_balance_loss=true`. لم يتغير شيء؛ ويعرض `preview` الرصيد الذي سيفقد الموظف الوصول إليه.","x-fix":"Show the `preview` to the person, then call again with `acknowledge_balance_loss=true`.","x-fix-ar":"اعرض `preview` على الشخص، ثم أعد الاستدعاء مع `acknowledge_balance_loss=true`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Un-assigning removes this policy from the employee's balance list. Re-send with acknowledge_balance_loss=true to confirm. The balance itself is kept and is restored if the policy is re-assigned.","code":"validation_failed","preview":{"fiscal_year":2026,"accrued_days":21.0,"carryover_days":4.0,"carryover_usable":true,"entitled_days":25.0,"taken_days":5.0,"pending_days":2.0,"available_days":18.0}}}}}}}},"/leave_requests":{"get":{"summary":"List my leave requests","operationId":"leave_requests.list","tags":["Leave requests"],"description":"Returns the token owner's own leave requests, newest submitted first, with their status, the approval stage\nthey are at and who must decide next. Without `q[from]` / `q[to]` it shows the requests that start or end\nin the current month; a request matches when its first or last day falls in the window.\n\n**When to use:** to answer \"what leave have I asked for?\" or \"is my leave approved yet?\", and to find a\nrequest's `id` for `leave_requests.show`, `leave_requests.update` or `leave_requests.cancel`. For the totals\nper status, `leave_requests.stat_cards` is lighter. A manager's view of the team is\n`team_leaves.pending_requests`.\n\n**Prerequisites:** none for your own requests. `employee_id` reads another employee's requests and needs\n\"View others' leave requests\" (`x-permission.x-others`); you see only employees within your reach (your\nreports, or everyone for HR). Policy ids for `q[leave_policy_id_eq]` come from\n`leave_requests.assigned_leave_policies`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات إجازتي","x-description-ar":"يعرض طلبات الإجازة الخاصة بصاحب الرمز، الأحدث تقديماً أولاً، مع حالتها ومرحلة الموافقة التي بلغتها ومن\nيجب أن يقرر تالياً. بدون `q[from]` و`q[to]` يعرض الطلبات التي تبدأ أو تنتهي في الشهر الحالي؛ ويُعدّ\nالطلب ضمن الفترة إن وقع أول أيامه أو آخرها فيها.\n\n**متى تستخدمه:** للإجابة عن «ما الإجازات التي طلبتها؟» أو «هل وُوفق على إجازتي؟»، ولمعرفة رقم `id`\nالطلب لاستخدامه في `leave_requests.show` أو `leave_requests.update` أو `leave_requests.cancel`. لمعرفة\nالأعداد حسب الحالة، `leave_requests.stat_cards` أخف. أما نظرة المدير إلى فريقه فهي\n`team_leaves.pending_requests`.\n\n**المتطلبات:** لا شيء لطلباتك أنت. يعرض `employee_id` طلبات موظف آخر ويحتاج «عرض طلبات إجازة الآخرين»\n(`x-permission.x-others`)، ولا ترى إلا الموظفين الذين في نطاقك (مرؤوسيك، أو الجميع للموارد البشرية).\nأرقام السياسات لـ `q[leave_policy_id_eq]` من `leave_requests.assigned_leave_policies`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي","x-others":{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"}},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[from]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window start. Alone, the window runs to the end of that month. The current month when both are omitted.","x-description-ar":"بداية الفترة. إن أُرسل وحده تمتد الفترة إلى نهاية ذلك الشهر. الشهر الحالي إن لم يُرسل الطرفان.","example":"2026-03-01"},{"name":"q[to]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window end. Alone, the window starts on the first of that month.","x-description-ar":"نهاية الفترة. إن أُرسل وحده تبدأ الفترة من أول ذلك الشهر.","example":"2026-03-31"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","cancelled","revoked"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"pending"},{"name":"q[leave_policy_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this leave policy (`value` from `leave_requests.assigned_leave_policies`).","x-description-ar":"سياسة إجازة محددة فقط (`value` من `leave_requests.assigned_leave_policies`).","example":7},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`, e.g. `start_date asc`. Newest submitted first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`، مثل `start_date asc`. الأحدث تقديماً أولاً إن لم يُرسل.","example":"start_date asc"},{"name":"employee_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Another employee's requests (id from `employees.list` or `employees.team`). Needs \"View others' leave requests\".","x-description-ar":"طلبات موظف آخر (الرقم من `employees.list` أو `employees.team`). يحتاج «عرض طلبات إجازة الآخرين».","example":1203}],"responses":{"200":{"description":"A page of leave requests.","x-description-ar":"صفحة من طلبات الإجازة.","content":{"application/json":{"example":{"records":[{"id":5120,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"pending","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","on_behalf":false,"policy_approver":"Manager","current_stage":"awaiting_manager","current_approver_name":"Omar Ali","cancellation_requested_at":null,"locked":false,"lock_reason":null,"submitted_by":null,"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/leave_request_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Request leave","operationId":"leave_requests.create","tags":["Leave requests"],"description":"Submits a leave request for the token owner: a leave policy, a first and last day, and an optional reason.\nQHR counts the working days in the range (weekends, the employee's days off and public holidays are not\ncounted) and starts the approval chain the policy names:\n\n- `manager` — the employee's manager decides; with no manager (or every manager up the line on leave\n  today), HR decides.\n- `manager_and_hr` — the manager approves first, then HR gives the final approval.\n- `hr` — HR decides alone.\n\nNothing is approved automatically when the employee submits for themselves.\n\n**Refused (422)** when the policy is not assigned to you or is switched off, the dates are missing or\ninverted, the range has no working day, the leave ends after your last working day, it overlaps leave you\nalready have *approved*, it starts in the past (unless the policy allows past dates) or later than next\nyear, the policy requires a supporting document, or there are not enough days left this year and the\npolicy does not allow a negative balance. Overlapping a *pending* request, or a leave starting next year\n(whose balance is granted on 1 January), goes through with a `warning`.\n\n**When to use:** when a person asks to take time off. Run `leave_requests.validate` first and tell them the\ndays it costs and what is left.\n\n**Prerequisites:** `leave_policy_id` from `leave_requests.assigned_leave_policies`. The open API takes JSON\nonly, so leave whose policy requires a supporting document must be requested in the QHR app.\n\n**Side effects:** the days are reserved at once: they count against the balance while the request is\npending, become taken when it is approved, and come back if it is rejected, cancelled or withdrawn. The\napprovers of the first step (the manager, or HR) are emailed. Recorded in the request's history and the\naudit log.","x-summary-ar":"طلب إجازة","x-description-ar":"يقدّم طلب إجازة لصاحب الرمز: سياسة إجازة، وأول يوم وآخر يوم، وسبب اختياري. يحسب QHR أيام العمل في الفترة\n(لا تُحتسب العطل الأسبوعية وأيام راحة الموظف والعطل الرسمية) ويبدأ سلسلة الموافقة التي تحددها السياسة:\n\n- `manager` — يقرر مدير الموظف؛ وإن لم يكن له مدير (أو كان كل المديرين في السلسلة في إجازة اليوم)\n  تقرر الموارد البشرية.\n- `manager_and_hr` — يوافق المدير أولاً، ثم تعطي الموارد البشرية الموافقة النهائية.\n- `hr` — تقرر الموارد البشرية وحدها.\n\nلا يُعتمد أي طلب تلقائياً حين يقدّمه الموظف لنفسه.\n\n**يُرفض (422)** إن لم تكن السياسة مسندة إليك أو كانت معطّلة، أو كانت التواريخ ناقصة أو معكوسة، أو لم تتضمن\nالفترة يوم عمل، أو انتهت الإجازة بعد آخر يوم عمل لك، أو تداخلت مع إجازة *موافق عليها* لديك، أو بدأت في\nالماضي (ما لم تسمح السياسة بذلك) أو بعد السنة القادمة، أو كانت السياسة تشترط مستنداً داعماً، أو لم يكفِ\nالرصيد المتبقي هذه السنة والسياسة لا تسمح برصيد سالب. أما التداخل مع طلب *معلّق*، أو إجازة تبدأ السنة\nالقادمة (يُمنح رصيدها في ١ يناير)، فيُقبل مع `warning`.\n\n**متى تستخدمه:** حين يطلب شخص إجازة. نفّذ `leave_requests.validate` أولاً وأخبره بعدد الأيام التي ستُخصم\nوالمتبقي له.\n\n**المتطلبات:** `leave_policy_id` من `leave_requests.assigned_leave_policies`. تقبل الواجهة المفتوحة JSON\nفقط، لذا تُطلب الإجازة التي تشترط سياستها مستنداً داعماً من تطبيق QHR.\n\n**الآثار الجانبية:** تُحجز الأيام فوراً: تُحتسب من الرصيد ما دام الطلب معلّقاً، وتصبح مأخوذة عند الموافقة،\nوتعود إن رُفض الطلب أو أُلغي أو سُحب. يصل بريد إلى معتمِدي الخطوة الأولى (المدير أو الموارد البشرية).\nيُسجَّل في سجل الطلب وسجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/create","label":"Submit leave requests","x-label-ar":"تقديم طلبات إجازة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The request, waiting for its first approver.","x-description-ar":"الطلب بانتظار معتمِده الأول.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"leave_policy_id":7,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","reason":"Family visit","status":"pending","on_behalf":false,"created_at":"2026-03-02 06:00:00 UTC"}},"schema":{"$ref":"#/components/schemas/leave_request_created"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The leave cannot be requested.","x-description-ar":"لا يمكن طلب الإجازة.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leave_request"],"properties":{"leave_request":{"$ref":"#/components/schemas/leave_request_input","required":["leave_policy_id","start_date","end_date"]}}},"example":{"leave_request":{"leave_policy_id":7,"start_date":"2026-03-09","end_date":"2026-03-11","reason":"Family visit"}}}},"required":true,"description":"The leave being requested."}}},"/leave_requests/assigned_leave_policies":{"get":{"summary":"List my leave types","operationId":"leave_requests.assigned_leave_policies","tags":["Leave requests"],"description":"Returns every leave policy assigned to the token owner (Annual leave, Sick leave…), alphabetically, as\n`label` / `value` pairs. Policies HR has since switched off stay in the list, so old requests can still be\nfiltered by them.\n\n**When to use:** to turn a leave type a person names (\"my annual leave\") into the `leave_policy_id` that\n`leave_requests.validate` and `leave_requests.create` take, or for the `q[leave_policy_id_eq]` filter of\n`leave_requests.list`. A switched-off policy is refused when submitting.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض أنواع إجازاتي","x-description-ar":"يعيد كل سياسات الإجازة المسندة إلى صاحب الرمز (سنوية، مرضية…) مرتبة أبجدياً، كأزواج `label` / `value`.\nتبقى في القائمة السياسات التي عطّلتها الموارد البشرية لاحقاً، لتظل الطلبات القديمة قابلة للتصفية بها.\n\n**متى تستخدمه:** لتحويل نوع إجازة يذكره الشخص («إجازتي السنوية») إلى رقم `leave_policy_id` الذي تحتاجه\n`leave_requests.validate` و`leave_requests.create`، أو لمرشّح `q[leave_policy_id_eq]` في\n`leave_requests.list`. السياسة المعطّلة تُرفض عند التقديم.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The assigned leave policies.","x-description-ar":"سياسات الإجازة المسندة.","content":{"application/json":{"example":{"data":[{"label":"Annual leave","value":7},{"label":"Sick leave","value":8}]},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","description":"One entry per policy.","x-description-ar":"عنصر لكل سياسة.","items":{"type":"object","properties":{"label":{"type":"string","description":"Policy name, in the requested language.","x-description-ar":"اسم السياسة بلغة الطلب."},"value":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/leave_requests/bulk_approve":{"patch":{"summary":"Approve several leave requests at once","operationId":"leave_requests.bulk_approve","tags":["Leave requests"],"description":"Runs `leave_requests.approve` on up to 50 requests, one by one. Each is decided on its own: one that cannot\nbe approved (not your step any more, now overlapping an approved leave, not found) is listed in `failed`\nwith its reason and does not stop the others. The answer is 200 whenever the batch ran.\n\n**When to use:** for an approver clearing a queue in QHR-connected tools. For one request, use\n`leave_requests.approve`.\n\n**Prerequisites:** ids from `team_leaves.pending_requests` (rows with `can_act: true`).\n\n**Side effects:** the same as `leave_requests.approve`, for each approved request: final approvals turn\nreserved days into taken days, mark attendance and email each employee. Not offered to Claude: it decides\nmany people's leave in one call.","x-summary-ar":"الموافقة على عدة طلبات إجازة دفعة واحدة","x-description-ar":"ينفّذ `leave_requests.approve` على ما يصل إلى ٥٠ طلباً، واحداً تلو الآخر. يُبتّ في كل طلب على حدة: ما لا\nتمكن الموافقة عليه (لم تعد خطوتك، أو صار يتداخل مع إجازة موافق عليها، أو غير موجود) يُذكر في `failed` مع\nسببه ولا يوقف البقية. الإجابة 200 ما دامت الدفعة قد نُفّذت.\n\n**متى تستخدمه:** للمعتمِد الذي ينجز قائمة انتظاره عبر الأدوات المرتبطة بـ QHR. لطلب واحد استخدم\n`leave_requests.approve`.\n\n**المتطلبات:** الأرقام من `team_leaves.pending_requests` (الصفوف التي فيها `can_act: true`).\n\n**الآثار الجانبية:** كما في `leave_requests.approve` لكل طلب يُوافق عليه: تتحول الأيام المحجوزة في\nالموافقات النهائية إلى مأخوذة، ويُعلَّم الحضور، ويصل كل موظف بريد. لا يُعرض على Claude: يبتّ في إجازات\nعدة أشخاص في استدعاء واحد.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"What was approved and what was not.","x-description-ar":"ما وُوفق عليه وما لم يُوافق عليه.","content":{"application/json":{"example":{"succeeded":[5120],"failed":[{"id":5121,"error":"This leave request is not at a stage you can act on."}]},"schema":{"type":"object","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids that were decided.","x-description-ar":"الأرقام التي تم البت فيها.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids that were not, each with the reason.","x-description-ar":"الأرقام التي لم يُبتّ فيها، مع سبب كلٍّ منها.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"error":{"type":"string","description":"Why it was not decided.","x-description-ar":"سبب عدم البت فيه."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"Nothing was attempted.","x-description-ar":"لم يُنفَّذ شيء.","x-codes":[{"code":"validation_failed","meaning":"Nothing was attempted: no `ids`, more than 50, or (to reject) no `note`.","x-meaning-ar":"لم يُنفَّذ شيء: لا `ids`، أو أكثر من ٥٠، أو (للرفض) لا `note`.","x-fix":"Send 1 to 50 ids, and a note when rejecting.","x-fix-ar":"أرسل من ١ إلى ٥٠ رقماً، وملاحظة عند الرفض."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Select at least one leave request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","description":"Leave request ids, 1 to 50, from `team_leaves.pending_requests`.","x-description-ar":"أرقام طلبات الإجازة، من ١ إلى ٥٠، من `team_leaves.pending_requests`.","items":{"type":"integer"}},"note":{"type":"string","description":"An optional note for every employee.","x-description-ar":"ملاحظة اختيارية لكل موظف."}}},"example":{"ids":[5120,5121]}}},"required":true,"description":"The requests to approve."}}},"/leave_requests/bulk_reject":{"patch":{"summary":"Reject several leave requests at once","operationId":"leave_requests.bulk_reject","tags":["Leave requests"],"description":"Runs `leave_requests.reject` on up to 50 requests with one shared reason (`note`, required). Each is decided\non its own; one that cannot be rejected is listed in `failed` with its reason. The answer is 200 whenever\nthe batch ran. An HR rejection of a request a manager approved sends it back to that manager, as with\n`leave_requests.reject`.\n\n**When to use:** for an approver refusing many requests for the same reason. For one request, use\n`leave_requests.reject`.\n\n**Prerequisites:** ids from `team_leaves.pending_requests`.\n\n**Side effects:** the same as `leave_requests.reject`, for each request: the reserved days come back and\neach employee is emailed the reason. Not offered to Claude: it decides many people's leave in one call.","x-summary-ar":"رفض عدة طلبات إجازة دفعة واحدة","x-description-ar":"ينفّذ `leave_requests.reject` على ما يصل إلى ٥٠ طلباً بسبب واحد مشترك (`note`، إلزامي). يُبتّ في كل طلب على\nحدة، وما لا يمكن رفضه يُذكر في `failed` مع سببه. الإجابة 200 ما دامت الدفعة قد نُفّذت. رفض الموارد البشرية\nلطلب وافق عليه مدير يعيده إلى ذلك المدير، كما في `leave_requests.reject`.\n\n**متى تستخدمه:** للمعتمِد الذي يرفض طلبات كثيرة للسبب نفسه. لطلب واحد استخدم `leave_requests.reject`.\n\n**المتطلبات:** الأرقام من `team_leaves.pending_requests`.\n\n**الآثار الجانبية:** كما في `leave_requests.reject` لكل طلب: تعود الأيام المحجوزة ويصل كل موظف بريد بالسبب.\nلا يُعرض على Claude: يبتّ في إجازات عدة أشخاص في استدعاء واحد.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"What was rejected and what was not.","x-description-ar":"ما رُفض وما لم يُرفض.","content":{"application/json":{"example":{"succeeded":[5120,5121],"failed":[]},"schema":{"type":"object","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids that were decided.","x-description-ar":"الأرقام التي تم البت فيها.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids that were not, each with the reason.","x-description-ar":"الأرقام التي لم يُبتّ فيها، مع سبب كلٍّ منها.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"error":{"type":"string","description":"Why it was not decided.","x-description-ar":"سبب عدم البت فيه."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"Nothing was attempted.","x-description-ar":"لم يُنفَّذ شيء.","x-codes":[{"code":"validation_failed","meaning":"Nothing was attempted: no `ids`, more than 50, or (to reject) no `note`.","x-meaning-ar":"لم يُنفَّذ شيء: لا `ids`، أو أكثر من ٥٠، أو (للرفض) لا `note`.","x-fix":"Send 1 to 50 ids, and a note when rejecting.","x-fix-ar":"أرسل من ١ إلى ٥٠ رقماً، وملاحظة عند الرفض."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A note is required to reject this leave request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","note"],"properties":{"ids":{"type":"array","description":"Leave request ids, 1 to 50, from `team_leaves.pending_requests`.","x-description-ar":"أرقام طلبات الإجازة، من ١ إلى ٥٠، من `team_leaves.pending_requests`.","items":{"type":"integer"}},"note":{"type":"string","description":"One reason for all of them, which each employee sees.","x-description-ar":"سبب واحد لها جميعاً، يراه كل موظف."}}},"example":{"ids":[5120,5121],"note":"Year-end freeze: no leave in the last two weeks of March."}}},"required":true,"description":"The requests to reject, with one reason."}}},"/leave_requests/export":{"get":{"summary":"Download my leave requests as a spreadsheet","operationId":"leave_requests.export","tags":["Leave requests"],"description":"Builds an Excel (`format=xlsx`) or CSV (`format=csv`) file of the rows `leave_requests.list` shows for the\nsame filters (the current month when `q[from]` / `q[to]` are omitted), with the columns you choose, headed\nin the requested language. `format` is required: without it the answer is 400 `bad_format`.\n\nUp to 10,000 rows the file comes back at once (200). Above that it is built in the background and the\nanswer is 202 with the export record (`export`); the file is then collected from QHR › Exports. Above\n20,000 rows the export is refused (422 `too_large`).\n\n**When to use:** to hand a person or another system a file of leave requests. To read the requests, use\n`leave_requests.list`.\n\n**Prerequisites:** `columns[]` from `leave_requests.export_columns`. `employee_id` exports another\nemployee's requests and needs \"View others' leave requests\".\n\n**Side effects:** each attempt is recorded in the company's export history and the audit log; a background\nexport emails its owner when the file is ready. One export of this page per user runs at a time (409\n`export_in_progress`). Not offered to Claude: it returns a file, not JSON.","x-summary-ar":"تنزيل طلبات إجازتي في جدول بيانات","x-description-ar":"ينشئ ملف Excel (`format=xlsx`) أو CSV (`format=csv`) بالصفوف التي يعرضها `leave_requests.list` للمرشحات\nنفسها (الشهر الحالي إن لم يُرسل `q[from]` و`q[to]`)، بالأعمدة التي تختارها وبعناوين بلغة الطلب. `format`\nإلزامي: بدونه يكون الرد 400 `bad_format`.\n\nحتى ١٠٬٠٠٠ صف يعود الملف مباشرة (200). وفوق ذلك يُبنى في الخلفية ويكون الرد 202 مع سجل التصدير (`export`)،\nويُستلم الملف بعدها من QHR › التصدير. وفوق ٢٠٬٠٠٠ صف يُرفض التصدير (422 `too_large`).\n\n**متى تستخدمه:** لتسليم شخص أو نظام آخر ملفاً بطلبات الإجازة. لقراءة الطلبات استخدم `leave_requests.list`.\n\n**المتطلبات:** `columns[]` من `leave_requests.export_columns`. يصدّر `employee_id` طلبات موظف آخر ويحتاج\n«عرض طلبات إجازة الآخرين».\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل التصدير في الشركة وفي سجل التدقيق، ويصل صاحبَ التصدير في الخلفية\nبريد عند جاهزية الملف. يعمل تصدير واحد لهذه الصفحة لكل مستخدم في الوقت نفسه (409 `export_in_progress`). لا\nيُعرض على Claude: يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"}]},"x-feature":"leave_request","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"The file type: `xlsx` (Excel) or `csv`.","x-description-ar":"نوع الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"description":"The columns, in order (`key` from `leave_requests.export_columns`).","x-description-ar":"الأعمدة بالترتيب (`key` من `leave_requests.export_columns`).","example":["leave_type_name","start_date","end_date","balance","status"]},{"name":"q[from]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window start, as in `leave_requests.list`.","x-description-ar":"بداية الفترة، كما في `leave_requests.list`.","example":"2026-03-01"},{"name":"q[to]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window end, as in `leave_requests.list`.","x-description-ar":"نهاية الفترة، كما في `leave_requests.list`.","example":"2026-03-31"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending","approved","rejected","cancelled","revoked"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"approved"},{"name":"employee_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Another employee's requests. Needs \"View others' leave requests\".","x-description-ar":"طلبات موظف آخر. يحتاج «عرض طلبات إجازة الآخرين».","example":1203}],"responses":{"200":{"description":"The file (Excel or CSV, as asked).","x-description-ar":"الملف (Excel أو CSV حسب الطلب).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows to build at once: the export is queued; collect the file from QHR › Exports.","x-description-ar":"صفوف كثيرة لا تُبنى دفعة واحدة: أُدرج التصدير في قائمة الانتظار؛ استلم الملف من QHR › التصدير."},"400":{"description":"The format, columns or dates are not valid.","x-description-ar":"الصيغة أو الأعمدة أو التواريخ غير صحيحة.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No column was sent in `columns[]`.","x-meaning-ar":"لم يُرسل أي عمود في `columns[]`.","x-fix":"Send at least one `key` from the export's columns operation.","x-fix-ar":"أرسل مفتاحاً واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A column in `columns[]` does not exist on this export, or you may not see it.","x-meaning-ar":"عمود في `columns[]` غير موجود في هذا التصدير أو لا يحق لك رؤيته.","x-fix":"Send only `key` values from the export's columns operation.","x-fix-ar":"أرسل فقط قيم `key` من عملية أعمدة التصدير."},{"code":"bad_request","meaning":"A date filter is not a valid date.","x-meaning-ar":"مرشح تاريخ ليس تاريخاً صحيحاً.","x-fix":"Send dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التواريخ بصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","error_code":"bad_format","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"You already have an export of this page running; `export` describes it.","x-meaning-ar":"لديك تصدير لهذه الصفحة قيد التنفيذ؛ يصفه `export`.","x-fix":"Wait for it to finish (QHR › Exports), then export again.","x-fix-ar":"انتظر حتى ينتهي (QHR › التصدير) ثم صدّر من جديد."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":31,"page":"leave_requests","format":"xlsx","status":"processing"}}}}},"422":{"description":"There is nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"No row matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي صف.","x-fix":"Widen the filters.","x-fix-ar":"وسّع المرشحات."},{"code":"too_large","meaning":"More than 20,000 rows would be written; `row_count` and `max_rows` say how many.","x-meaning-ar":"سيُكتب أكثر من ٢٠٬٠٠٠ صف؛ يوضح `row_count` و`max_rows` العدد.","x-fix":"Narrow the filters or the date range.","x-fix-ar":"ضيّق المرشحات أو الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/leave_requests/export/columns":{"get":{"summary":"List the columns of the My Leaves export","operationId":"leave_requests.export_columns","tags":["Leave requests"],"description":"Returns the columns `leave_requests.export` can put in the file (leave type, dates, days, status, stage,\nfiled on behalf, submitted on), each with its heading in the requested language and whether it is ticked\nby default.\n\n**When to use:** before `leave_requests.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs the export permission as well as \"View own leave history\".\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير «إجازاتي»","x-description-ar":"يعيد الأعمدة التي يستطيع `leave_requests.export` وضعها في الملف (نوع الإجازة، التواريخ، الأيام، الحالة،\nالمرحلة، مقدَّم نيابةً، تاريخ التقديم)، لكلٍّ عنوانه بلغة الطلب وهل هو محدد افتراضياً.\n\n**متى تستخدمه:** قبل `leave_requests.export` لاختيار `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية التصدير إضافة إلى «عرض سجل إجازاتي».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"}]},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns.","x-description-ar":"الأعمدة.","content":{"application/json":{"example":{"columns":[{"key":"leave_type_name","label":"Leave type","default":true,"type":"string"},{"key":"start_date","label":"Start date","default":true,"type":"date"},{"key":"status","label":"Status","default":true,"type":"enum"}]},"schema":{"$ref":"#/components/schemas/leave_request_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/leave_requests/stat_cards":{"get":{"summary":"Count my leave requests by status","operationId":"leave_requests.stat_cards","tags":["Leave requests"],"description":"Counts the token owner's leave requests per status (`pending`, `approved`, `rejected`, `cancelled`,\n`revoked`) and in total, over the same window and leave type as `leave_requests.list`: the current month\nwhen `q[from]` / `q[to]` are omitted. Every status is always present, zero when empty.\n\n**When to use:** for \"how many of my requests are still pending this month?\". To see the requests\nthemselves, use `leave_requests.list`. This does not count days or balance; check the balance with\n`leave_requests.validate`.\n\n**Prerequisites:** none. Policy ids from `leave_requests.assigned_leave_policies`.\n\n**Side effects:** none.","x-summary-ar":"عدّ طلبات إجازتي حسب الحالة","x-description-ar":"يعدّ طلبات إجازة صاحب الرمز لكل حالة (`pending` و`approved` و`rejected` و`cancelled` و`revoked`)\nوإجمالاً، على الفترة ونوع الإجازة نفسيهما في `leave_requests.list`: الشهر الحالي إن لم يُرسل `q[from]`\nو`q[to]`. كل الحالات موجودة دائماً، بصفر إن لم يوجد شيء.\n\n**متى تستخدمه:** لأسئلة مثل «كم طلباً لي ما زال معلّقاً هذا الشهر؟». لرؤية الطلبات نفسها استخدم\n`leave_requests.list`. لا يعدّ الأيام ولا الرصيد؛ تحقق من الرصيد عبر `leave_requests.validate`.\n\n**المتطلبات:** لا شيء. أرقام السياسات من `leave_requests.assigned_leave_policies`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[from]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window start, as in `leave_requests.list`.","x-description-ar":"بداية الفترة، كما في `leave_requests.list`.","example":"2026-03-01"},{"name":"q[to]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Window end, as in `leave_requests.list`.","x-description-ar":"نهاية الفترة، كما في `leave_requests.list`.","example":"2026-03-31"},{"name":"q[leave_policy_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this leave policy.","x-description-ar":"سياسة إجازة محددة فقط.","example":7}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"data":{"total":3,"pending":1,"approved":2,"rejected":0,"cancelled":0,"revoked":0}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"Requests per status.","x-description-ar":"عدد الطلبات لكل حالة.","properties":{"total":{"type":"integer","description":"All requests in the window.","x-description-ar":"كل الطلبات في الفترة."},"pending":{"type":"integer","description":"Waiting for a decision.","x-description-ar":"بانتظار قرار."},"approved":{"type":"integer","description":"Approved.","x-description-ar":"موافق عليها."},"rejected":{"type":"integer","description":"Rejected.","x-description-ar":"مرفوضة."},"cancelled":{"type":"integer","description":"Cancelled.","x-description-ar":"ملغاة."},"revoked":{"type":"integer","description":"Approval taken back.","x-description-ar":"سُحبت الموافقة عليها."}}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/leave_requests/validate":{"get":{"summary":"Check a leave before requesting it","operationId":"leave_requests.validate","tags":["Leave requests"],"description":"Checks dates the token owner is thinking of taking off, without saving anything: how many working days they\nwould charge (weekends, the employee's days off and public holidays are not counted), how many days are\nleft on the policy this year, whether that is enough, and which of the employee's pending or approved\nrequests share a day with them.\n\n**When to use:** always before `leave_requests.create`, to tell the person their balance and warn about\noverlaps before they commit. `exceeded: true` means submitting will be refused unless the policy allows a\nnegative balance. Overlapping an *approved* leave is refused on submit; overlapping a *pending* one only\nwarns.\n\n**Prerequisites:** `leave_policy_id` from `leave_requests.assigned_leave_policies` (an active policy).\n\n**Side effects:** none.","x-summary-ar":"التحقق من إجازة قبل طلبها","x-description-ar":"يتحقق من تواريخ يفكر صاحب الرمز في أخذها إجازة، دون حفظ أي شيء: كم يوم عمل ستُخصم (لا تُحتسب العطل\nالأسبوعية وأيام راحة الموظف والعطل الرسمية)، وكم يوماً بقي في السياسة هذه السنة، وهل يكفي ذلك، وأيّ طلبات\nالموظف المعلّقة أو الموافق عليها تشترك معها في يوم.\n\n**متى تستخدمه:** دائماً قبل `leave_requests.create`، لإخبار الشخص برصيده وتنبيهه إلى التداخل قبل أن يقدّم.\n`exceeded: true` يعني أن التقديم سيُرفض ما لم تسمح السياسة برصيد سالب. التداخل مع إجازة *موافق عليها*\nيُرفض عند التقديم، أما التداخل مع طلب *معلّق* فتنبيه فقط.\n\n**المتطلبات:** `leave_policy_id` من `leave_requests.assigned_leave_policies` (سياسة مفعّلة).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/create","label":"Submit leave requests","x-label-ar":"تقديم طلبات إجازة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"leave_policy_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The leave policy, from `leave_requests.assigned_leave_policies`.","x-description-ar":"سياسة الإجازة، من `leave_requests.assigned_leave_policies`.","example":7},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","example":"2026-03-09"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","example":"2026-03-11"}],"responses":{"200":{"description":"The check.","x-description-ar":"نتيجة التحقق.","content":{"application/json":{"example":{"overlaps":[],"balance":{"available_days":18.0,"requested_days":3.0,"allow_negative_balance":false,"exceeded":false}},"schema":{"$ref":"#/components/schemas/leave_request_validation"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The dates or the policy cannot be checked.","x-description-ar":"تعذّر التحقق من التواريخ أو السياسة.","x-codes":[{"code":"validation_failed","meaning":"The policy is not assigned to you or is switched off, a date is missing or invalid, the end is before the start, or the leave ends after your last working day. `error` says which.","x-meaning-ar":"السياسة غير مسندة إليك أو معطّلة، أو تاريخ ناقص أو غير صحيح، أو النهاية قبل البداية، أو تنتهي الإجازة بعد آخر يوم عمل لك. يوضح `error` السبب.","x-fix":"Fix what `error` names, then check again.","x-fix-ar":"صحّح ما يذكره `error` ثم أعد التحقق."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Leave policy not found or not assigned to you","code":"validation_failed"}}}}}}},"/leave_requests/{id}":{"get":{"summary":"Get one leave request with its approval history","operationId":"leave_requests.show","tags":["Leave requests"],"description":"Returns one leave request: the employee, the dates, the days charged, how the leave is paid, the reason, a\nlink to the supporting document, the stage it is at and who must decide next, and every step of its\nhistory (submitted, approved by the manager, sent to HR, cancelled…) with who did it and their note.\n`approver_actions` says whether the caller may still withdraw or revoke an approval they gave.\n\n**When to use:** to answer \"where is my leave request?\" or \"why was it rejected?\", or for an approver to\nread a request before `leave_requests.approve` / `leave_requests.reject`.\n\n**Prerequisites:** the request's `id` from `leave_requests.list` or `team_leaves.pending_requests`. You can\nopen your own requests, and any request you can decide, have decided, or may withdraw or revoke. With\n`employee_id` you open another employee's request through \"View others' leave requests\"\n(`x-permission.x-others`).\n\n**Side effects:** none.","x-summary-ar":"عرض طلب إجازة مع سجل الموافقات عليه","x-description-ar":"يعيد طلب إجازة واحداً: الموظف والتواريخ والأيام المخصومة وطريقة احتساب الأجر والسبب ورابط المستند الداعم\nوالمرحلة الحالية ومن يجب أن يقرر تالياً، وكل خطوة في سجله (قُدّم، وافق المدير، أُحيل للموارد البشرية،\nأُلغي…) مع من قام بها وملاحظته. يوضح `approver_actions` إن كان المستدعي ما زال يستطيع سحب موافقة أعطاها\nأو إلغاءها.\n\n**متى تستخدمه:** للإجابة عن «أين وصل طلب إجازتي؟» أو «لماذا رُفض؟»، أو ليقرأ المعتمِد الطلب قبل\n`leave_requests.approve` أو `leave_requests.reject`.\n\n**المتطلبات:** رقم `id` الطلب من `leave_requests.list` أو `team_leaves.pending_requests`. تستطيع فتح\nطلباتك، وأي طلب تملك البت فيه أو بتَّ فيه أو يحق لك سحب موافقته أو إلغاؤها. ومع `employee_id` تفتح طلب\nموظف آخر عبر «عرض طلبات إجازة الآخرين» (`x-permission.x-others`).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view","label":"View own leave history","x-label-ar":"عرض سجل إجازاتي","x-others":{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"}},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"},{"name":"employee_id","in":"query","required":false,"schema":{"type":"integer"},"description":"The employee who owns the request, when it is not yours. Needs \"View others' leave requests\".","x-description-ar":"الموظف صاحب الطلب إن لم يكن طلبك. يحتاج «عرض طلبات إجازة الآخرين».","example":1203}],"responses":{"200":{"description":"The leave request.","x-description-ar":"طلب الإجازة.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"approved","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":true,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change my leave request before anyone decides it","operationId":"leave_requests.update","tags":["Leave requests"],"description":"Changes the policy, the dates or the reason of one of the token owner's own requests; fields you leave out\nkeep their value. The days are counted again and the same rules as `leave_requests.create` apply (balance,\napproved overlap, working days, last working day).\n\nOnly while nobody has decided anything on it: once a manager or HR has approved, rejected or sent it on,\nor a cancellation is under review, the edit is refused (422) — cancel with `leave_requests.cancel` and\nrequest again. A request HR or the manager filed for you (`on_behalf: true`) cannot be edited.\n\n**When to use:** when a person wants to move or shorten leave they asked for and that is still waiting.\n\n**Prerequisites:** the request's `id` from `leave_requests.list`; a new `leave_policy_id` from\n`leave_requests.assigned_leave_policies`.\n\n**Side effects:** the reserved days follow the new count (a `warning` says when the count changed). The\napprovers are emailed again to look at the new version, and the change is written to the request's history\n(which fields moved) and the audit log. The request keeps its place in the approval chain.","x-summary-ar":"تعديل طلب إجازتي قبل البت فيه","x-description-ar":"يغيّر السياسة أو التواريخ أو السبب في أحد طلبات صاحب الرمز؛ وتبقى الحقول التي لا ترسلها كما هي. تُعاد\nحساب الأيام وتنطبق قواعد `leave_requests.create` نفسها (الرصيد، والتداخل مع إجازة موافق عليها، وأيام\nالعمل، وآخر يوم عمل).\n\nفقط ما دام أحد لم يبتّ فيه بشيء: بعد أن يوافق المدير أو الموارد البشرية أو يرفض أو يحيل الطلب، أو أثناء\nمراجعة طلب إلغاء، يُرفض التعديل (422) — ألغِه عبر `leave_requests.cancel` واطلب من جديد. ولا يُعدَّل\nالطلب الذي قدّمته الموارد البشرية أو المدير نيابةً عنك (`on_behalf: true`).\n\n**متى تستخدمه:** حين يريد الشخص تغيير موعد إجازة طلبها أو تقصيرها وهي ما زالت تنتظر.\n\n**المتطلبات:** رقم `id` الطلب من `leave_requests.list`، ورقم `leave_policy_id` الجديد من\n`leave_requests.assigned_leave_policies`.\n\n**الآثار الجانبية:** تتبع الأيام المحجوزة العدد الجديد (يوضح `warning` إن تغيّر العدد). يصل المعتمِدين\nبريد جديد لمراجعة النسخة المعدّلة، ويُكتب التغيير في سجل الطلب (الحقول التي تغيّرت) وفي سجل التدقيق. يحتفظ\nالطلب بموضعه في سلسلة الموافقة.","x-access":"write","x-permission":{"key":"leave_request/create","label":"Submit leave requests","x-label-ar":"تقديم طلبات إجازة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request after the change, with a warning when the day count moved.","x-description-ar":"الطلب بعد التعديل، مع تنبيه إن تغيّر عدد الأيام.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-12","balance":"4.0","status":"pending","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"awaiting_manager","current_approver_name":"Omar Ali","employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":true,"revoke_blocked_reason":null}},"warning":"The number of leave days changed from 3.0 to 4.0, and your balance has been adjusted."},"schema":{"$ref":"#/components/schemas/leave_request_updated"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Someone already decided on the request (or it was filed for you, or a cancellation is under review), or the new values break a leave rule. `error` says which.","x-meaning-ar":"سبق أن بتّ أحد في الطلب (أو قُدّم نيابةً عنك، أو هناك طلب إلغاء قيد المراجعة)، أو القيم الجديدة تخالف قاعدة إجازة. يوضح `error` السبب.","x-fix":"Cancel it with `leave_requests.cancel` and request again, or fix the values.","x-fix-ar":"ألغِه عبر `leave_requests.cancel` واطلب من جديد، أو صحّح القيم."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request can no longer be edited. Cancel it and submit a new one instead.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leave_request"],"properties":{"leave_request":{"$ref":"#/components/schemas/leave_request_input"}}},"example":{"leave_request":{"end_date":"2026-03-12"}}}},"required":true,"description":"The fields to change."}}},"/leave_requests/{id}/approve":{"patch":{"summary":"Approve a leave request waiting for me","operationId":"leave_requests.approve","tags":["Leave requests"],"description":"Approves the step of a leave request the caller holds:\n\n- **Manager step** (`current_stage: awaiting_manager`): on a `manager` policy the leave is approved; on a\n  `manager_and_hr` policy it moves to HR (`awaiting_hr`) and stays pending until HR decides.\n- **HR step** (`awaiting_hr`): the final approval.\n\nThe caller must hold the step now: the employee's manager, any manager above them while the manager is on\nleave today, or HR when no manager can act. Refused (422) when the request is not at a step the caller\nholds, when the employee already has an approved leave on those dates, when a day was already paid as an\nabsence in a processed payroll, or when no working day is left in the range.\n\n**When to use:** when a manager or HR says \"approve Sara's leave\". Read it first with\n`leave_requests.show`. To refuse, use `leave_requests.reject`.\n\n**Prerequisites:** the request's `id` from `team_leaves.pending_requests` (rows with `can_act: true`).\n\n**Side effects:** on the final approval the reserved days become taken, the days are marked as leave in\nattendance (absences recorded for them are released), and the employee is emailed. A manager approval on a\n`manager_and_hr` policy sends nothing yet. Recorded in the request's history with your note, and in the\naudit log.","x-summary-ar":"الموافقة على طلب إجازة ينتظرني","x-description-ar":"يوافق على خطوة طلب الإجازة التي يحملها المستدعي:\n\n- **خطوة المدير** (`current_stage: awaiting_manager`): في سياسة `manager` تُعتمد الإجازة، وفي سياسة\n  `manager_and_hr` ينتقل الطلب إلى الموارد البشرية (`awaiting_hr`) ويبقى معلّقاً حتى تقرر.\n- **خطوة الموارد البشرية** (`awaiting_hr`): الموافقة النهائية.\n\nيجب أن يحمل المستدعي الخطوة الآن: مدير الموظف، أو أي مدير أعلى منه ما دام المدير في إجازة اليوم، أو\nالموارد البشرية إن لم يستطع أي مدير التصرف. يُرفض (422) إن لم يكن الطلب في خطوة يحملها المستدعي، أو كانت\nللموظف إجازة موافق عليها في التواريخ نفسها، أو دُفع يوم منها كغياب في مسير رواتب مُعالج، أو لم يبقَ في\nالفترة يوم عمل.\n\n**متى تستخدمه:** حين يقول مدير أو موظف موارد بشرية «وافق على إجازة سارة». اقرأ الطلب أولاً عبر\n`leave_requests.show`. للرفض استخدم `leave_requests.reject`.\n\n**المتطلبات:** رقم `id` الطلب من `team_leaves.pending_requests` (الصفوف التي فيها `can_act: true`).\n\n**الآثار الجانبية:** عند الموافقة النهائية تصبح الأيام المحجوزة مأخوذة، وتُعلَّم الأيام إجازةً في الحضور\n(ويُرفع ما سُجّل فيها من غياب)، ويصل الموظفَ بريد. موافقة المدير في سياسة `manager_and_hr` لا ترسل شيئاً\nبعد. يُسجَّل في سجل الطلب مع ملاحظتك وفي سجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request after the approval.","x-description-ar":"الطلب بعد الموافقة.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"approved","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":true,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The approval was refused.","x-description-ar":"رُفضت الموافقة.","x-codes":[{"code":"validation_failed","meaning":"The request is not at a stage you can act on (already decided, or waiting for someone else), it now overlaps another approved leave of the employee, it falls in a payroll already paid, no working day is left in it, or a required note is missing. `error` says which.","x-meaning-ar":"الطلب ليس في مرحلة يمكنك التصرف فيها (حُسم، أو ينتظر غيرك)، أو صار يتداخل مع إجازة أخرى موافق عليها للموظف، أو يقع في مسير رواتب صُرف، أو لم يبقَ فيه يوم عمل، أو الملاحظة المطلوبة ناقصة. يوضح `error` السبب.","x-fix":"Re-read the request with `leave_requests.show`; send a `note` when one is required.","x-fix-ar":"أعد قراءة الطلب عبر `leave_requests.show`، وأرسل `note` إن كانت مطلوبة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This leave request is not at a stage you can act on.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_decision_note"},"example":{"note":"Enjoy your break."}}},"required":true,"description":"An optional note for the employee."}}},"/leave_requests/{id}/approve_cancellation":{"patch":{"summary":"Agree to cancel an approved leave","operationId":"leave_requests.approve_cancellation","tags":["Leave requests"],"description":"Accepts an employee's request to cancel leave that was already approved (`current_stage:\ncancellation_review`, raised with `leave_requests.cancel`): the leave becomes `cancelled`. A reason\n(`note`) is required.\n\nThe employee's manager decides it on `manager` and `manager_and_hr` policies (one sign-off, no HR step);\nHR decides it on `hr` policies.\n\n**When to use:** when the approver agrees the employee no longer takes the leave. To keep the leave, use\n`leave_requests.reject_cancellation`.\n\n**Prerequisites:** the request's `id` from `team_leaves.pending_requests` (`current_stage:\ncancellation_review`).\n\n**Side effects:** the days come back to the employee's balance, the days are no longer leave in\nattendance, and the employee is emailed. Recorded in the request's history and the audit log.","x-summary-ar":"الموافقة على إلغاء إجازة موافق عليها","x-description-ar":"يقبل طلب الموظف إلغاء إجازة موافق عليها مسبقاً (`current_stage: cancellation_review`، الذي يُرفع عبر\n`leave_requests.cancel`): تصبح الإجازة `cancelled`. السبب (`note`) إلزامي.\n\nيقرر فيه مدير الموظف في سياستي `manager` و`manager_and_hr` (توقيع واحد بلا خطوة موارد بشرية)، والموارد\nالبشرية في سياسة `hr`.\n\n**متى تستخدمه:** حين يوافق المعتمِد على أن الموظف لن يأخذ الإجازة. لإبقاء الإجازة استخدم\n`leave_requests.reject_cancellation`.\n\n**المتطلبات:** رقم `id` الطلب من `team_leaves.pending_requests` (`current_stage: cancellation_review`).\n\n**الآثار الجانبية:** تعود الأيام إلى رصيد الموظف، ولا تبقى الأيام إجازةً في الحضور، ويصل الموظفَ بريد.\nيُسجَّل في سجل الطلب وسجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The cancelled request.","x-description-ar":"الطلب الملغى.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"cancelled","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The decision was refused.","x-description-ar":"رُفض القرار.","x-codes":[{"code":"validation_failed","meaning":"The request is not at a stage you can act on (already decided, or waiting for someone else), it now overlaps another approved leave of the employee, it falls in a payroll already paid, no working day is left in it, or a required note is missing. `error` says which.","x-meaning-ar":"الطلب ليس في مرحلة يمكنك التصرف فيها (حُسم، أو ينتظر غيرك)، أو صار يتداخل مع إجازة أخرى موافق عليها للموظف، أو يقع في مسير رواتب صُرف، أو لم يبقَ فيه يوم عمل، أو الملاحظة المطلوبة ناقصة. يوضح `error` السبب.","x-fix":"Re-read the request with `leave_requests.show`; send a `note` when one is required.","x-fix-ar":"أعد قراءة الطلب عبر `leave_requests.show`، وأرسل `note` إن كانت مطلوبة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A note is required to decide this cancellation request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_required_note"},"example":{"note":"Cancelled as asked."}}},"required":true,"description":"The reason, which the employee sees."}}},"/leave_requests/{id}/cancel":{"patch":{"summary":"Cancel my leave request","operationId":"leave_requests.cancel","tags":["Leave requests"],"description":"Cancels one of the token owner's own leave requests. What happens depends on how far it got:\n\n- **Still waiting, and no manager has approved it yet:** cancelled at once (`status: cancelled`).\n- **Approved, or already approved by the manager and waiting for HR, or filed for you by HR or the\n  manager:** becomes a cancellation request for the approver (`current_stage: cancellation_review`); the\n  leave stands until they decide with `leave_requests.approve_cancellation` or\n  `leave_requests.reject_cancellation`. Cancelling an approved leave needs a `note`.\n\nRefused (422) once the leave has started, when it was already rejected, cancelled or revoked, or while an\nearlier cancellation is under review.\n\n**When to use:** when a person no longer needs leave they asked for. To change the dates of a request no one\nhas decided yet, `leave_requests.update` keeps it in the queue instead.\n\n**Prerequisites:** the request's `id` from `leave_requests.list` (check `locked` / `lock_reason` there).\n\n**Side effects:** a direct cancellation gives the reserved days back at once and emails the approvers that\nit was withdrawn. A cancellation request emails the approvers asking them to review it; the days come back\nonly when they approve it. Recorded in the request's history and the audit log.","x-summary-ar":"إلغاء طلب إجازتي","x-description-ar":"يلغي أحد طلبات إجازة صاحب الرمز. ويتوقف ما يحدث على المرحلة التي بلغها:\n\n- **ما زال ينتظر ولم يوافق عليه مدير بعد:** يُلغى فوراً (`status: cancelled`).\n- **موافق عليه، أو وافق عليه المدير وينتظر الموارد البشرية، أو قدّمته الموارد البشرية أو المدير نيابةً\n  عنك:** يصبح طلب إلغاء لدى المعتمِد (`current_stage: cancellation_review`)، وتبقى الإجازة قائمة حتى\n  يقرر عبر `leave_requests.approve_cancellation` أو `leave_requests.reject_cancellation`. إلغاء إجازة\n  موافق عليها يحتاج `note`.\n\nيُرفض (422) بعد بدء الإجازة، أو إن كان الطلب مرفوضاً أو ملغى أو مسحوبة موافقته، أو أثناء مراجعة طلب إلغاء\nسابق.\n\n**متى تستخدمه:** حين لا يعود الشخص بحاجة إلى إجازة طلبها. لتغيير تواريخ طلب لم يُبتّ فيه بعد،\n`leave_requests.update` يبقيه في قائمة الانتظار بدلاً من ذلك.\n\n**المتطلبات:** رقم `id` الطلب من `leave_requests.list` (راجع `locked` و`lock_reason` هناك).\n\n**الآثار الجانبية:** الإلغاء المباشر يعيد الأيام المحجوزة فوراً ويبلغ المعتمِدين بالبريد بسحب الطلب. أما\nطلب الإلغاء فيصل المعتمِدين بريد يطلب مراجعته، ولا تعود الأيام إلا عند موافقتهم. يُسجَّل في سجل الطلب وسجل\nالتدقيق.","x-access":"write","x-permission":{"key":"leave_request/cancel","label":"Cancel leave requests","x-label-ar":"إلغاء طلبات الإجازة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request after the cancellation.","x-description-ar":"الطلب بعد الإلغاء.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"leave_policy_id":7,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","reason":"Family visit","status":"cancelled","created_at":"2026-03-02 06:00:00 UTC","note":"Plans changed."}},"schema":{"$ref":"#/components/schemas/leave_request_cancelled"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be cancelled.","x-description-ar":"لا يمكن إلغاء الطلب.","x-codes":[{"code":"validation_failed","meaning":"The leave has started, the request is already closed or under cancellation review, or an approved leave was cancelled without a `note`. `error` says which.","x-meaning-ar":"بدأت الإجازة، أو الطلب مغلق أو قيد مراجعة إلغاء، أو أُلغيت إجازة موافق عليها دون `note`. يوضح `error` السبب.","x-fix":"Send a `note` for an approved leave; otherwise there is nothing left to cancel.","x-fix-ar":"أرسل `note` للإجازة الموافق عليها؛ وإلا فلا شيء يمكن إلغاؤه."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no leave of their own.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فليست له إجازات خاصة به.","x-fix":"Ask HR to link your user to your employee record, or use a token of a user who has one.","x-fix-ar":"اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي، أو استخدم رمز مستخدم له سجل."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A reason is required to cancel an approved leave request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","description":"The reason, up to 500 characters. Required when the leave is approved.","x-description-ar":"السبب، حتى ٥٠٠ حرف. إلزامي إن كانت الإجازة موافقاً عليها.","maxLength":500}}},"example":{"note":"Plans changed."}}},"required":true,"description":"Why. Required to cancel an approved leave."}}},"/leave_requests/{id}/reject":{"patch":{"summary":"Reject a leave request waiting for me","operationId":"leave_requests.reject","tags":["Leave requests"],"description":"Rejects the step of a leave request the caller holds, with a reason (`note`, required):\n\n- **Manager step:** the request is rejected.\n- **HR step**, after a manager approved it: the request goes back to the manager (`awaiting_manager`)\n  for another look rather than ending; it stays pending.\n- **HR step** with no manager approval behind it (an `hr` policy, or no manager): the request is rejected.\n\nWho holds a step is the same as for `leave_requests.approve`.\n\n**When to use:** when a manager or HR refuses a leave request. To approve instead, use\n`leave_requests.approve`.\n\n**Prerequisites:** the request's `id` from `team_leaves.pending_requests`.\n\n**Side effects:** a rejection gives the reserved days back and emails the employee with the reason. A\nsend-back emails the manager who must look again. Recorded in the request's history and the audit log.","x-summary-ar":"رفض طلب إجازة ينتظرني","x-description-ar":"يرفض خطوة طلب الإجازة التي يحملها المستدعي، مع سبب (`note`، إلزامي):\n\n- **خطوة المدير:** يُرفض الطلب.\n- **خطوة الموارد البشرية** بعد موافقة المدير: يعود الطلب إلى المدير (`awaiting_manager`) لمراجعته مجدداً\n  بدل أن ينتهي، ويبقى معلّقاً.\n- **خطوة الموارد البشرية** دون موافقة مدير قبلها (سياسة `hr`، أو لا مدير): يُرفض الطلب.\n\nمن يحمل الخطوة هو نفسه كما في `leave_requests.approve`.\n\n**متى تستخدمه:** حين يرفض مدير أو الموارد البشرية طلب إجازة. للموافقة استخدم `leave_requests.approve`.\n\n**المتطلبات:** رقم `id` الطلب من `team_leaves.pending_requests`.\n\n**الآثار الجانبية:** الرفض يعيد الأيام المحجوزة ويصل الموظفَ بريد بالسبب. أما الإعادة فيصل بها بريد إلى\nالمدير الذي عليه المراجعة. يُسجَّل في سجل الطلب وسجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request after the decision.","x-description-ar":"الطلب بعد القرار.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"rejected","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The rejection was refused.","x-description-ar":"رُفض قرار الرفض.","x-codes":[{"code":"validation_failed","meaning":"The request is not at a stage you can act on (already decided, or waiting for someone else), it now overlaps another approved leave of the employee, it falls in a payroll already paid, no working day is left in it, or a required note is missing. `error` says which.","x-meaning-ar":"الطلب ليس في مرحلة يمكنك التصرف فيها (حُسم، أو ينتظر غيرك)، أو صار يتداخل مع إجازة أخرى موافق عليها للموظف، أو يقع في مسير رواتب صُرف، أو لم يبقَ فيه يوم عمل، أو الملاحظة المطلوبة ناقصة. يوضح `error` السبب.","x-fix":"Re-read the request with `leave_requests.show`; send a `note` when one is required.","x-fix-ar":"أعد قراءة الطلب عبر `leave_requests.show`، وأرسل `note` إن كانت مطلوبة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A note is required to reject this leave request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_required_note"},"example":{"note":"The team is short that week."}}},"required":true,"description":"The reason, which the employee sees."}}},"/leave_requests/{id}/reject_cancellation":{"patch":{"summary":"Refuse to cancel an approved leave","operationId":"leave_requests.reject_cancellation","tags":["Leave requests"],"description":"Refuses an employee's request to cancel leave that was already approved: the leave stands as approved and\nthe request leaves the review queue. A reason (`note`) is required. Who decides is the same as for\n`leave_requests.approve_cancellation`.\n\n**When to use:** when the approver needs the employee to keep the leave as booked.\n\n**Prerequisites:** the request's `id` from `team_leaves.pending_requests` (`current_stage:\ncancellation_review`).\n\n**Side effects:** the employee is emailed with the reason. The balance and attendance do not change.\nRecorded in the request's history and the audit log.","x-summary-ar":"رفض إلغاء إجازة موافق عليها","x-description-ar":"يرفض طلب الموظف إلغاء إجازة موافق عليها مسبقاً: تبقى الإجازة موافقاً عليها ويخرج الطلب من قائمة المراجعة.\nالسبب (`note`) إلزامي. من يقرر هو نفسه كما في `leave_requests.approve_cancellation`.\n\n**متى تستخدمه:** حين يحتاج المعتمِد أن يبقي الموظف إجازته كما حُجزت.\n\n**المتطلبات:** رقم `id` الطلب من `team_leaves.pending_requests` (`current_stage: cancellation_review`).\n\n**الآثار الجانبية:** يصل الموظفَ بريد بالسبب. لا يتغير الرصيد ولا الحضور. يُسجَّل في سجل الطلب وسجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request, still approved.","x-description-ar":"الطلب، وما زال موافقاً عليه.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"approved","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":null,"revocation":null,"approver_actions":{"can_withdraw":false,"can_revoke":true,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The decision was refused.","x-description-ar":"رُفض القرار.","x-codes":[{"code":"validation_failed","meaning":"The request is not at a stage you can act on (already decided, or waiting for someone else), it now overlaps another approved leave of the employee, it falls in a payroll already paid, no working day is left in it, or a required note is missing. `error` says which.","x-meaning-ar":"الطلب ليس في مرحلة يمكنك التصرف فيها (حُسم، أو ينتظر غيرك)، أو صار يتداخل مع إجازة أخرى موافق عليها للموظف، أو يقع في مسير رواتب صُرف، أو لم يبقَ فيه يوم عمل، أو الملاحظة المطلوبة ناقصة. يوضح `error` السبب.","x-fix":"Re-read the request with `leave_requests.show`; send a `note` when one is required.","x-fix-ar":"أعد قراءة الطلب عبر `leave_requests.show`، وأرسل `note` إن كانت مطلوبة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This leave request is not at a stage you can act on.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_required_note"},"example":{"note":"We need you that week."}}},"required":true,"description":"The reason, which the employee sees."}}},"/leave_requests/{id}/revoke":{"patch":{"summary":"Revoke a final approval before the leave starts","operationId":"leave_requests.revoke","tags":["Leave requests"],"description":"Takes back the final approval of a leave that has not started yet. The request ends as `revoked` with\n`revoke_type: revoked`. Only the first approver in the leave's route may do it, alone: the manager on\n`manager` and `manager_and_hr` policies (HR when no manager signed or can act), HR on `hr` policies. A\nreason (`note`, up to 500 characters) is required.\n\nRefused (422, `code` naming the reason) on your own request, once the leave has started, while the employee's\ncancellation request is under review (decide that instead), or when a day falls in a payroll run that is\nalready processed.\n\n**When to use:** when an approved leave can no longer be granted, before it begins. A manager approval\nstill waiting for HR is taken back with `leave_requests.withdraw`.\n\n**Prerequisites:** the request's `id`, where `approver_actions.can_revoke` is true (`leave_requests.show`).\n\n**Side effects:** the days come back to the employee's balance, the leave days are removed from\nattendance, and the employee is emailed with the reason; on a `manager_and_hr` policy the HR person who gave\nthe final approval is told too. Recorded in the request's history and the audit log. Not offered to Claude:\nit cancels leave the employee has already planned around, so a person should decide it in QHR.","x-summary-ar":"إلغاء موافقة نهائية قبل بدء الإجازة","x-description-ar":"يسحب الموافقة النهائية على إجازة لم تبدأ بعد. ينتهي الطلب بالحالة `revoked` مع `revoke_type: revoked`. لا\nيفعل ذلك إلا المعتمِد الأول في مسار الإجازة، ووحده: المدير في سياستي `manager` و`manager_and_hr` (والموارد\nالبشرية إن لم يوقّع مدير أو لم يستطع التصرف)، والموارد البشرية في سياسة `hr`. السبب (`note`، حتى ٥٠٠ حرف)\nإلزامي.\n\nيُرفض (422 مع `code` يسمّي السبب) في طلبك أنت، وبعد بدء الإجازة، وأثناء مراجعة طلب إلغاء قدّمه الموظف (قرّر فيه\nبدلاً من ذلك)، وإن وقع يوم منها في مسير رواتب مُعالج.\n\n**متى تستخدمه:** حين لا يعود ممكناً منح إجازة موافق عليها قبل أن تبدأ. أما موافقة المدير التي ما زالت\nتنتظر الموارد البشرية فتُسحب عبر `leave_requests.withdraw`.\n\n**المتطلبات:** رقم `id` الطلب حيث `approver_actions.can_revoke` صحيحة (`leave_requests.show`).\n\n**الآثار الجانبية:** تعود الأيام إلى رصيد الموظف، وتُزال أيام الإجازة من الحضور، ويصل الموظفَ بريد بالسبب؛\nوفي سياسة `manager_and_hr` يُبلَّغ موظف الموارد البشرية الذي أعطى الموافقة النهائية أيضاً. يُسجَّل في سجل الطلب\nوسجل التدقيق. لا يُعرض على Claude: يلغي إجازة بنى الموظف خططه عليها، فيجب أن يقرر فيها شخص من داخل QHR.","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request, now revoked.","x-description-ar":"الطلب بعد إلغاء الموافقة.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"revoked","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":"revoked","revocation":{"by":{"id":88,"full_name":"Omar Ali"},"at":"2026-03-02T09:00:00Z","note":"The release moved to that week."},"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The revocation was refused.","x-description-ar":"رُفض إلغاء الموافقة.","x-codes":[{"code":"own_request","meaning":"The request is your own leave; an approval on it cannot be taken back by you.","x-meaning-ar":"الطلب إجازتك أنت، فلا يمكنك سحب موافقة عليه.","x-fix":"Ask the employee's other approver (or HR) to act.","x-fix-ar":"اطلب من معتمِد آخر للموظف (أو الموارد البشرية) التصرف."},{"code":"not_actionable","meaning":"The request is not in a state that allows this (already decided, or not waiting for HR after a manager approval).","x-meaning-ar":"الطلب ليس في حالة تسمح بذلك (حُسم، أو لا ينتظر الموارد البشرية بعد موافقة مدير).","x-fix":"Re-read it with `leave_requests.show` and use the operation its state allows.","x-fix-ar":"أعد قراءته عبر `leave_requests.show` واستخدم العملية التي تسمح بها حالته."},{"code":"not_authorized","meaning":"You do not hold the step this takes back (you are not the first approver in the leave's route).","x-meaning-ar":"لا تحمل الخطوة التي يُراد سحبها (لست المعتمِد الأول في مسار الإجازة).","x-fix":"Only `approver_actions` flags that are true can be acted on; ask the right approver.","x-fix-ar":"لا يمكن التصرف إلا حين تكون علامة `approver_actions` صحيحة؛ اطلب من المعتمِد المعني."},{"code":"already_started","meaning":"The leave has already started.","x-meaning-ar":"بدأت الإجازة بالفعل.","x-fix":"Nothing to revoke now; the employee may ask to cancel through HR.","x-fix-ar":"لا يمكن الإلغاء الآن؛ يستطيع الموظف طلب الإلغاء عبر الموارد البشرية."},{"code":"cancellation_pending","meaning":"The employee has asked to cancel this leave; that review comes first.","x-meaning-ar":"طلب الموظف إلغاء هذه الإجازة؛ ومراجعة ذلك تأتي أولاً.","x-fix":"Decide it with `leave_requests.approve_cancellation` or `leave_requests.reject_cancellation`.","x-fix-ar":"قرّر فيه عبر `leave_requests.approve_cancellation` أو `leave_requests.reject_cancellation`."},{"code":"payroll_locked","meaning":"A day of the leave falls in a payroll run that is already processed.","x-meaning-ar":"يقع يوم من الإجازة في مسير رواتب تمت معالجته.","x-fix":"The approval stays; handle it with payroll in QHR.","x-fix-ar":"تبقى الموافقة؛ عالج الأمر مع الرواتب في QHR."},{"code":"note_required","meaning":"No reason (`note`) was sent.","x-meaning-ar":"لم يُرسل السبب (`note`).","x-fix":"Send a `note`; the employee sees it.","x-fix-ar":"أرسل `note`؛ يراه الموظف."},{"code":"note_too_long","meaning":"The reason is longer than 500 characters.","x-meaning-ar":"السبب أطول من ٥٠٠ حرف.","x-fix":"Shorten the `note` to 500 characters.","x-fix-ar":"اختصر `note` إلى ٥٠٠ حرف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This leave has already started, so the approval can no longer be revoked.","error_code":"already_started","code":"already_started"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_required_note"},"example":{"note":"The release moved to that week."}}},"required":true,"description":"The reason, which the employee sees."}}},"/leave_requests/{id}/withdraw":{"patch":{"summary":"Take back my manager approval before HR decides","operationId":"leave_requests.withdraw","tags":["Leave requests"],"description":"On a `manager_and_hr` request that the manager approved and that is still waiting for HR, the manager takes\nthe approval back. The request ends as `revoked` with `revoke_type: withdrawn` and leaves HR's queue. A\nreason (`note`, up to 500 characters) is required. HR never withdraws; you cannot act on your own request.\n\n**When to use:** when a manager approved too early (\"I approved Sara's leave before checking the plan\").\nFor a leave that already has its final approval, `leave_requests.revoke` is the operation.\n\n**Prerequisites:** the request's `id`, where `approver_actions.can_withdraw` is true (from\n`team_leaves.pending_requests` or `leave_requests.show`).\n\n**Side effects:** the reserved days come back to the employee's balance and the employee is emailed with\nthe reason. Attendance and payroll are not touched (the leave was never approved). Recorded in the\nrequest's history and the audit log.\n\nRefusals answer 422 with a `code` naming the reason (also sent as `error_code`).","x-summary-ar":"سحب موافقتي كمدير قبل قرار الموارد البشرية","x-description-ar":"في طلب `manager_and_hr` وافق عليه المدير وما زال ينتظر الموارد البشرية، يسحب المدير موافقته. ينتهي الطلب\nبالحالة `revoked` مع `revoke_type: withdrawn` ويخرج من قائمة الموارد البشرية. السبب (`note`، حتى ٥٠٠ حرف)\nإلزامي. لا تسحب الموارد البشرية موافقةً بهذه العملية، ولا يمكنك التصرف في طلبك أنت.\n\n**متى تستخدمه:** حين وافق المدير مبكراً («وافقت على إجازة سارة قبل مراجعة الخطة»). أما الإجازة التي نالت\nموافقتها النهائية فعمليتها `leave_requests.revoke`.\n\n**المتطلبات:** رقم `id` الطلب حيث `approver_actions.can_withdraw` صحيحة (من `team_leaves.pending_requests`\nأو `leave_requests.show`).\n\n**الآثار الجانبية:** تعود الأيام المحجوزة إلى رصيد الموظف ويصله بريد بالسبب. لا يتأثر الحضور ولا الرواتب\n(لم تُعتمد الإجازة قط). يُسجَّل في سجل الطلب وسجل التدقيق.\n\nيُرجع الرفض 422 مع `code` يسمّي السبب (ويُرسل أيضاً في `error_code`).","x-access":"write","x-permission":{"key":"leave_request/approve","label":"Approve / reject requests","x-label-ar":"قبول / رفض الطلبات"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/leave_request_id"}],"responses":{"200":{"description":"The request, now revoked.","x-description-ar":"الطلب بعد سحب الموافقة.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","status":"revoked","reason":"Family visit","created_at":"2026-03-02 06:00:00 UTC","leave_type_name":"Annual leave","cancellation_requested_at":null,"on_behalf":false,"document_url":null,"document_filename":null,"current_stage":"terminal","current_approver_name":null,"employee_no":"E-0042","employee_name":"Sara Ahmed","compensation_type":"fully_paid","compensation_type_label":"Fully paid","actions":[{"action":"submitted","actioned_at":"2026-03-02 06:00:00 UTC","note":null,"actioned_by":"Sara Ahmed"},{"action":"manager_approved","actioned_at":"2026-03-02 08:15:00 UTC","note":"Enjoy","actioned_by":"Omar Ali"}],"revoke_type":"withdrawn","revocation":{"by":{"id":88,"full_name":"Omar Ali"},"at":"2026-03-02T09:00:00Z","note":"I approved this before checking the release plan."},"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}},"schema":{"$ref":"#/components/schemas/leave_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The withdrawal was refused.","x-description-ar":"رُفض سحب الموافقة.","x-codes":[{"code":"own_request","meaning":"The request is your own leave; an approval on it cannot be taken back by you.","x-meaning-ar":"الطلب إجازتك أنت، فلا يمكنك سحب موافقة عليه.","x-fix":"Ask the employee's other approver (or HR) to act.","x-fix-ar":"اطلب من معتمِد آخر للموظف (أو الموارد البشرية) التصرف."},{"code":"not_actionable","meaning":"The request is not in a state that allows this (already decided, or not waiting for HR after a manager approval).","x-meaning-ar":"الطلب ليس في حالة تسمح بذلك (حُسم، أو لا ينتظر الموارد البشرية بعد موافقة مدير).","x-fix":"Re-read it with `leave_requests.show` and use the operation its state allows.","x-fix-ar":"أعد قراءته عبر `leave_requests.show` واستخدم العملية التي تسمح بها حالته."},{"code":"not_authorized","meaning":"You do not hold the step this takes back (you are not the first approver in the leave's route).","x-meaning-ar":"لا تحمل الخطوة التي يُراد سحبها (لست المعتمِد الأول في مسار الإجازة).","x-fix":"Only `approver_actions` flags that are true can be acted on; ask the right approver.","x-fix-ar":"لا يمكن التصرف إلا حين تكون علامة `approver_actions` صحيحة؛ اطلب من المعتمِد المعني."},{"code":"note_required","meaning":"No reason (`note`) was sent.","x-meaning-ar":"لم يُرسل السبب (`note`).","x-fix":"Send a `note`; the employee sees it.","x-fix-ar":"أرسل `note`؛ يراه الموظف."},{"code":"note_too_long","meaning":"The reason is longer than 500 characters.","x-meaning-ar":"السبب أطول من ٥٠٠ حرف.","x-fix":"Shorten the `note` to 500 characters.","x-fix-ar":"اختصر `note` إلى ٥٠٠ حرف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Enter a reason. The employee will see it.","error_code":"note_required","code":"note_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/leave_request_required_note"},"example":{"note":"I approved this before checking the release plan."}}},"required":true,"description":"The reason, which the employee sees."}}},"/leave_settings":{"get":{"summary":"Get the leave settings","operationId":"leave_settings.show","tags":["Leave settings"],"description":"Returns the company's leave settings: whether approvers are reminded by email of leave requests waiting for\nthem, how many days a request waits before the first reminder, and how many days pass between reminders.\nA company that never changed them gets the defaults (reminders off, 3 days, every 7 days).\n\n**When to use:** to answer \"are approvers reminded about pending leave?\", or before\n`leave_settings.update`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض إعدادات الإجازات","x-description-ar":"يعرض إعدادات الإجازات في الشركة: هل يُذكَّر المعتمدون بالبريد بطلبات الإجازة التي تنتظرهم، وكم يوماً ينتظر\nالطلب قبل أول تذكير، وكم يوماً بين التذكيرات. الشركة التي لم تغيّرها تحصل على القيم الافتراضية (التذكير\nمعطّل، ٣ أيام، كل ٧ أيام).\n\n**متى تستخدمه:** للإجابة عن «هل يُذكَّر المعتمدون بطلبات الإجازة المعلقة؟»، أو قبل `leave_settings.update`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_policy/view","label":"View leave policies","x-label-ar":"عرض سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings.","x-description-ar":"الإعدادات.","content":{"application/json":{"example":{"id":1,"automatic_reminders_enabled":true,"pending_reminder_after_days":3,"reminder_frequency_days":7},"schema":{"$ref":"#/components/schemas/leave_setting"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"patch":{"summary":"Change the leave approval reminders","operationId":"leave_settings.update","tags":["Leave settings"],"description":"Changes the fields you send. With `automatic_reminders_enabled: true`, every morning QHR emails whoever must\nact next on each pending leave request (the manager, or HR) once the request has waited\n`pending_reminder_after_days` days at that step, and again every `reminder_frequency_days` days while it\nkeeps waiting.\n\n**When to use:** to switch approval reminders on or off, or to change their timing.\n\n**Prerequisites:** none. Read the current values with `leave_settings.show`.\n\n**Side effects:** recorded in the audit log; once on, reminder emails go out to approvers from the next\nmorning. Not offered to Claude: it starts or stops automatic emails to every approver in the company.","x-summary-ar":"تغيير تذكيرات اعتماد الإجازات","x-description-ar":"يعدّل الحقول التي ترسلها. مع `automatic_reminders_enabled: true` يرسل QHR كل صباح بريداً إلى من عليه\nالإجراء التالي في كل طلب إجازة معلق (المدير أو الموارد البشرية) بعد أن ينتظر الطلب في تلك المرحلة\n`pending_reminder_after_days` يوماً، ثم يكرره كل `reminder_frequency_days` يوماً ما دام الطلب ينتظر.\n\n**متى تستخدمه:** لتفعيل تذكيرات الاعتماد أو إيقافها، أو لتغيير توقيتها.\n\n**المتطلبات:** لا شيء. اقرأ القيم الحالية عبر `leave_settings.show`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق؛ وبعد التفعيل تبدأ رسائل التذكير بالوصول إلى المعتمدين من صباح\nاليوم التالي. لا يُعرض على Claude: لأنه يبدأ أو يوقف رسائل بريد تلقائية لكل المعتمدين في الشركة.","x-access":"write","x-permission":{"key":"leave_policy/edit","label":"Edit leave policies","x-label-ar":"تعديل سياسات الإجازات"},"x-feature":"leave_policy","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings after the change.","x-description-ar":"الإعدادات بعد التعديل.","content":{"application/json":{"example":{"id":1,"automatic_reminders_enabled":true,"pending_reminder_after_days":3,"reminder_frequency_days":7},"schema":{"$ref":"#/components/schemas/leave_setting"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leave_setting"],"properties":{"leave_setting":{"type":"object","description":"The settings to change.","x-description-ar":"الإعدادات المراد تغييرها.","properties":{"automatic_reminders_enabled":{"type":"boolean","description":"Email approvers about requests waiting for them.","x-description-ar":"إرسال بريد للمعتمدين بالطلبات التي تنتظرهم."},"pending_reminder_after_days":{"type":"integer","description":"Days before the first reminder; a whole number, 1 or more.","x-description-ar":"عدد الأيام قبل أول تذكير؛ عدد صحيح ١ أو أكثر.","minimum":1},"reminder_frequency_days":{"type":"integer","description":"Days between reminders; a whole number, 1 or more.","x-description-ar":"عدد الأيام بين التذكيرات؛ عدد صحيح ١ أو أكثر.","minimum":1}}}}},"example":{"leave_setting":{"automatic_reminders_enabled":true,"pending_reminder_after_days":2}}}},"required":true,"description":"The fields to change."}}},"/loans":{"get":{"summary":"List my loans","operationId":"loans.list","tags":["Loans"],"description":"Returns the token owner's own loans and loan requests, newest first, in every status: amount, status,\nhow it is repaid, what is still owed and, for a direct loan, where its repayment stands.\n\n**When to use:** for an employee's questions about their own loans (\"how much do I still owe?\", \"was my\nloan approved?\"). For one loan's schedule and HR's note use `loans.show`.\n\n**Prerequisites:** the token's owner must be an employee in the company.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض سلفي","x-description-ar":"يعرض سلف صاحب الرمز وطلباته، الأحدث أولاً، بكل حالاتها: المبلغ والحالة وطريقة السداد والمتبقي، وموقف السداد\nللسلفة المباشرة.\n\n**متى تستخدمه:** لأسئلة الموظف عن سلفه («كم بقي علي؟»، «هل اعتُمدت سلفتي؟»). لجدول سلفة واحدة وملاحظة\nالموارد البشرية استخدم `loans.show`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً في الشركة.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/view","label":"View own loans","x-label-ar":"عرض سلفي"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of your loans.","x-description-ar":"صفحة من سلفك.","content":{"application/json":{"example":{"records":[{"id":418,"reference":"LON-0042","status":"pending","channel":null,"installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","installments_remaining":null,"outstanding":"0.00","repayment":null,"editable":true,"cancellable":true}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/loan_row"},"description":"Your loans, newest first.","x-description-ar":"سلفك، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Request a loan","operationId":"loans.create","tags":["Loans"],"description":"Submits a loan request for the token's owner: how much, why, and when the money is needed. It waits as\n`pending` for HR, who choose how it is paid and repaid when they approve it. Nothing is paid until then.\n\n**When to use:** when an employee asks for a salary advance or loan. Only one request may wait for a\ndecision at a time; approved loans still being repaid do not block a new request.\n\n**Prerequisites:** the token's owner must be an employee. See existing requests with `loans.list`.\n\n**Side effects:** everyone who may approve loans is emailed that a request is waiting. Recorded in the\naudit log.","x-summary-ar":"طلب سلفة","x-description-ar":"يقدّم طلب سلفة لصاحب الرمز: المبلغ والسبب وتاريخ الحاجة. يبقى بحالة `pending` بانتظار الموارد البشرية التي\nتختار عند الاعتماد طريقة الصرف والسداد. لا يُصرف شيء قبل ذلك.\n\n**متى تستخدمه:** عندما يطلب الموظف سلفة على الراتب أو قرضاً. لا يُسمح إلا بطلب واحد بانتظار القرار، ولا\nتمنع السلف المعتمدة التي ما زالت تُسدَّد تقديم طلب جديد.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً. راجع الطلبات الحالية عبر `loans.list`.\n\n**الآثار الجانبية:** يصل بريد إلى كل من يملك صلاحية اعتماد السلف بأن هناك طلباً ينتظر. يُسجَّل في سجل\nالتدقيق.","x-access":"write","x-permission":{"key":"loan/create","label":"Request a loan","x-label-ar":"طلب سلفة"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request.","x-description-ar":"الطلب الجديد.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"pending","channel":null,"description":"Medical treatment for my father.","installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":null,"installments_start_on":null,"installments_end_on":null,"installments_paid":0,"installments_remaining":null,"amount_repaid":"0.00","outstanding":"0.00","repayment":null,"payments":[],"editable":true,"cancellable":true,"decision":null,"installments":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/loan_detail"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The request was refused.","x-description-ar":"رُفض الطلب.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"The employee already has a loan request awaiting a decision (named in `error`); only one may wait at a time.","x-meaning-ar":"لدى الموظف طلب سلفة بانتظار القرار (مذكور في `error`)؛ لا يُسمح إلا بطلب واحد معلّق.","x-fix":"Wait for that request to be decided, or cancel it with `loans.cancel`.","x-fix-ar":"انتظر حتى يُبتّ في ذلك الطلب، أو ألغه عبر `loans.cancel`."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["loan"],"properties":{"loan":{"type":"object","required":["amount","description","needed_on"],"description":"The request.","x-description-ar":"الطلب.","properties":{"amount":{"type":"string","description":"Amount wanted, decimal string, more than 0.","x-description-ar":"المبلغ المطلوب، نص عشري أكبر من 0."},"description":{"type":"string","description":"Why it is needed, up to 1000 characters.","x-description-ar":"سبب الحاجة، حتى ١٠٠٠ حرف."},"needed_on":{"type":"string","description":"Date the money is needed.","x-description-ar":"التاريخ المطلوب فيه المبلغ.","format":"date"}}}}},"example":{"loan":{"amount":"12500.00","description":"Medical treatment for my father.","needed_on":"2026-12-10"}}}},"required":true,"description":"The loan request."}}},"/loans/{id}":{"get":{"summary":"Get one of my loans","operationId":"loans.show","tags":["Loans"],"description":"Returns one of the token owner's loans in full: the request, HR's decision and note, how it is paid and\nrepaid, the installment schedule with what is paid and due, the payments behind a direct loan, and what\nis still owed.\n\n**When to use:** when an employee asks about a specific loan (\"when is my next installment?\").\n\n**Prerequisites:** the loan `id` from `loans.list`. Another employee's loan answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض إحدى سلفي","x-description-ar":"يعرض إحدى سلف صاحب الرمز كاملة: الطلب وقرار الموارد البشرية وملاحظتها وطريقة الصرف والسداد وجدول الأقساط\nبالمسدَّد والمستحق، والدفعات خلف السلفة المباشرة، والمتبقي.\n\n**متى تستخدمه:** عندما يسأل الموظف عن سلفة بعينها («متى قسطي القادم؟»).\n\n**المتطلبات:** رقم `id` السلفة من `loans.list`. سلفة موظف آخر تُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"loan/view","label":"View own loans","x-label-ar":"عرض سلفي"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/loan_id"}],"responses":{"200":{"description":"The loan.","x-description-ar":"السلفة.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"approved","channel":"payroll","description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","installments_paid":0,"installments_remaining":6,"amount_repaid":"0.00","outstanding":"12500.00","repayment":null,"payments":[],"editable":false,"cancellable":false,"decision":{"by":88,"name":"Omar Ali","at":"2026-11-22T09:00:00Z","note":"Six equal installments from January."},"installments":[{"id":9001,"sequence":1,"payroll_id":null,"due_on":"2027-01-01","amount":"2083.33","currency":"SAR","status":"due"}]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change my pending loan request","operationId":"loans.update","tags":["Loans"],"description":"Changes the amount, reason or needed date of one of the token owner's requests while it is still\n`pending`. Send only the fields to change.\n\n**When to use:** when an employee wants to ask for a different amount or date before HR decides.\n\n**Prerequisites:** the loan `id` from `loans.list`; it must still be `pending` (`editable: true`).\n\n**Side effects:** recorded in the audit log. No one is notified.","x-summary-ar":"تعديل طلب سلفتي المعلّق","x-description-ar":"يغيّر المبلغ أو السبب أو تاريخ الحاجة في أحد طلبات صاحب الرمز ما دام بحالة `pending`. أرسل الحقول المراد\nتغييرها فقط.\n\n**متى تستخدمه:** عندما يريد الموظف طلب مبلغ أو تاريخ مختلف قبل قرار الموارد البشرية.\n\n**المتطلبات:** رقم `id` السلفة من `loans.list`، ويجب أن تكون ما زالت `pending` (`editable: true`).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.","x-access":"write","x-permission":{"key":"loan/edit","label":"Edit a pending loan request","x-label-ar":"تعديل طلب سلفة معلق"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/loan_id"}],"responses":{"200":{"description":"The request after the change.","x-description-ar":"الطلب بعد التعديل.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"pending","channel":null,"description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"10000.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","installments_paid":0,"installments_remaining":6,"amount_repaid":"0.00","outstanding":"12500.00","repayment":null,"payments":[],"editable":false,"cancellable":false,"decision":null,"installments":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/loan_detail"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"The loan has already been decided (or withdrawn) and can no longer change.","x-meaning-ar":"بُتّ في السلفة (أو أُلغيت) ولم تعد قابلة للتغيير.","x-fix":"Submit a new request with `loans.create` instead.","x-fix-ar":"قدّم طلباً جديداً عبر `loans.create` بدلاً من ذلك."},{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This loan has already been decided and can no longer be changed.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["loan"],"properties":{"loan":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تغييرها فقط.","properties":{"amount":{"type":"string","description":"Amount wanted, decimal string, more than 0.","x-description-ar":"المبلغ المطلوب، نص عشري أكبر من 0."},"description":{"type":"string","description":"Why it is needed, up to 1000 characters.","x-description-ar":"سبب الحاجة، حتى ١٠٠٠ حرف."},"needed_on":{"type":"string","description":"Date the money is needed.","x-description-ar":"التاريخ المطلوب فيه المبلغ.","format":"date"}}}}},"example":{"loan":{"amount":"10000.00"}}}},"required":true,"description":"The fields to change."}}},"/loans/{id}/cancel":{"patch":{"summary":"Withdraw my pending loan request","operationId":"loans.cancel","tags":["Loans"],"description":"Withdraws one of the token owner's requests while it is still `pending`. It becomes `cancelled` and can no\nlonger change; the employee may submit a new request at once.\n\n**When to use:** when an employee no longer needs the loan, or wants to start over with a different one.\n\n**Prerequisites:** the loan `id` from `loans.list`; it must still be `pending` (`cancellable: true`).\n\n**Side effects:** recorded in the audit log. No one is notified.","x-summary-ar":"سحب طلب سلفتي المعلّق","x-description-ar":"يسحب أحد طلبات صاحب الرمز ما دام بحالة `pending`. يصبح `cancelled` ولا يمكن تغييره بعد ذلك، ويمكن للموظف\nتقديم طلب جديد فوراً.\n\n**متى تستخدمه:** عندما لا يعود الموظف بحاجة إلى السلفة، أو يريد البدء بطلب مختلف.\n\n**المتطلبات:** رقم `id` السلفة من `loans.list`، ويجب أن تكون ما زالت `pending` (`cancellable: true`).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُبلَّغ أحد.","x-access":"write","x-permission":{"key":"loan/cancel","label":"Cancel a pending loan request","x-label-ar":"إلغاء طلب سلفة معلق"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/loan_id"}],"responses":{"200":{"description":"The withdrawn request.","x-description-ar":"الطلب المسحوب.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"cancelled","channel":null,"description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","installments_paid":0,"installments_remaining":6,"amount_repaid":"0.00","outstanding":"12500.00","repayment":null,"payments":[],"editable":false,"cancellable":false,"decision":null,"installments":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/loan_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be withdrawn.","x-description-ar":"لا يمكن سحب الطلب.","x-codes":[{"code":"validation_failed","meaning":"The loan has already been decided (or withdrawn) and can no longer change.","x-meaning-ar":"بُتّ في السلفة (أو أُلغيت) ولم تعد قابلة للتغيير.","x-fix":"Submit a new request with `loans.create` instead.","x-fix-ar":"قدّم طلباً جديداً عبر `loans.create` بدلاً من ذلك."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This loan has already been decided and can no longer be changed.","code":"validation_failed"}}}}}}},"/me":{"get":{"summary":"Check a token and see what it can reach","operationId":"me.show","tags":["Token"],"description":"Returns who the token acts as (its owner), the company it works in, the owner's employee record,\nthe token's access level and expiry, and the features and permissions it can use.\n\n**When to use:** first, to check that a token works and which company it belongs to; and to decide\nwhat to offer a user — an operation needs its `x-permission` key in `permissions` and its\n`x-feature` in `features`. `employee_id` is the owner's own employee id, which the self-service\noperations (my leave, my attendance) act on.\n\n**Side effects:** none. Any valid token may call it, read or read \u0026 write.","x-summary-ar":"التحقق من الرمز ومعرفة ما يمكنه الوصول إليه","x-description-ar":"يعرض باسم من يعمل الرمز (صاحبه)، والشركة التي يعمل فيها، والسجل الوظيفي لصاحبه، ومستوى صلاحية الرمز\nوتاريخ انتهائه، والميزات والصلاحيات التي يستطيع استخدامها.\n\n**متى تستخدمه:** أولاً للتأكد من أن الرمز يعمل ولأي شركة يتبع، ولتحديد ما يُعرض على المستخدم — فالعملية\nتحتاج أن يكون مفتاح `x-permission` الخاص بها ضمن `permissions` وأن تكون `x-feature` ضمن `features`.\n`employee_id` هو رقم الموظف الخاص بصاحب الرمز، وعليه تعمل عمليات الخدمة الذاتية (إجازاتي، حضوري).\n\n**الآثار الجانبية:** لا شيء. يستطيع أي رمز صالح استدعاءها، للقراءة أو للقراءة والتعديل.","x-access":"read","x-permission":{"key":"public","label":"Any valid token — no permission needed","x-label-ar":"أي رمز صالح — لا تحتاج صلاحية"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The token, its owner and what it can reach.","x-description-ar":"الرمز وصاحبه وما يمكنه الوصول إليه.","content":{"application/json":{"example":{"user":{"id":42,"name":"Sara Ahmed","email":"sara@example.com"},"company":{"id":7,"name":"Acme Trading Co."},"employee_id":1203,"locale":"en","token":{"name":"Claude","public_id":"Ab3dEf7hJk9m","access":"read_write","expires_at":"2027-02-25T00:00:00Z"},"features":["attendance","employee","leave","open_api"],"permissions":["employee/edit","employee/view","employee/view_employee","open_api/use"]},"schema":{"$ref":"#/components/schemas/me"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/my_custodies":{"get":{"summary":"List my custody","operationId":"my_custodies.list","tags":["My custody"],"description":"Returns the token owner's own custody, newest first, in every status: what they hold now\n(`holding: current`) and what they held before — transferred to someone else, or moved to HR when they\nleft (`holding: previous`, with `transferred_to` / `transferred_on` and nothing about the next holder).\n\n**When to use:** for an employee's \"what do I have?\", \"which laptop is mine?\" or \"what am I still paying\nfor?\". For totals only, `my_custodies.stat_cards` is lighter. HR reads other people's custody with\n`custodies.list`.\n\n**Prerequisites:** none — the employee is the token owner, who must be linked to an employee record.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض عهدتي","x-description-ar":"يعرض عهدة صاحب الرمز نفسه، الأحدث أولاً وبكل الحالات: ما يحمله الآن (`holding: current`) وما حمله سابقاً —\nنُقل إلى غيره أو انتقل إلى الموارد البشرية عند مغادرته (`holding: previous` مع `transferred_to`\nو`transferred_on` دون أي معلومة عن الحامل التالي).\n\n**متى تستخدمه:** لأسئلة الموظف مثل \"ما الذي في عهدتي؟\" أو \"أي حاسوب لي؟\" أو \"ما الذي ما زلت أسدده؟\". للأرقام\nالإجمالية فقط، `my_custodies.stat_cards` أخف. تقرأ الموارد البشرية عهد الآخرين عبر `custodies.list`.\n\n**المتطلبات:** لا شيء — الموظف هو صاحب الرمز، ويجب أن يكون مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ سجلاً في الصفحة.","x-access":"read","x-permission":{"key":"custody/view","label":"View own custody, including custody transferred away","x-label-ar":"عرض العهد الخاصة، بما فيها العهد المنقولة إلى غيره"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[search_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference or serial contains.","x-description-ar":"المرجع أو الرقم التسلسلي يحتوي على.","example":"C02X"},{"name":"q[status_in][]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["held","returned","deducting","deducted"]}},"description":"Only these statuses.","x-description-ar":"هذه الحالات فقط.","example":["held"]}],"responses":{"200":{"description":"A page of the owner's custody.","x-description-ar":"صفحة من عهدة صاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null,"holding":"current","transferred_to":null,"transferred_on":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/my_custody_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token owner is a user with no employee record, so they have no custody of their own.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي، فلا عهدة خاصة به.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/my_custodies/export":{"get":{"summary":"Download my custody as a spreadsheet","operationId":"my_custodies.export","tags":["My custody"],"description":"Builds an Excel (`format=xlsx`) or CSV (`format=csv`) file of the token owner's own custody, as\n`my_custodies.list` shows it for the same filters, with the columns you choose, headed in the requested\nlanguage. Records that moved away from the owner show nothing of the next holder. Above 10,000 rows the\nfile is built in the background (202) and QHR emails the owner when it is ready.\n\n**When to use:** to give an employee a file of what they hold. To read the records, use `my_custodies.list`.\n\n**Prerequisites:** `columns[]` from `my_custodies.export_columns`. Needs \"Export HR data\" and \"View own\ncustody\", and a token owner linked to an employee record.\n\n**Side effects:** each export, refused ones included, is recorded in the company's export history and the\naudit log. One export of this page per user runs at a time (`export_in_progress`).\n\n**Not offered to Claude:** it returns a file, not JSON.","x-summary-ar":"تنزيل عهدتي في جدول بيانات","x-description-ar":"ينشئ ملف Excel (`format=xlsx`) أو CSV (`format=csv`) بعهدة صاحب الرمز نفسه كما يعرضها `my_custodies.list`\nللمرشحات نفسها، بالأعمدة التي تختارها وبعناوين بلغة الطلب. والعهد التي انتقلت منه لا يظهر فيها شيء عن الحامل\nالتالي. وإن تجاوزت الصفوف ١٠٬٠٠٠ يُبنى الملف في الخلفية (202) ويرسل QHR بريداً إلى صاحب الرمز حين يجهز.\n\n**متى تستخدمه:** لإعطاء الموظف ملفاً بما في عهدته. لقراءة السجلات استخدم `my_custodies.list`.\n\n**المتطلبات:** `columns[]` من `my_custodies.export_columns`. تحتاج «تصدير بيانات الموارد البشرية» و«عرض\nعهدتي»، وأن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** يُسجَّل كل تصدير، بما فيه المرفوض، في سجل التصدير في الشركة وفي سجل التدقيق. يعمل تصدير\nواحد لهذه الصفحة لكل مستخدم في الوقت نفسه (`export_in_progress`).\n\n**غير متاح لـ Claude:** يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"custody/view","label":"View own custody, including custody transferred away","x-label-ar":"عرض العهد الخاصة، بما فيها العهد المنقولة إلى غيره"}]},"x-feature":"custody","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format, `xlsx` or `csv`. Anything else, or none, answers 400 `bad_format`.","x-description-ar":"صيغة الملف، `xlsx` أو `csv`. وأي قيمة أخرى أو عدم الإرسال يُرجع 400 `bad_format`.","example":"csv"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"description":"The columns, in order (`key` from `my_custodies.export_columns`).","x-description-ar":"الأعمدة بالترتيب (`key` من `my_custodies.export_columns`).","example":["reference","item","serial","value","holding"]},{"name":"q[search_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference or serial contains.","x-description-ar":"المرجع أو الرقم التسلسلي يحتوي على.","example":"C02X"}],"responses":{"200":{"description":"The file, Excel or CSV as asked.","x-description-ar":"الملف، Excel أو CSV حسب الطلب.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows for one response: the file is being built in the background.","x-description-ar":"الصفوف أكثر من أن تعود في إجابة واحدة: يُبنى الملف في الخلفية.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{},"text/csv":{}}},"400":{"description":"The format or columns are not valid.","x-description-ar":"الصيغة أو الأعمدة غير صحيحة.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No column was sent.","x-meaning-ar":"لم يُرسل أي عمود.","x-fix":"Send `columns[]` from the export columns operation.","x-fix-ar":"أرسل `columns[]` من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A column is unknown or not visible to the caller.","x-meaning-ar":"عمود غير معروف أو غير مرئي للمستدعي.","x-fix":"Use only `key`s from the export columns operation.","x-fix-ar":"استخدم فقط مفاتيح `key` من عملية أعمدة التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Column salary is not available on this page.","error_code":"unknown_column","code":"unknown_column"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"يجري تصدير لهذه الصفحة حالياً.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by this user is still running.","x-meaning-ar":"تصدير لهذه الصفحة من المستخدم نفسه ما زال جارياً.","x-fix":"Wait for it to finish, then try again.","x-fix-ar":"انتظر حتى ينتهي ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress"}}}},"422":{"description":"Nothing or too much to export, or no employee record.","x-description-ar":"لا شيء للتصدير أو أكثر من الحد، أو لا سجل وظيفي.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا شيء يطابق المرشحات.","x-fix":"Change or remove the filters.","x-fix-ar":"غيّر المرشحات أو أزلها."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` say how many.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويوضح `row_count` و`max_rows` العدد.","x-fix":"Narrow the filters.","x-fix-ar":"ضيّق المرشحات."},{"code":"employee_required","meaning":"The token owner is a user with no employee record, so they have no custody of their own.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي، فلا عهدة خاصة به.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/my_custodies/export/columns":{"get":{"summary":"List the columns of the my custody export","operationId":"my_custodies.export_columns","tags":["My custody"],"description":"Returns the columns the \"My custody\" spreadsheet export can contain — key, heading in the request language,\nwhether it is included by default, and its type.\n\n**When to use:** before `my_custodies.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs \"Export HR data\" and \"View own custody\", and a token owner linked to an\nemployee record.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير عهدتي","x-description-ar":"يعرض الأعمدة التي يمكن أن يحتويها ملف تصدير «عهدتي» — المفتاح والعنوان بلغة الطلب وهل يُضمَّن افتراضياً\nونوعه.\n\n**متى تستخدمه:** قبل `my_custodies.export` لاختيار الأعمدة `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الموارد البشرية» و«عرض عهدتي»، وأن يكون صاحب الرمز مرتبطاً بسجل\nوظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"custody/view","label":"View own custody, including custody transferred away","x-label-ar":"عرض العهد الخاصة، بما فيها العهد المنقولة إلى غيره"}]},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns.","x-description-ar":"الأعمدة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"holding","label":"Holding","default":true,"type":"enum"}]},"schema":{"$ref":"#/components/schemas/custody_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/my_custodies/stat_cards":{"get":{"summary":"Get my custody totals","operationId":"my_custodies.stat_cards","tags":["My custody"],"description":"Returns the token owner's current custody figures: how many assets they hold and their value, and how many\ncustody records are being deducted from their salary and how much is still owed. Only what they hold or owe\nnow, not what passed through their hands before.\n\n**When to use:** for \"how much do I still owe for the damaged laptop?\" or \"how many assets do I have?\". For\nthe records, use `my_custodies.list`.\n\n**Prerequisites:** none — the token owner, linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"عرض إجماليات عهدتي","x-description-ar":"يعرض أرقام عهدة صاحب الرمز الحالية: عدد الأصول التي يحملها وقيمتها، وعدد العهد التي يُستقطع ثمنها من راتبه وما\nبقي عليه. ما يحمله أو يدين به الآن فقط، لا ما مرّ بيده سابقاً.\n\n**متى تستخدمه:** لأسئلة مثل \"كم بقي عليّ عن الحاسوب التالف؟\" أو \"كم أصلاً في عهدتي؟\". للسجلات استخدم\n`my_custodies.list`.\n\n**المتطلبات:** لا شيء — صاحب الرمز، مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"custody/view","label":"View own custody, including custody transferred away","x-label-ar":"عرض العهد الخاصة، بما فيها العهد المنقولة إلى غيره"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The owner's totals.","x-description-ar":"إجماليات صاحب الرمز.","content":{"application/json":{"example":{"held_count":2,"held_value":"12700.00","held_employees_count":1,"deducting_count":1,"remaining_deduction":"2000.00","currency":"SAR"},"schema":{"$ref":"#/components/schemas/custody_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token owner is a user with no employee record, so they have no custody of their own.","x-meaning-ar":"صاحب الرمز مستخدم بلا سجل وظيفي، فلا عهدة خاصة به.","x-fix":"Use a token created by a user linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/my_custodies/{id}":{"get":{"summary":"Get one of my custody records","operationId":"my_custodies.show","tags":["My custody"],"description":"Returns one of the token owner's custody records in full, read only: the asset, serial and value, how it\ncame back and what it cost, the salary-deduction schedule with what has been paid, any settlement and its\nhistory with the signed handover PDFs. For something that moved away from the owner, everything after it\nleft them is blank and the history stops there. Every `can_*` is false.\n\n**When to use:** for questions about one of the owner's own assets, e.g. \"when is my next deduction?\".\n\n**Prerequisites:** the custody `id`, from `my_custodies.list`. A custody the owner never held answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض سجل من سجلات عهدتي","x-description-ar":"يعرض سجل عهدة واحداً لصاحب الرمز كاملاً للقراءة فقط: الأصل ورقمه التسلسلي وقيمته، وكيف أُعيد وكم كلّف، وجدول\nالاستقطاع من الراتب مع ما دُفع منه، وأي تسوية، وسجله مع نماذج التسليم الموقَّعة. وإن كان الأصل قد انتقل من\nصاحب الرمز، تظهر الحقول التالية لانتقاله فارغة ويتوقف السجل عنده. كل حقول `can_*` خطأ.\n\n**متى تستخدمه:** للأسئلة عن أصل من أصول صاحب الرمز نفسه، مثل \"متى الاستقطاع القادم؟\".\n\n**المتطلبات:** رقم `id` العهدة من `my_custodies.list`. والعهدة التي لم يحملها صاحب الرمز قط تُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"custody/view","label":"View own custody, including custody transferred away","x-label-ar":"عرض العهد الخاصة، بما فيها العهد المنقولة إلى غيره"},"x-feature":"custody","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Custody id, from `my_custodies.list`.","x-description-ar":"رقم العهدة، من `my_custodies.list`.","example":311}],"responses":{"200":{"description":"The custody record.","x-description-ar":"سجل العهدة.","content":{"application/json":{"example":{"record":{"id":311,"reference":"CUS-0042","employee":{"id":1203,"full_name":"Ahmed Ali","employee_no":"E-0055","department":{"id":4,"name":"Finance"}},"category":{"id":2,"name":"Devices","icon":"devices"},"item":{"id":7,"name":"MacBook Pro 14"},"serial":"C02XK1","value":"8500.00","currency":"SAR","assigned_on":"2026-01-10","held_since":"2026-03-01","status":"held","installments_paid":0,"installments_count":null,"returned_on":null,"condition":null,"compensation_amount":null,"borne_by":null,"labor_law_cap":false,"amount_repaid":null,"outstanding":null,"settlement":null,"installments":[],"timeline":[{"kind":"assigned","occurred_on":"2026-01-10","actor":{"id":88,"full_name":"Sara Hassan"},"from_employee":null,"to_employee":{"id":1203,"full_name":"Ahmed Ali"},"amount":"8500.00","note":null,"condition":null,"termination_package":null,"payroll":null,"installment":null,"document":{"url":"https://files.example.com/handover-cus-0042.pdf","filename":"handover-cus-0042.pdf"}}],"can_return":false,"can_transfer":false,"can_settle":false,"settlement_blocker":null,"employee_termination_package":null,"holding":"current","transferred_to":null,"transferred_on":null}},"schema":{"$ref":"#/components/schemas/my_custody_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/notifications":{"get":{"summary":"List my notifications","operationId":"notifications.list","tags":["Notifications"],"description":"Returns the token owner's in-app notifications, newest first, read and unread, with the title and text in\nthe requested language and the request each one is about. `unread_count` counts all unread ones, not just\nthis page's. A token owner with no employee record (the owner, an accountant) has no inbox: the list is\nempty and `employee_required` is `true`.\n\n**When to use:** to answer \"do I have anything new?\" or \"what needs my attention?\".\n\n**Prerequisites:** none. Anyone in the company may call it; it only ever shows the token owner's own\nnotifications.\n\n**Side effects:** none; reading the list does not mark anything read (see `notifications.read` and\n`notifications.read_all`). Up to 50 per page.","x-summary-ar":"عرض إشعاراتي","x-description-ar":"يعرض إشعارات صاحب الرمز داخل التطبيق، الأحدث أولاً، المقروءة وغير المقروءة، مع العنوان والنص بلغة الطلب\nوالطلب الذي يخصه كل إشعار. يعدّ `unread_count` كل الإشعارات غير المقروءة لا إشعارات هذه الصفحة فقط.\nصاحب الرمز الذي ليس له سجل موظف (المالك أو المحاسب) لا صندوق إشعارات له: تكون القائمة فارغة و\n`employee_required` بالقيمة `true`.\n\n**متى تستخدمه:** للإجابة عن \"هل لدي جديد؟\" أو \"ما الذي يحتاج انتباهي؟\".\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه، ولا يعرض إلا إشعارات صاحب الرمز نفسه.\n\n**الآثار الجانبية:** لا شيء؛ عرض القائمة لا يجعل أي إشعار مقروءاً (انظر `notifications.read`\nو`notifications.read_all`). حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of notifications.","x-description-ar":"صفحة من الإشعارات.","content":{"application/json":{"example":{"unread_count":1,"employee_required":false,"records":[{"id":311,"kind":"assigned","data":{"actor_name":"Sara Ahmed"},"read_at":null,"created_at":"2026-11-24T08:30:00+03:00","subject":{"type":"Ticket","id":57,"reference":"REQ-0057","subject":"Salary certificate for the bank"},"title":"A request was assigned to you","body":"Sara Ahmed assigned REQ-0057 to you."}],"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["unread_count","employee_required","records","pagination"],"properties":{"unread_count":{"type":"integer","description":"All unread notifications, across every page.","x-description-ar":"كل الإشعارات غير المقروءة في جميع الصفحات."},"employee_required":{"type":"boolean","description":"`true` when the token owner has no employee record, so no inbox.","x-description-ar":"`true` إن لم يكن لصاحب الرمز سجل موظف، فلا صندوق إشعارات له."},"records":{"type":"array","items":{"type":"object","required":["id","kind","data","read_at","created_at","subject","title","body"],"properties":{"id":{"type":"integer","description":"Notification id.","x-description-ar":"رقم الإشعار."},"kind":{"type":"string","description":"What happened, e.g. `assigned`, `approval_requested`, `approved`, `rejected`, `new_comment`, `due_tomorrow`, `overdue`, `permission_approved`.","x-description-ar":"ما حدث، مثل `assigned` و`approval_requested` و`approved` و`rejected` و`new_comment` و`due_tomorrow` و`overdue` و`permission_approved`."},"data":{"type":"object","description":"The details the text is built from (who acted, due date, reason…).","x-description-ar":"التفاصيل التي يُبنى منها النص (من قام بالإجراء، تاريخ الاستحقاق، السبب…)."},"read_at":{"type":"string","description":"When it was read; empty while unread.","x-description-ar":"وقت قراءته؛ فارغ ما دام غير مقروء.","format":"date-time","nullable":true},"created_at":{"type":"string","description":"When it was sent.","x-description-ar":"وقت إرساله.","format":"date-time"},"subject":{"type":"object","description":"The record it is about.","x-description-ar":"السجل الذي يخصه الإشعار.","properties":{"type":{"type":"string","description":"`Ticket` (a request) or `PermissionRequest` (a short-leave permission).","x-description-ar":"`Ticket` (طلب) أو `PermissionRequest` (استئذان)."},"id":{"type":"integer","description":"The record's id.","x-description-ar":"رقم السجل."},"reference":{"type":"string","description":"The request's reference number, when it has one.","x-description-ar":"الرقم المرجعي للطلب إن وُجد.","nullable":true},"subject":{"type":"string","description":"The request's subject line, when it has one.","x-description-ar":"عنوان الطلب إن وُجد.","nullable":true}}},"title":{"type":"string","description":"Title, in the requested language.","x-description-ar":"العنوان بلغة الطلب."},"body":{"type":"string","description":"Text, in the requested language.","x-description-ar":"النص بلغة الطلب."}}},"description":"The notifications on this page.","x-description-ar":"الإشعارات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/notifications/read_all":{"patch":{"summary":"Mark all my notifications as read","operationId":"notifications.read_all","tags":["Notifications"],"description":"Marks every unread notification of the token owner as read and answers `unread_count: 0`. Already-read\nnotifications keep their original read time. No request body.\n\n**When to use:** when the person says they have seen everything (\"clear my notifications\").\n\n**Prerequisites:** none. Only the token owner's own notifications are touched; with no employee record\nthere is nothing to mark.\n\n**Side effects:** the unread badge in QHR drops to zero. Nothing is deleted, and nobody else is told.","x-summary-ar":"تعليم كل إشعاراتي كمقروءة","x-description-ar":"يجعل كل إشعارات صاحب الرمز غير المقروءة مقروءةً ويعيد `unread_count: 0`. أما الإشعارات المقروءة سابقاً\nفتحتفظ بوقت قراءتها الأصلي. لا يحتاج جسم طلب.\n\n**متى تستخدمه:** عندما يقول الشخص إنه اطّلع على كل شيء (\"امسح إشعاراتي\").\n\n**المتطلبات:** لا شيء. لا يمس إلا إشعارات صاحب الرمز، ومن لا سجل موظف له لا شيء لديه ليُعلَّم.\n\n**الآثار الجانبية:** يصبح عدّاد غير المقروء في QHR صفراً. لا يُحذف شيء ولا يُبلَّغ أحد.","x-access":"write","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"All marked read.","x-description-ar":"عُلّمت كلها كمقروءة.","content":{"application/json":{"example":{"unread_count":0},"schema":{"type":"object","required":["unread_count"],"properties":{"unread_count":{"type":"integer","description":"Always 0.","x-description-ar":"صفر دائماً."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"}}}},"/notifications/{id}/read":{"patch":{"summary":"Mark one of my notifications as read","operationId":"notifications.read","tags":["Notifications"],"description":"Marks one of the token owner's notifications as read and returns it. Marking an already-read notification\nagain changes nothing and keeps its original read time. No request body.\n\n**When to use:** after the person has dealt with one notification, so it stops counting as unread.\n\n**Prerequisites:** the notification's `id`, from `notifications.list`. Another person's notification\nanswers 404.\n\n**Side effects:** the unread badge in QHR drops by one. Nobody else is told.","x-summary-ar":"تعليم أحد إشعاراتي كمقروء","x-description-ar":"يجعل أحد إشعارات صاحب الرمز مقروءاً ويعيده. وتعليم إشعار مقروء مرة أخرى لا يغيّر شيئاً ويحتفظ بوقت\nقراءته الأصلي. لا يحتاج جسم طلب.\n\n**متى تستخدمه:** بعد أن يتعامل الشخص مع إشعار، كي لا يُحسب غير مقروء.\n\n**المتطلبات:** رقم `id` الإشعار من `notifications.list`. إشعار شخص آخر يعيد 404.\n\n**الآثار الجانبية:** ينقص عدّاد غير المقروء في QHR بواحد. لا يُبلَّغ أحد.","x-access":"write","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Notification id, from `notifications.list`.","x-description-ar":"رقم الإشعار، من `notifications.list`.","example":311}],"responses":{"200":{"description":"The notification, now read.","x-description-ar":"الإشعار بعد تعليمه كمقروء.","content":{"application/json":{"example":{"id":311,"kind":"assigned","data":{"actor_name":"Sara Ahmed"},"read_at":"2026-11-24T10:02:11+03:00","created_at":"2026-11-24T08:30:00+03:00","subject":{"type":"Ticket","id":57,"reference":"REQ-0057","subject":"Salary certificate for the bank"},"title":"A request was assigned to you","body":"Sara Ahmed assigned REQ-0057 to you."},"schema":{"type":"object","required":["id","kind","data","read_at","created_at","subject","title","body"],"properties":{"id":{"type":"integer","description":"Notification id.","x-description-ar":"رقم الإشعار."},"kind":{"type":"string","description":"What happened, e.g. `assigned`, `approval_requested`, `approved`, `rejected`, `new_comment`, `due_tomorrow`, `overdue`, `permission_approved`.","x-description-ar":"ما حدث، مثل `assigned` و`approval_requested` و`approved` و`rejected` و`new_comment` و`due_tomorrow` و`overdue` و`permission_approved`."},"data":{"type":"object","description":"The details the text is built from (who acted, due date, reason…).","x-description-ar":"التفاصيل التي يُبنى منها النص (من قام بالإجراء، تاريخ الاستحقاق، السبب…)."},"read_at":{"type":"string","description":"When it was read; empty while unread.","x-description-ar":"وقت قراءته؛ فارغ ما دام غير مقروء.","format":"date-time","nullable":true},"created_at":{"type":"string","description":"When it was sent.","x-description-ar":"وقت إرساله.","format":"date-time"},"subject":{"type":"object","description":"The record it is about.","x-description-ar":"السجل الذي يخصه الإشعار.","properties":{"type":{"type":"string","description":"`Ticket` (a request) or `PermissionRequest` (a short-leave permission).","x-description-ar":"`Ticket` (طلب) أو `PermissionRequest` (استئذان)."},"id":{"type":"integer","description":"The record's id.","x-description-ar":"رقم السجل."},"reference":{"type":"string","description":"The request's reference number, when it has one.","x-description-ar":"الرقم المرجعي للطلب إن وُجد.","nullable":true},"subject":{"type":"string","description":"The request's subject line, when it has one.","x-description-ar":"عنوان الطلب إن وُجد.","nullable":true}}},"title":{"type":"string","description":"Title, in the requested language.","x-description-ar":"العنوان بلغة الطلب."},"body":{"type":"string","description":"Text, in the requested language.","x-description-ar":"النص بلغة الطلب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"}}}},"/overtime_requests":{"get":{"summary":"List my overtime requests","operationId":"overtime_requests.list","tags":["Overtime"],"description":"Returns the token owner's own overtime requests, newest submitted first, in every status: waiting for the\nmanager or HR, approved, rejected or cancelled. Each row shows the hours, the schedule of that day, who\nmust decide next, each decision with its note, and `payroll_id` once a payroll run has paid it.\n\n**When to use:** to answer \"what happened to my overtime?\" or to find the `id` to edit or cancel. For totals\nuse `overtime_requests.stat_cards`. Other people's requests are in `team_overtimes.pending_requests` (a\nmanager's queue) and `hr_overtimes.requests` (HR).\n\n**Prerequisites:** the token owner must be an employee. Needs \"View own attendance\".\n\n**Side effects:** none. Up to 50 requests per page.","x-summary-ar":"عرض طلبات العمل الإضافي الخاصة بي","x-description-ar":"يعرض طلبات العمل الإضافي الخاصة بصاحب الرمز، الأحدث تقديماً أولاً، بكل حالاتها: بانتظار المدير أو الموارد\nالبشرية، أو معتمدة، أو مرفوضة، أو ملغاة. يوضح كل سطر الساعات وجدول الدوام في ذلك اليوم ومن عليه القرار\nالتالي وكل قرار مع ملاحظته، و`payroll_id` بعد أن يصرفه مسير رواتب.\n\n**متى تستخدمه:** للإجابة عن «ماذا حدث لطلب العمل الإضافي؟» أو لمعرفة رقم `id` الطلب لتعديله أو إلغائه.\nللإجماليات استخدم `overtime_requests.stat_cards`. طلبات الآخرين في `team_overtimes.pending_requests` (قائمة\nالمدير) و`hr_overtimes.requests` (الموارد البشرية).\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً، وصلاحية «عرض حضوري».\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"$ref":"#/components/parameters/overtime_status_filter"},{"$ref":"#/components/parameters/overtime_date_from_filter"},{"$ref":"#/components/parameters/overtime_date_to_filter"}],"responses":{"200":{"description":"A page of my overtime requests.","x-description-ar":"صفحة من طلبات العمل الإضافي الخاصة بي.","content":{"application/json":{"example":{"records":[{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_manager","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"Omar Ali","can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/overtime_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Request overtime","operationId":"overtime_requests.create","tags":["Overtime"],"description":"Submits overtime the token owner worked, as a date with a start and end time on the company clock. Overtime\nis time outside the schedule, so QHR removes any part that falls inside the shift of that day: if it cuts\nthe window, the request is saved with the kept hours, `trimmed: true`, and a `warning` saying what was cut.\nOn a weekend, holiday or leave day the whole window counts. On a flexible day only hours worked beyond the\nday's required hours, between check-in and check-out, count, and only once the employee has checked out.\n\n**Approval chain:** the request goes to the employee's manager (`pending_manager`) and then to HR\n(`pending_hr`); with no manager it goes straight to HR. Only after HR approves is it paid.\n\n**When to use:** when an employee says they stayed late or worked a day off. Check the result's `warning`\nand tell the employee if hours were cut.\n\n**Prerequisites:** the token owner must be an employee, with \"View own attendance\". The date may not be in a\npayroll run that has passed time verification, may not overlap another pending or approved request of the\nsame day, and the window may not last more than 12 hours.\n\n**Side effects:** emails the manager that a request awaits approval (or, with no manager, everyone who holds\n\"View attendance reports\", i.e. HR). Nothing reaches payroll until HR approves. Recorded in the audit log.","x-summary-ar":"طلب عمل إضافي","x-description-ar":"يقدّم عملاً إضافياً أنجزه صاحب الرمز، بتاريخ ووقت بداية ونهاية بتوقيت الشركة. العمل الإضافي هو الوقت خارج\nالدوام، لذا يحذف QHR أي جزء يقع داخل دوام ذلك اليوم: فإن قصّ الفترة يُحفظ الطلب بالساعات المتبقية مع\n`trimmed: true` و`warning` يوضح ما حُذف. في يوم الراحة أو العطلة الرسمية أو الإجازة تُحتسب الفترة كاملة. وفي\nاليوم المرن لا يُحتسب إلا ما عمله الموظف بعد الساعات المطلوبة لليوم، بين الحضور والانصراف، وبعد تسجيل\nالانصراف فقط.\n\n**مسار الاعتماد:** يذهب الطلب إلى مدير الموظف (`pending_manager`) ثم إلى الموارد البشرية (`pending_hr`)؛ وإن\nلم يكن للموظف مدير يذهب مباشرة إلى الموارد البشرية. ولا يُصرف إلا بعد اعتماد الموارد البشرية.\n\n**متى تستخدمه:** عندما يذكر الموظف أنه تأخر في العمل أو عمل في يوم راحته. راجع `warning` في النتيجة وأخبر\nالموظف إن قُصّت بعض الساعات.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضوري». ألا يقع التاريخ في مسير رواتب تجاوز مرحلة\nالتحقق من الوقت، وألا يتداخل مع طلب آخر معلق أو معتمد في اليوم نفسه، وألا تزيد الفترة على ١٢ ساعة.\n\n**الآثار الجانبية:** يصل المديرَ بريد بأن طلباً ينتظر اعتماده (أو، إن لم يكن هناك مدير، كلَّ من لديه صلاحية\n«عرض تقارير الحضور» أي الموارد البشرية). لا يصل شيء إلى الرواتب قبل اعتماد الموارد البشرية. يُسجَّل في سجل\nالتدقيق.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The saved request; `warning` when it was trimmed.","x-description-ar":"الطلب المحفوظ؛ ومعه `warning` إن قُصّ.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_manager","trimmed":true,"original_start_time":"16:00","original_end_time":"20:00","current_approver_name":"Omar Ali","can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"},"warning":"Your request was trimmed to 17:00–20:00 (3.0 h). 16:00–17:00 falls inside your scheduled shift (09:00–17:00) and cannot be claimed as overtime."},"schema":{"$ref":"#/components/schemas/overtime_request_saved"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The overtime cannot be requested.","x-description-ar":"لا يمكن طلب هذا العمل الإضافي.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["overtime_request"],"properties":{"overtime_request":{"type":"object","required":["date","start_time","end_time","reason"],"description":"The overtime worked.","x-description-ar":"العمل الإضافي المنجز.","properties":{"date":{"type":"string","description":"The work day (`YYYY-MM-DD`). For a window past midnight, the day it started.","x-description-ar":"يوم العمل (`YYYY-MM-DD`). للفترة التي تتجاوز منتصف الليل: اليوم الذي بدأت فيه.","format":"date"},"start_time":{"type":"string","description":"Start, `HH:MM` 24-hour, company time zone.","x-description-ar":"البداية بصيغة `HH:MM` (٢٤ ساعة) بتوقيت الشركة."},"end_time":{"type":"string","description":"End, `HH:MM`. Earlier than the start means the next day. At most 12 hours.","x-description-ar":"النهاية بصيغة `HH:MM`. إن كانت قبل البداية فهي في اليوم التالي. ١٢ ساعة كحد أقصى."},"reason":{"type":"string","description":"Why the overtime was needed, up to 500 characters.","x-description-ar":"سبب الحاجة إلى العمل الإضافي، حتى ٥٠٠ حرف."}}}}},"example":{"overtime_request":{"date":"2026-11-23","start_time":"17:00","end_time":"20:00","reason":"Month-end closing"}}}},"required":true,"description":"The overtime worked."}}},"/overtime_requests/bulk_approve":{"patch":{"summary":"Approve several overtime requests","operationId":"overtime_requests.bulk_approve","tags":["Overtime"],"description":"Approves up to 100 overtime requests in one call, each exactly as `overtime_requests.approve` would, with the\nsame note on all. One that cannot be approved (not pending, not the token owner's to decide, unknown id) does\nnot stop the others: the answer lists the ids approved in `succeeded` and the rest in `failed` with the reason.\n\n**Approval chain:** a request first waits for the employee's manager (`pending_manager`). Only that manager may decide\nit then; if the employee has no manager, or the manager was removed, HR acts at that stage instead. Approval at that\nstage, by the manager or by HR, moves it to HR (`pending_hr`), where anyone with \"View attendance reports\" decides. HR's approval makes it\n`approved`. A rejection at either stage is final.\n\n**When to use:** to clear a reviewed queue in one go. To decide one request, `overtime_requests.approve`.\n\n**Prerequisites:** ids from `team_overtimes.pending_requests` or `hr_overtimes.requests`. The token owner must\nbe an employee, with \"View team attendance\".\n\n**Side effects:** for each approved request, the same emails and payroll effect as `overtime_requests.approve`.\nNot offered to Claude: one call commits pay for many people.","x-summary-ar":"اعتماد عدة طلبات عمل إضافي","x-description-ar":"يعتمد حتى ١٠٠ طلب عمل إضافي في استدعاء واحد، كلاً منها كما يفعل `overtime_requests.approve`، بالملاحظة نفسها\nللجميع. الطلب الذي لا يمكن اعتماده (غير معلق، أو ليس لصاحب الرمز البت فيه، أو رقم غير موجود) لا يوقف\nالبقية: تذكر الإجابة الأرقام المعتمدة في `succeeded` والبقية في `failed` مع السبب.\n\n**مسار الاعتماد:** ينتظر الطلب أولاً مدير الموظف (`pending_manager`)، ولا يبت فيه حينها إلا ذلك المدير؛ وإن لم يكن\nللموظف مدير أو أُزيل مديره تبت فيه الموارد البشرية في هذه المرحلة. والاعتماد في هذه المرحلة، من المدير أو من الموارد البشرية، ينقله إلى الموارد البشرية\n(`pending_hr`)، ويبت فيه هناك كل من لديه صلاحية «عرض تقارير الحضور». واعتماد الموارد البشرية يجعله `approved`. والرفض\nفي أي مرحلة نهائي.\n\n**متى تستخدمه:** لإنهاء قائمة تمت مراجعتها دفعة واحدة. لطلب واحد: `overtime_requests.approve`.\n\n**المتطلبات:** أرقام من `team_overtimes.pending_requests` أو `hr_overtimes.requests`. وأن يكون صاحب الرمز\nموظفاً لديه صلاحية «عرض حضور الفريق».\n\n**الآثار الجانبية:** لكل طلب معتمد رسائل البريد وأثر الرواتب نفسها التي في `overtime_requests.approve`. لا\nيُعرض على Claude لأن استدعاءً واحداً يُلزم بأجور عدد من الموظفين.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were approved and which were not.","x-description-ar":"الطلبات التي اعتُمدت والتي لم تُعتمد.","content":{"application/json":{"example":{"succeeded":[412,413],"failed":[{"id":420,"error":"This request is no longer actionable."}]},"schema":{"$ref":"#/components/schemas/overtime_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","description":"Overtime request ids, up to 100 (extra ids are ignored).","x-description-ar":"أرقام طلبات العمل الإضافي، حتى ١٠٠ (يُتجاهل ما زاد).","items":{"type":"integer"}},"note":{"type":"string","description":"Optional note recorded on every one.","x-description-ar":"ملاحظة اختيارية تُسجَّل على كل طلب."}}},"example":{"ids":[412,413,420],"note":"Approved for month-end closing."}}},"required":true,"description":"The requests to approve."}}},"/overtime_requests/bulk_reject":{"patch":{"summary":"Reject several overtime requests","operationId":"overtime_requests.bulk_reject","tags":["Overtime"],"description":"Rejects up to 100 overtime requests in one call, each exactly as `overtime_requests.reject` would, with the\nsame note on all. The note is required: without it every request lands in `failed`. One that cannot be\nrejected does not stop the others; the answer lists `succeeded` and `failed` ids, with the reason.\n\n**Approval chain:** a request first waits for the employee's manager (`pending_manager`). Only that manager may decide\nit then; if the employee has no manager, or the manager was removed, HR acts at that stage instead. Approval at that\nstage, by the manager or by HR, moves it to HR (`pending_hr`), where anyone with \"View attendance reports\" decides. HR's approval makes it\n`approved`. A rejection at either stage is final.\n\n**When to use:** to turn down a batch of requests for the same reason. To decide one request,\n`overtime_requests.reject`.\n\n**Prerequisites:** ids from `team_overtimes.pending_requests` or `hr_overtimes.requests`. The token owner must\nbe an employee, with \"View team attendance\".\n\n**Side effects:** each rejected employee is emailed the decision with the note. Rejections are final. Not\noffered to Claude: one irreversible call affects many people.","x-summary-ar":"رفض عدة طلبات عمل إضافي","x-description-ar":"يرفض حتى ١٠٠ طلب عمل إضافي في استدعاء واحد، كلاً منها كما يفعل `overtime_requests.reject`، بالملاحظة نفسها\nللجميع. الملاحظة إلزامية: بدونها تقع كل الطلبات في `failed`. الطلب الذي لا يمكن رفضه لا يوقف البقية؛ وتذكر\nالإجابة الأرقام في `succeeded` و`failed` مع السبب.\n\n**مسار الاعتماد:** ينتظر الطلب أولاً مدير الموظف (`pending_manager`)، ولا يبت فيه حينها إلا ذلك المدير؛ وإن لم يكن\nللموظف مدير أو أُزيل مديره تبت فيه الموارد البشرية في هذه المرحلة. والاعتماد في هذه المرحلة، من المدير أو من الموارد البشرية، ينقله إلى الموارد البشرية\n(`pending_hr`)، ويبت فيه هناك كل من لديه صلاحية «عرض تقارير الحضور». واعتماد الموارد البشرية يجعله `approved`. والرفض\nفي أي مرحلة نهائي.\n\n**متى تستخدمه:** لرفض مجموعة طلبات لسبب واحد. لطلب واحد: `overtime_requests.reject`.\n\n**المتطلبات:** أرقام من `team_overtimes.pending_requests` أو `hr_overtimes.requests`. وأن يكون صاحب الرمز\nموظفاً لديه صلاحية «عرض حضور الفريق».\n\n**الآثار الجانبية:** يصل كل موظف رُفض طلبه بريد بالقرار مع الملاحظة. والرفض نهائي. لا يُعرض على Claude لأن\nاستدعاءً واحداً لا رجعة فيه يمس عدداً من الموظفين.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were rejected and which were not.","x-description-ar":"الطلبات التي رُفضت والتي لم تُرفض.","content":{"application/json":{"example":{"succeeded":[412],"failed":[{"id":413,"error":"Record not found"}]},"schema":{"$ref":"#/components/schemas/overtime_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","note"],"properties":{"ids":{"type":"array","description":"Overtime request ids, up to 100 (extra ids are ignored).","x-description-ar":"أرقام طلبات العمل الإضافي، حتى ١٠٠ (يُتجاهل ما زاد).","items":{"type":"integer"}},"note":{"type":"string","description":"Why, shown to each employee. Required.","x-description-ar":"السبب، ويظهر لكل موظف. إلزامي."}}},"example":{"ids":[412,413],"note":"No overtime was agreed for that week."}}},"required":true,"description":"The requests to reject, and why."}}},"/overtime_requests/stat_cards":{"get":{"summary":"Get my overtime totals","operationId":"overtime_requests.stat_cards","tags":["Overtime"],"description":"Counts the token owner's overtime requests for dates in a period (the current month by default), with their\nhours: pending, approved, rejected, and approved ones already paid by a payroll run. Adds the approved hours\nnot paid yet and `estimated_amount`, an estimate of the pay for the approved hours at today's salary and\nthe company's overtime multiplier (hourly rate with benefits, plus the basic hourly rate times the\nmultiplier above 1).\n\n**When to use:** to answer \"how much overtime do I have this month, and roughly what will it pay?\". For the\nrequests themselves use `overtime_requests.list`.\n\n**Prerequisites:** the token owner must be an employee, with \"View own attendance\".\n\n**Side effects:** none. `estimated_amount` is an estimate; the payroll run computes the real amount.","x-summary-ar":"عرض إجماليات العمل الإضافي الخاصة بي","x-description-ar":"يحصي طلبات العمل الإضافي الخاصة بصاحب الرمز لتواريخ فترة معينة (الشهر الحالي افتراضياً) مع ساعاتها:\nالمعلقة والمعتمدة والمرفوضة، والمعتمدة التي صرفها مسير رواتب. ويضيف الساعات المعتمدة التي لم تُصرف بعد،\nو`estimated_amount` وهو تقدير لأجر الساعات المعتمدة براتب اليوم ومعامل العمل الإضافي في الشركة (أجر الساعة\nمع البدلات، مضافاً إليه أجر الساعة الأساسي مضروباً في ما يزيد على ١ من المعامل).\n\n**متى تستخدمه:** للإجابة عن «كم لدي من العمل الإضافي هذا الشهر، وكم سيُصرف لي تقريباً؟». للطلبات نفسها\nاستخدم `overtime_requests.list`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضوري».\n\n**الآثار الجانبية:** لا شيء. `estimated_amount` تقديري، ويحسب مسير الرواتب المبلغ الفعلي.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First date counted (`YYYY-MM-DD`). First day of the current month when omitted.","x-description-ar":"أول تاريخ يُحتسب (`YYYY-MM-DD`). أول يوم من الشهر الحالي إن لم يُرسل.","example":"2026-11-01"},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last date counted. Last day of the current month when omitted.","x-description-ar":"آخر تاريخ يُحتسب. آخر يوم من الشهر الحالي إن لم يُرسل.","example":"2026-11-30"}],"responses":{"200":{"description":"My overtime totals for the period.","x-description-ar":"إجماليات العمل الإضافي الخاصة بي للفترة.","content":{"application/json":{"example":{"period":{"from":"2026-11-01","to":"2026-11-30"},"pending":{"count":1,"hours":2.0},"approved":{"count":3,"hours":7.5},"rejected":{"count":0,"hours":0.0},"paid":{"count":1,"hours":3.0},"unpaid_approved_hours":4.5,"estimated_amount":421.88},"schema":{"$ref":"#/components/schemas/overtime_my_stat_cards"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/overtime_requests/{id}":{"get":{"summary":"Get one overtime request","operationId":"overtime_requests.show","tags":["Overtime"],"description":"Returns one overtime request with its hours, the schedule of that day, who must decide next, each decision\nwith its note, and the payroll run that paid it.\n\n**Who can see it:** the employee who asked, their manager, and anyone with \"View attendance reports\" (HR).\nAnyone else gets 404.\n\n**When to use:** to check one request before deciding on it or editing it.\n\n**Prerequisites:** the `id` from `overtime_requests.list`, `team_overtimes.pending_requests` or\n`hr_overtimes.requests`. The token owner must be an employee, with \"View own attendance\".\n\n**Side effects:** none.","x-summary-ar":"عرض طلب عمل إضافي","x-description-ar":"يعرض طلب عمل إضافي واحداً بساعاته وجدول الدوام في ذلك اليوم ومن عليه القرار التالي وكل قرار مع ملاحظته\nومسير الرواتب الذي صرفه.\n\n**من يراه:** الموظف صاحب الطلب ومديره وكل من لديه صلاحية «عرض تقارير الحضور» (الموارد البشرية). وغيرهم يصله 404.\n\n**متى تستخدمه:** لمراجعة طلب قبل البت فيه أو تعديله.\n\n**المتطلبات:** رقم `id` من `overtime_requests.list` أو `team_overtimes.pending_requests` أو\n`hr_overtimes.requests`. وأن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضوري».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/overtime_request_id"}],"responses":{"200":{"description":"The request.","x-description-ar":"الطلب.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_manager","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"Omar Ali","can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}},"schema":{"$ref":"#/components/schemas/overtime_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"patch":{"summary":"Edit my overtime request","operationId":"overtime_requests.update","tags":["Overtime"],"description":"Changes the date, times or reason of one of the token owner's own requests. Send all four fields. The same\nchecks as `overtime_requests.create` run again, so the window can be trimmed against the shift and come\nback with a `warning`. The request keeps its id and its place in the approval chain.\n\n**Which states:** `pending_manager`, and `pending_hr` when no manager has approved it (an employee with no\nmanager). Once a manager has approved, or it is decided or cancelled, it answers 422.\n\n**When to use:** to correct a request before it is approved. To withdraw it, use `overtime_requests.cancel`.\n\n**Prerequisites:** the `id` from `overtime_requests.list` (only your own requests; others answer 404). The\ntoken owner must be an employee, with \"View own attendance\".\n\n**Side effects:** none besides the change; the approvers are not emailed again. Recorded in the audit log.","x-summary-ar":"تعديل طلب العمل الإضافي الخاص بي","x-description-ar":"يغيّر التاريخ أو الأوقات أو السبب في أحد طلبات صاحب الرمز. أرسل الحقول الأربعة. تُطبَّق الفحوص نفسها التي\nفي `overtime_requests.create`، فقد تُقص الفترة حسب الدوام ويعود معها `warning`. يحتفظ الطلب برقمه وبموقعه في\nمسار الاعتماد.\n\n**الحالات المقبولة:** `pending_manager`، و`pending_hr` ما دام لم يعتمده مدير (موظف بلا مدير). بعد اعتماد\nالمدير، أو بعد البت فيه أو إلغائه، يُرجع 422.\n\n**متى تستخدمه:** لتصحيح طلب قبل اعتماده. لسحبه استخدم `overtime_requests.cancel`.\n\n**المتطلبات:** رقم `id` من `overtime_requests.list` (طلباتك فقط؛ غيرها يُرجع 404). وأن يكون صاحب الرمز موظفاً\nلديه صلاحية «عرض حضوري».\n\n**الآثار الجانبية:** لا شيء غير التعديل؛ لا يُعاد إرسال بريد للمعتمِدين. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/overtime_request_id"}],"responses":{"200":{"description":"The request after the change; `warning` when it was trimmed.","x-description-ar":"الطلب بعد التعديل؛ ومعه `warning` إن قُصّ.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:30","end_time":"21:00","minutes":210,"hours":3.5,"reason":"Month-end closing","status":"pending_manager","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"Omar Ali","can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}},"schema":{"$ref":"#/components/schemas/overtime_request_saved"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be changed.","x-description-ar":"لا يمكن تعديل الطلب.","x-codes":[{"code":"validation_failed","meaning":"Refused; `error` says why: a manager has already approved it, or it is decided or cancelled, or the new window fails a check of `overtime_requests.create`.","x-meaning-ar":"رُفض التعديل؛ يوضح `error` السبب: اعتمده مدير بالفعل، أو بُتّ فيه أو أُلغي، أو الفترة الجديدة لا تجتاز أحد فحوص `overtime_requests.create`.","x-fix":"If it is already approved, ask the approver; otherwise fix the window as `error` explains.","x-fix-ar":"إن كان معتمداً فراجع المعتمِد؛ وإلا فصحّح الفترة كما يوضح `error`."},{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A request cannot be edited after it has been approved.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["overtime_request"],"properties":{"overtime_request":{"type":"object","required":["date","start_time","end_time","reason"],"description":"The overtime worked.","x-description-ar":"العمل الإضافي المنجز.","properties":{"date":{"type":"string","description":"The work day (`YYYY-MM-DD`). For a window past midnight, the day it started.","x-description-ar":"يوم العمل (`YYYY-MM-DD`). للفترة التي تتجاوز منتصف الليل: اليوم الذي بدأت فيه.","format":"date"},"start_time":{"type":"string","description":"Start, `HH:MM` 24-hour, company time zone.","x-description-ar":"البداية بصيغة `HH:MM` (٢٤ ساعة) بتوقيت الشركة."},"end_time":{"type":"string","description":"End, `HH:MM`. Earlier than the start means the next day. At most 12 hours.","x-description-ar":"النهاية بصيغة `HH:MM`. إن كانت قبل البداية فهي في اليوم التالي. ١٢ ساعة كحد أقصى."},"reason":{"type":"string","description":"Why the overtime was needed, up to 500 characters.","x-description-ar":"سبب الحاجة إلى العمل الإضافي، حتى ٥٠٠ حرف."}}}}},"example":{"overtime_request":{"date":"2026-11-23","start_time":"17:30","end_time":"21:00","reason":"Month-end closing"}}}},"required":true,"description":"The corrected overtime."}}},"/overtime_requests/{id}/approve":{"patch":{"summary":"Approve an overtime request","operationId":"overtime_requests.approve","tags":["Overtime"],"description":"Approves one overtime request at its current stage, with an optional note. Approval at `pending_manager`\nalways moves it to HR (`pending_hr`), even when HR approves there because the employee has no manager;\nonly an approval at `pending_hr` makes it `approved`.\n\n**Approval chain:** a request first waits for the employee's manager (`pending_manager`). Only that manager may decide\nit then; if the employee has no manager, or the manager was removed, HR acts at that stage instead. Approval at that\nstage, by the manager or by HR, moves it to HR (`pending_hr`), where anyone with \"View attendance reports\" decides. HR's approval makes it\n`approved`. A rejection at either stage is final.\n\n**Which states:** `pending_manager` and `pending_hr`, and only when the token owner is the approver of that\nstage (`can_act: true`). Anything else answers 422.\n\n**When to use:** after reviewing a request from `team_overtimes.pending_requests` or `hr_overtimes.requests`.\nFor many at once, `overtime_requests.bulk_approve`.\n\n**Prerequisites:** the `id` from those queues. The token owner must be an employee, with \"View team\nattendance\" (HR roles hold it too).\n\n**Side effects:** a manager's approval emails HR (everyone with \"View attendance reports\") that a request\nwaits for them; HR's approval emails the employee the decision. An approved request is paid in the first\npayroll run over its date that syncs time: its minutes go into the employee's timesheet and are paid as an\novertime income line (hourly rate with benefits × hours, plus the basic hourly rate × (multiplier − 1) ×\nhours when the company's overtime multiplier is above 1), and the run stamps `payroll_id` so it is paid\nonce. Recorded in the audit log. Not offered to Claude: approving overtime adds pay.","x-summary-ar":"اعتماد طلب عمل إضافي","x-description-ar":"يعتمد طلب عمل إضافي واحداً في مرحلته الحالية، مع ملاحظة اختيارية. الاعتماد في مرحلة `pending_manager`\nينقله دائماً إلى الموارد البشرية (`pending_hr`)، حتى لو اعتمدته الموارد البشرية فيها لأن الموظف بلا مدير؛ ولا\nيصبح `approved` إلا باعتماد في مرحلة `pending_hr`.\n\n**مسار الاعتماد:** ينتظر الطلب أولاً مدير الموظف (`pending_manager`)، ولا يبت فيه حينها إلا ذلك المدير؛ وإن لم يكن\nللموظف مدير أو أُزيل مديره تبت فيه الموارد البشرية في هذه المرحلة. والاعتماد في هذه المرحلة، من المدير أو من الموارد البشرية، ينقله إلى الموارد البشرية\n(`pending_hr`)، ويبت فيه هناك كل من لديه صلاحية «عرض تقارير الحضور». واعتماد الموارد البشرية يجعله `approved`. والرفض\nفي أي مرحلة نهائي.\n\n**الحالات المقبولة:** `pending_manager` و`pending_hr`، وفقط حين يكون صاحب الرمز معتمِد تلك المرحلة\n(`can_act: true`). وغير ذلك يُرجع 422.\n\n**متى تستخدمه:** بعد مراجعة طلب من `team_overtimes.pending_requests` أو `hr_overtimes.requests`. لعدة طلبات\nدفعة واحدة: `overtime_requests.bulk_approve`.\n\n**المتطلبات:** رقم `id` من تلك القوائم. وأن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضور الفريق» (وأدوار\nالموارد البشرية تملكها أيضاً).\n\n**الآثار الجانبية:** اعتماد المدير يرسل بريداً للموارد البشرية (كل من لديه «عرض تقارير الحضور») بأن طلباً\nينتظرها؛ واعتماد الموارد البشرية يرسل للموظف بريداً بالقرار. الطلب المعتمد يُصرف في أول مسير رواتب يغطي\nتاريخه ويُزامن الوقت: تدخل دقائقه في كشف وقت الموظف وتُصرف بنداً دخلاً للعمل الإضافي (أجر الساعة مع البدلات\n× الساعات، مضافاً إليه أجر الساعة الأساسي × (المعامل − ١) × الساعات إن زاد معامل العمل الإضافي للشركة على\n١)، ويختمه المسير بـ `payroll_id` فلا يُصرف مرتين. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأن اعتماد\nالعمل الإضافي يضيف إلى الأجر.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/overtime_request_id"}],"responses":{"200":{"description":"The request after the decision.","x-description-ar":"الطلب بعد القرار.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_hr","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"HR","can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-24T06:10:00Z","note":"Confirmed with finance."},"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}},"schema":{"$ref":"#/components/schemas/overtime_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be approved.","x-description-ar":"لا يمكن اعتماد الطلب.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","description":"Optional note, up to 500 characters. Send `{}` for none.","x-description-ar":"ملاحظة اختيارية حتى ٥٠٠ حرف. أرسل `{}` بلا ملاحظة."}}},"example":{"note":"Confirmed with finance."}}},"required":true,"description":"An optional note for the employee and the next approver."}}},"/overtime_requests/{id}/cancel":{"patch":{"summary":"Cancel my overtime request","operationId":"overtime_requests.cancel","tags":["Overtime"],"description":"Withdraws one of the token owner's own overtime requests. It becomes `cancelled`, leaves the approvers'\nqueues, and is never paid.\n\n**Which states:** only a pending request (`pending_manager` or `pending_hr`), even after the manager has\napproved. An approved, rejected or already cancelled request answers 422.\n\n**When to use:** when the employee did not work the hours after all, or submitted them twice.\n\n**Prerequisites:** the `id` from `overtime_requests.list` (only your own requests; others answer 404). The\ntoken owner must be an employee, with \"View own attendance\".\n\n**Side effects:** none besides the status change; nobody is emailed. Recorded in the audit log.","x-summary-ar":"إلغاء طلب العمل الإضافي الخاص بي","x-description-ar":"يسحب أحد طلبات العمل الإضافي الخاصة بصاحب الرمز. تصبح حالته `cancelled` ويخرج من قوائم المعتمِدين ولا يُصرف.\n\n**الحالات المقبولة:** الطلب المعلق فقط (`pending_manager` أو `pending_hr`)، حتى بعد اعتماد المدير. الطلب\nالمعتمد أو المرفوض أو الملغى من قبل يُرجع 422.\n\n**متى تستخدمه:** عندما لا يكون الموظف قد عمل تلك الساعات فعلاً، أو قدّمها مرتين.\n\n**المتطلبات:** رقم `id` من `overtime_requests.list` (طلباتك فقط؛ غيرها يُرجع 404). وأن يكون صاحب الرمز موظفاً\nلديه صلاحية «عرض حضوري».\n\n**الآثار الجانبية:** لا شيء غير تغيير الحالة؛ لا يُرسل بريد لأحد. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/overtime_request_id"}],"responses":{"200":{"description":"The cancelled request.","x-description-ar":"الطلب الملغى.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"cancelled","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":null,"can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}},"schema":{"$ref":"#/components/schemas/overtime_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be cancelled.","x-description-ar":"لا يمكن إلغاء الطلب.","x-codes":[{"code":"validation_failed","meaning":"The request is no longer pending (approved, rejected or cancelled).","x-meaning-ar":"الطلب لم يعد معلقاً (معتمد أو مرفوض أو ملغى).","x-fix":"Nothing to do. To undo an approved request, ask HR.","x-fix-ar":"لا إجراء مطلوب. لإلغاء طلب معتمد تواصل مع الموارد البشرية."},{"code":"employee_required","meaning":"The token owner is a system user with no employee record, and overtime belongs to employees.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي، والعمل الإضافي خاص بالموظفين.","x-fix":"Use a token created by a user linked to an employee, or ask HR to link your user to your employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط مستخدمك بسجلك الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Only a pending request can be cancelled.","code":"validation_failed"}}}}}}},"/overtime_requests/{id}/reject":{"patch":{"summary":"Reject an overtime request","operationId":"overtime_requests.reject","tags":["Overtime"],"description":"Rejects one overtime request at its current stage. A note is required and the employee sees it. Rejection\nis final: the request becomes `rejected` and is never paid; it does not go back to the manager.\n\n**Approval chain:** a request first waits for the employee's manager (`pending_manager`). Only that manager may decide\nit then; if the employee has no manager, or the manager was removed, HR acts at that stage instead. Approval at that\nstage, by the manager or by HR, moves it to HR (`pending_hr`), where anyone with \"View attendance reports\" decides. HR's approval makes it\n`approved`. A rejection at either stage is final.\n\n**Which states:** `pending_manager` and `pending_hr`, and only when the token owner is the approver of that\nstage (`can_act: true`). Anything else answers 422.\n\n**When to use:** when the hours were not worked or not agreed. For many at once,\n`overtime_requests.bulk_reject`.\n\n**Prerequisites:** the `id` from `team_overtimes.pending_requests` or `hr_overtimes.requests`. The token owner\nmust be an employee, with \"View team attendance\".\n\n**Side effects:** emails the employee the decision with the note. Recorded in the audit log.","x-summary-ar":"رفض طلب عمل إضافي","x-description-ar":"يرفض طلب عمل إضافي واحداً في مرحلته الحالية. الملاحظة إلزامية ويراها الموظف. الرفض نهائي: يصبح الطلب\n`rejected` ولا يُصرف، ولا يعود إلى المدير.\n\n**مسار الاعتماد:** ينتظر الطلب أولاً مدير الموظف (`pending_manager`)، ولا يبت فيه حينها إلا ذلك المدير؛ وإن لم يكن\nللموظف مدير أو أُزيل مديره تبت فيه الموارد البشرية في هذه المرحلة. والاعتماد في هذه المرحلة، من المدير أو من الموارد البشرية، ينقله إلى الموارد البشرية\n(`pending_hr`)، ويبت فيه هناك كل من لديه صلاحية «عرض تقارير الحضور». واعتماد الموارد البشرية يجعله `approved`. والرفض\nفي أي مرحلة نهائي.\n\n**الحالات المقبولة:** `pending_manager` و`pending_hr`، وفقط حين يكون صاحب الرمز معتمِد تلك المرحلة\n(`can_act: true`). وغير ذلك يُرجع 422.\n\n**متى تستخدمه:** عندما لم تُعمل الساعات أو لم يُتفق عليها. لعدة طلبات دفعة واحدة: `overtime_requests.bulk_reject`.\n\n**المتطلبات:** رقم `id` من `team_overtimes.pending_requests` أو `hr_overtimes.requests`. وأن يكون صاحب الرمز\nموظفاً لديه صلاحية «عرض حضور الفريق».\n\n**الآثار الجانبية:** يرسل للموظف بريداً بالقرار مع الملاحظة. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/overtime_request_id"}],"responses":{"200":{"description":"The rejected request.","x-description-ar":"الطلب المرفوض.","content":{"application/json":{"example":{"record":{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"rejected","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":null,"can_act":false,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-24T06:10:00Z","note":"No overtime was agreed for that day."},"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}},"schema":{"$ref":"#/components/schemas/overtime_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be rejected.","x-description-ar":"لا يمكن رفض الطلب.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":"string","description":"Why, shown to the employee. Required, up to 500 characters.","x-description-ar":"السبب، ويظهر للموظف. إلزامي، حتى ٥٠٠ حرف."}}},"example":{"note":"No overtime was agreed for that day."}}},"required":true,"description":"Why it is rejected."}}},"/payroll/allocations":{"post":{"summary":"Apply a payment to a payslip, bonus or deduction","operationId":"allocations.create","tags":["Payments"],"description":"Applies part or all of a payment to what it settles: a payslip or a bonus (from a `paid` payment) or a\ndeduction (from a `received` one). The settled item's paid amount and status update: a payslip fully covered\nbecomes `paid`, and the loan installments deducted on it count as repaid.\n\n**When to use:** after `payments.create`, to say what the money was for.\n\n**Prerequisites:** `source_id` from `payments.list` (`source_type: EmployeePayment`); `allocatee_id` from\n`payslips.list`, or the bonuses and deductions lists. Both must belong to the same employee, a payslip's run\nmust be finalised (or with accounting), and the amount cannot exceed what is owed or what the payment has left.\n\n**Side effects:** as above; recorded in the audit log. Refused (422) in a company where accounting approves\npayroll in Qoyod. Not offered to Claude, because it decides what company money paid for.","x-summary-ar":"تخصيص دفعة لقسيمة أو مكافأة أو استقطاع","x-description-ar":"يخصص جزءاً من دفعة أو كلها لما تسدده: قسيمة أو مكافأة (من دفعة `paid`) أو استقطاع (من دفعة `received`). يتحدث\nالمبلغ المسدد للبند وحالته: القسيمة المغطاة بالكامل تصبح `paid`، وتُعدّ أقساط السلف المستقطعة فيها مسددة.\n\n**متى تستخدمه:** بعد `payments.create` لتحديد الغرض من المبلغ.\n\n**المتطلبات:** `source_id` من `payments.list` (`source_type: EmployeePayment`)، و`allocatee_id` من\n`payslips.list` أو من قوائم المكافآت والاستقطاعات. يجب أن يخصا الموظف نفسه، وأن يكون مسيّر القسيمة معتمداً (أو\nلدى المحاسبة)، وألا يتجاوز المبلغ المستحق أو المتبقي من الدفعة.\n\n**الآثار الجانبية:** ما سبق، ويُسجَّل في سجل التدقيق. يُرفض (422) في الشركة التي تعتمد المحاسبة رواتبها في قيود.\nلا يُعرض على Claude لأنه يحدد ما سددته أموال الشركة.","x-access":"write","x-permission":{"key":"payment/create","label":"Record payments and allocate them","x-label-ar":"تسجيل المدفوعات وتخصيصها"},"x-feature":"payment","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The allocation.","x-description-ar":"التخصيص.","content":{"application/json":{"example":{"allocation":{"id":3301,"source_id":910,"source_type":"EmployeePayment","allocatee_id":5120,"allocatee_type":"Payslip","amount":"9555.00","date":"2026-10-27","currency":"SAR"}},"schema":{"type":"object","properties":{"allocation":{"$ref":"#/components/schemas/allocation"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The allocation was refused.","x-description-ar":"رُفض التخصيص.","x-codes":[{"code":"validation_failed","meaning":"The types are not allowed, the payment and the item belong to different employees, the direction is wrong, the payslip's run is not being paid, or the amount exceeds what is owed or left on the payment.","x-meaning-ar":"النوعان غير مسموحين، أو الدفعة والبند لموظفين مختلفين، أو الاتجاه خاطئ، أو مسيّر القسيمة ليس في مرحلة الصرف، أو المبلغ يتجاوز المستحق أو المتبقي من الدفعة.","x-fix":"Fix the field named in `error`; check `due` with `payslips.show`.","x-fix-ar":"صحّح الحقل المذكور في `error`، وراجع `due` عبر `payslips.show`."},{"code":"not_available_in_approval_mode","meaning":"The company is connected to Qoyod accounting with approval on, so payments are created only when accounting approves the run.","x-meaning-ar":"الشركة مرتبطة بمحاسبة قيود مع تفعيل الاعتماد، فلا تُنشأ المدفوعات إلا عند موافقة المحاسبة على المسيّر.","x-fix":"Let the accountant approve the payroll run in Qoyod; the payments follow.","x-fix-ar":"دع المحاسب يوافق على المسيّر في قيود، وستُنشأ المدفوعات تبعاً لذلك."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Amount would settle more than the outstanding amount owed","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["allocation"],"properties":{"allocation":{"type":"object","required":["source_type","source_id","allocatee_type","allocatee_id","amount"],"description":"What pays what.","x-description-ar":"ما الذي يسدد ماذا.","properties":{"source_type":{"type":"string","description":"Always `EmployeePayment`.","x-description-ar":"دائماً `EmployeePayment`.","enum":["EmployeePayment"]},"source_id":{"type":"integer","description":"The payment, from `payments.list`.","x-description-ar":"الدفعة، من `payments.list`."},"allocatee_type":{"type":"string","description":"`Payslip`, `Bonus` or `Deduction`.","x-description-ar":"`Payslip` أو `Bonus` أو `Deduction`.","enum":["Payslip","Bonus","Deduction"]},"allocatee_id":{"type":"integer","description":"What it settles.","x-description-ar":"البند المسدَّد."},"amount":{"type":"string","description":"Amount to apply, more than zero.","x-description-ar":"المبلغ المخصص، أكبر من صفر."},"date":{"type":"string","description":"Allocation date.","x-description-ar":"تاريخ التخصيص.","format":"date"}}}}},"example":{"allocation":{"source_type":"EmployeePayment","source_id":910,"allocatee_type":"Payslip","allocatee_id":5120,"amount":"9555.00","date":"2026-10-27"}}}},"required":true,"description":"The allocation."}}},"/payroll/allocations/{id}":{"delete":{"summary":"Remove a payment's allocation","operationId":"allocations.delete","tags":["Payments"],"description":"Removes one allocation: the money goes back to the payment's unallocated balance and the item it settled is\nopen again — a payslip returns to unpaid or partly paid, and loan installments collected through it are no\nlonger repaid.\n\n**When to use:** when a payment was applied to the wrong payslip, bonus or deduction.\n\n**Prerequisites:** the allocation `id` from `payments.show`. A payslip's run must still be being paid\n(finalised or with accounting).\n\n**Side effects:** as above; recorded in the audit log. Refused when the payslip collected custody an\nend-of-service package or settlement has closed. Not offered to Claude, because it reopens what employees are\nowed.","x-summary-ar":"حذف تخصيص دفعة","x-description-ar":"يحذف تخصيصاً واحداً: يعود المبلغ إلى رصيد الدفعة غير المخصص، ويعود البند الذي سدّده مفتوحاً — ترجع القسيمة غير\nمصروفة أو مصروفة جزئياً، ولا تعود أقساط السلف المحصّلة عبرها مسددة.\n\n**متى تستخدمه:** عندما خُصّصت دفعة لقسيمة أو مكافأة أو استقطاع خطأ.\n\n**المتطلبات:** رقم `id` التخصيص من `payments.show`. يجب أن يكون مسيّر القسيمة ما زال في مرحلة الصرف (معتمداً\nأو لدى المحاسبة).\n\n**الآثار الجانبية:** ما سبق، ويُسجَّل في سجل التدقيق. يُرفض إذا حصّلت القسيمة عهدة أغلقتها تسوية نهاية خدمة أو\nتسوية سابقة. لا يُعرض على Claude لأنه يعيد فتح مستحقات الموظفين.","x-access":"write","x-permission":{"key":"payment/delete","label":"Delete payments and remove allocations","x-label-ar":"حذف المدفوعات وإزالة التخصيصات"},"x-feature":"payment","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/allocation_id"}],"responses":{"204":{"description":"Removed.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The allocation cannot be removed.","x-description-ar":"لا يمكن حذف التخصيص.","x-codes":[{"code":"validation_failed","meaning":"The payslip's run is no longer being paid.","x-meaning-ar":"مسيّر القسيمة لم يعد في مرحلة الصرف.","x-fix":"Nothing to fix here; correct it in a later run.","x-fix-ar":"لا يمكن التعديل هنا؛ صحّحه في مسيّر لاحق."},{"code":"custody_balance_frozen","meaning":"A payslip this money paid collected custody installments that an end-of-service package or a settlement has already closed; removing it would leave that money unrecovered.","x-meaning-ar":"قسيمة سددها هذا المبلغ حصّلت أقساط عهدة أغلقتها تسوية نهاية خدمة أو تسوية سابقة، وحذفه يترك ذلك المبلغ دون استرداد.","x-fix":"Leave the payment; correct the custody settlement instead.","x-fix-ar":"أبقِ الدفعة، وصحّح تسوية العهدة بدلاً من ذلك."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Allocations can only be removed while the run is being paid.","code":"validation_failed"}}}}}}},"/payroll/bonuses":{"get":{"summary":"List bonuses","operationId":"bonuses.list","tags":["Bonuses"],"description":"Returns every bonus in the company, newest first: who it is for, kind, amount, date, status and, for a\nmanager's proposal, who submitted it. Drafts waiting for approval and rejected bonuses are included.\n\n**When to use:** to review bonuses waiting for approval (`status: draft`), or to answer \"what bonuses were\npaid this month?\". For one bonus with what accounting said about it, use `bonuses.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض المكافآت","x-description-ar":"يعرض كل مكافآت الشركة، الأحدث أولاً: لمن هي ونوعها ومبلغها وتاريخها وحالتها، ومن اقترحها إن كانت من مدير.\nتشمل القائمة المسودات المنتظرة للاعتماد والمكافآت المرفوضة.\n\n**متى تستخدمه:** لمراجعة المكافآت المنتظرة للاعتماد (`status: draft`)، أو للإجابة عن «ما المكافآت التي\nصُرفت هذا الشهر؟». لمكافأة واحدة مع رأي المحاسبة فيها استخدم `bonuses.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"bonus/view","label":"View bonuses","x-label-ar":"عرض المكافآت"},"x-feature":"bonus","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of bonuses.","x-description-ar":"صفحة من المكافآت.","content":{"application/json":{"example":{"records":[{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/bonus"},"description":"The bonuses, newest first.","x-description-ar":"المكافآت، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a bonus for an employee","operationId":"bonuses.create","tags":["Bonuses"],"description":"Adds a bonus for one employee as a `draft`. It is paid only after approval (`bonuses.approve`): then the\nnext payroll run adds it to the employee's payslip as an income line, unless it is paid directly or\nsettled in an end-of-service package first.\n\n**When to use:** to reward one employee. For the same bonus to many employees use `bonuses.bulk_create`;\na manager proposing one for a direct report uses `team_bonuses.create`.\n\n**Prerequisites:** `employee_id` from `employees.list`.\n\n**Side effects:** recorded in the audit log; no notification. Not offered to Claude: it decides money an\nemployee is paid.","x-summary-ar":"إضافة مكافأة لموظف","x-description-ar":"يضيف مكافأة لموظف واحد بحالة `draft` مسودة. لا تُصرف إلا بعد اعتمادها (`bonuses.approve`): عندها يضيفها\nمسيّر الرواتب التالي بنداً مستحقاً في قسيمة الموظف، ما لم تُصرف مباشرة أو تُسوَّ في مستحقات نهاية الخدمة قبل\nذلك.\n\n**متى تستخدمه:** لمكافأة موظف واحد. للمكافأة نفسها لعدة موظفين استخدم `bonuses.bulk_create`، أما المدير\nالذي يقترح مكافأة لأحد مرؤوسيه فيستخدم `team_bonuses.create`.\n\n**المتطلبات:** `employee_id` من `employees.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق دون إشعار. لا يُعرض على Claude: لأنه يحدد مالاً يُصرف للموظف.","x-access":"write","x-permission":{"key":"bonus/create","label":"Add bonuses","x-label-ar":"إضافة مكافأة"},"x-feature":"bonus","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new bonus, as a draft.","x-description-ar":"المكافأة الجديدة بحالة مسودة.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":null,"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/bonus"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bonus was refused.","x-description-ar":"رُفضت المكافأة.","x-codes":[{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The amount must be greater than zero.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["bonus"],"properties":{"bonus":{"allOf":[{"$ref":"#/components/schemas/bonus_input"}],"type":"object","required":["employee_id","kind","amount"],"description":"The bonus, for `employee_id`.","x-description-ar":"المكافأة للموظف `employee_id`.","properties":{"employee_id":{"type":"integer","description":"The employee, from `employees.list`.","x-description-ar":"الموظف، من `employees.list`."}}}}},"example":{"bonus":{"employee_id":1203,"kind":"commission","amount":"2500.00","date":"2026-11-15","description":"Q3 sales commission"}}}},"required":true,"description":"The bonus."}}},"/payroll/bonuses/bulk":{"post":{"summary":"Add the same bonus to many employees","operationId":"bonuses.bulk_create","tags":["Bonuses"],"description":"Adds one draft bonus per employee in `employee_ids`, all with the same kind, amount, date and description.\nAll or nothing: if one cannot be saved, none is.\n\n**When to use:** for a company-wide or team-wide reward (an Eid grant). For one employee use\n`bonuses.create`.\n\n**Prerequisites:** `employee_ids` from `employees.list`.\n\n**Side effects:** each bonus is a draft that still needs `bonuses.approve`. Recorded in the audit log. Not\noffered to Claude: a bulk money change.","x-summary-ar":"إضافة المكافأة نفسها لعدة موظفين","x-description-ar":"يضيف مكافأة مسودة لكل موظف في `employee_ids`، كلها بالنوع والمبلغ والتاريخ والوصف نفسه. إما أن تُحفظ كلها أو\nلا يُحفظ شيء.\n\n**متى تستخدمه:** لمكافأة على مستوى الشركة أو الفريق (منحة العيد). لموظف واحد استخدم `bonuses.create`.\n\n**المتطلبات:** `employee_ids` من `employees.list`.\n\n**الآثار الجانبية:** كل مكافأة مسودة تحتاج `bonuses.approve`. يُسجَّل في سجل التدقيق. لا يُعرض على Claude:\nلأنه تغيير مالي جماعي.","x-access":"write","x-permission":{"key":"bonus/create","label":"Add bonuses","x-label-ar":"إضافة مكافأة"},"x-feature":"bonus","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"How many were added, and their references.","x-description-ar":"عدد المكافآت المضافة ومراجعها.","content":{"application/json":{"example":{"created":2,"bonuses":[{"id":419,"reference":"BNS-0043","status":"draft"},{"id":420,"reference":"BNS-0044","status":"draft"}]},"schema":{"type":"object","properties":{"created":{"type":"integer","description":"Bonuses added.","x-description-ar":"عدد المكافآت المضافة."},"bonuses":{"type":"array","description":"The new bonuses.","x-description-ar":"المكافآت الجديدة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Bonus id.","x-description-ar":"رقم المكافأة."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."},"status":{"type":"string","description":"Always `draft`.","x-description-ar":"دائماً `draft`."}}}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bonuses were refused.","x-description-ar":"رُفضت المكافآت.","x-codes":[{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The amount must be greater than zero.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/bonus_input"}],"type":"object","required":["employee_ids","kind","amount"],"properties":{"employee_ids":{"type":"array","description":"The employees, from `employees.list`.","x-description-ar":"الموظفون، من `employees.list`.","items":{"type":"integer"}}}},"example":{"employee_ids":[1203,1204],"kind":"grant","amount":"1000.00","date":"2026-11-15","description":"Eid grant"}}},"required":true,"description":"The employees and the bonus."}}},"/payroll/bonuses/export":{"get":{"summary":"Export bonuses to Excel or CSV","operationId":"bonuses.export","tags":["Bonuses"],"description":"Builds a file of every bonus, newest first, one row per bonus, with the columns you choose (reference,\nemployee, kind, currency, amount, status, date…) and a total of the amounts per currency. It holds the same\nbonuses as `bonuses.list`.\n\n**When to use:** to hand the month's bonuses to finance, or to archive them. To read them, `bonuses.list`\nis lighter.\n\n**Prerequisites:** column keys from `bonuses.export_columns`. You need \"Export payroll data\" as well as\n\"View bonuses\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير المكافآت إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بكل المكافآت، الأحدث أولاً، صف لكل مكافأة، بالأعمدة التي تختارها (المرجع والموظف والنوع والعملة\nوالمبلغ والحالة والتاريخ…) مع مجموع المبالغ لكل عملة. يضم المكافآت نفسها التي تعرضها `bonuses.list`.\n\n**متى تستخدمه:** لتسليم مكافآت الشهر إلى المالية أو لأرشفتها. لقراءتها `bonuses.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `bonuses.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض\nالمكافآت» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"bonus/view","label":"View bonuses","x-label-ar":"عرض المكافآت"}]},"x-feature":"bonus","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/payroll/bonuses/export/columns":{"get":{"summary":"List the columns a bonuses export can have","operationId":"bonuses.export_columns","tags":["Bonuses"],"description":"Returns the columns of the bonuses export, in screen order, with their header in the requested language and\nwhether QHR ticks them by default.\n\n**When to use:** before `bonuses.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View bonuses\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير المكافآت","x-description-ar":"يعرض أعمدة تصدير المكافآت بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب، وهل يحددها QHR افتراضياً.\n\n**متى تستخدمه:** قبل `bonuses.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض المكافآت».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"bonus/view","label":"View bonuses","x-label-ar":"عرض المكافآت"}]},"x-feature":"bonus","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"amount","label":"Amount","default":true,"type":"money"},{"key":"status","label":"Status","default":true,"type":"enum"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/bonuses/{id}":{"get":{"summary":"Get a bonus","operationId":"bonuses.show","tags":["Bonuses"],"description":"Returns one bonus with its status and, when the company posts to Qoyod accounting, the accountant's latest\nanswer (`accounting`): waiting, approved or declined, with the reason.\n\n**When to use:** to answer \"why has this bonus not been paid?\" — it may be a draft, waiting for the\naccountant, or declined.\n\n**Prerequisites:** the bonus `id` from `bonuses.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض مكافأة","x-description-ar":"يعرض مكافأة واحدة بحالتها، وإن كانت الشركة مرتبطة بمحاسبة قيود فآخر رد للمحاسب (`accounting`): بالانتظار\nأو معتمدة أو مرفوضة مع السبب.\n\n**متى تستخدمه:** للإجابة عن «لماذا لم تُصرف هذه المكافأة؟» — قد تكون مسودة أو بانتظار المحاسب أو مرفوضة.\n\n**المتطلبات:** رقم `id` المكافأة من `bonuses.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"bonus/view","label":"View bonuses","x-label-ar":"عرض المكافآت"},"x-feature":"bonus","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/bonus_id"}],"responses":{"200":{"description":"The bonus.","x-description-ar":"المكافأة.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null,"accounting":null},"schema":{"$ref":"#/components/schemas/bonus_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a draft bonus","operationId":"bonuses.update","tags":["Bonuses"],"description":"Changes the kind, amount, date or description of a bonus that is still a draft. An approved or rejected\nbonus is frozen.\n\n**When to use:** to correct a bonus before approving it.\n\n**Prerequisites:** the bonus `id` from `bonuses.list`; it must be `draft`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it changes money an employee is paid.","x-summary-ar":"تعديل مكافأة مسودة","x-description-ar":"يعدّل نوع المكافأة أو مبلغها أو تاريخها أو وصفها ما دامت مسودة. أما المعتمدة أو المرفوضة فمجمّدة.\n\n**متى تستخدمه:** لتصحيح المكافأة قبل اعتمادها.\n\n**المتطلبات:** رقم `id` المكافأة من `bonuses.list`، ويجب أن تكون `draft`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يغيّر مالاً يُصرف للموظف.","x-access":"write","x-permission":{"key":"bonus/edit","label":"Edit bonuses","x-label-ar":"تعديل مكافأة"},"x-feature":"bonus","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/bonus_id"}],"responses":{"200":{"description":"The bonus after the change.","x-description-ar":"المكافأة بعد التعديل.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"3000.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/bonus"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"The bonus is no longer a draft: once approved or rejected it cannot be changed or deleted.","x-meaning-ar":"المكافأة لم تعد مسودة: بعد اعتمادها أو رفضها لا يمكن تعديلها أو حذفها.","x-fix":"Leave it, and add a deduction or a new bonus to correct the amount.","x-fix-ar":"اتركها، وأضف استقطاعاً أو مكافأة جديدة لتصحيح المبلغ."},{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"BNS-0042 has been approved and can no longer be edited.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["bonus"],"properties":{"bonus":{"$ref":"#/components/schemas/bonus_input"}}},"example":{"bonus":{"amount":"3000.00"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a draft bonus","operationId":"bonuses.delete","tags":["Bonuses"],"description":"Deletes a bonus that is still a draft. Approved and rejected bonuses stay on file and cannot be deleted.\n\n**When to use:** to drop a bonus added by mistake. To refuse a manager's proposal and keep the record, use\n`bonuses.reject`.\n\n**Prerequisites:** the bonus `id` from `bonuses.list`; it must be `draft`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it deletes a record.","x-summary-ar":"حذف مكافأة مسودة","x-description-ar":"يحذف مكافأة ما دامت مسودة. المكافآت المعتمدة والمرفوضة تبقى في السجل ولا تُحذف.\n\n**متى تستخدمه:** لإزالة مكافأة أُضيفت خطأً. لرفض اقتراح مدير مع إبقاء السجل استخدم `bonuses.reject`.\n\n**المتطلبات:** رقم `id` المكافأة من `bonuses.list`، ويجب أن تكون `draft`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يحذف سجلاً.","x-access":"write","x-permission":{"key":"bonus/delete","label":"Delete bonuses","x-label-ar":"حذف مكافأة"},"x-feature":"bonus","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/bonus_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bonus cannot be deleted.","x-description-ar":"لا يمكن حذف المكافأة.","x-codes":[{"code":"validation_failed","meaning":"The bonus is no longer a draft: once approved or rejected it cannot be changed or deleted.","x-meaning-ar":"المكافأة لم تعد مسودة: بعد اعتمادها أو رفضها لا يمكن تعديلها أو حذفها.","x-fix":"Leave it, and add a deduction or a new bonus to correct the amount.","x-fix-ar":"اتركها، وأضف استقطاعاً أو مكافأة جديدة لتصحيح المبلغ."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"BNS-0042 has been approved and can no longer be deleted.","code":"validation_failed"}}}}}}},"/payroll/bonuses/{id}/approve":{"patch":{"summary":"Approve a bonus","operationId":"bonuses.approve","tags":["Bonuses"],"description":"Approves a draft bonus. Without Qoyod accounting it becomes `not_paid`, and the next payroll run pays it.\nWhen the company posts to Qoyod accounting it becomes `with_accounting` and is sent to the accountant; it\nis payable only once they approve it there.\n\n**When to use:** after checking a draft (`bonuses.show`), including a manager's proposal.\n\n**Prerequisites:** the bonus `id` from `bonuses.list`; it must be `draft`. The token's owner must be an\nemployee — the approval is recorded in their name.\n\n**Side effects:** the manager who proposed it is emailed the outcome; with accounting, a posting is queued\nto Qoyod. Recorded in the audit log. Irreversible: an approved bonus is frozen and, with accounting, cannot be\nwithdrawn. Not offered to Claude: it commits money to be paid.","x-summary-ar":"اعتماد مكافأة","x-description-ar":"يعتمد مكافأة مسودة. دون محاسبة قيود تصبح `not_paid` فيصرفها المسيّر التالي. وإن كانت الشركة مرتبطة بمحاسبة\nقيود تصبح `with_accounting` وتُرسل إلى المحاسب، ولا تُصرف إلا بعد موافقته هناك.\n\n**متى تستخدمه:** بعد مراجعة المسودة (`bonuses.show`)، بما فيها اقتراحات المديرين.\n\n**المتطلبات:** رقم `id` المكافأة من `bonuses.list`، ويجب أن تكون `draft`. ويجب أن يكون صاحب الرمز موظفاً —\nفالاعتماد يُسجَّل باسمه.\n\n**الآثار الجانبية:** يصل المديرَ المقترِح بريد بالنتيجة، ومع المحاسبة يُجدوَل قيد إلى قيود. يُسجَّل في سجل\nالتدقيق. لا رجعة فيه: المكافأة المعتمدة مجمّدة، ومع المحاسبة لا يمكن سحبها. لا يُعرض على Claude: لأنه يُلزم\nبصرف مال.","x-access":"write","x-permission":{"key":"bonus/approve","label":"Approve bonuses","x-label-ar":"اعتماد المكافآت"},"x-feature":"bonus","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/bonus_id"}],"responses":{"200":{"description":"The approved bonus.","x-description-ar":"المكافأة المعتمدة.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"not_paid","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/bonus"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bonus cannot be approved.","x-description-ar":"لا يمكن اعتماد المكافأة.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"Only a draft can be approved or rejected; this one was already decided.","x-meaning-ar":"لا تُعتمد أو تُرفض إلا المسودة، وهذه حُسم أمرها.","x-fix":"Read its `status` with `bonuses.show`; nothing to do.","x-fix-ar":"اقرأ `status` عبر `bonuses.show`؛ لا يلزم شيء."},{"code":"validation_failed","meaning":"The company posts to Qoyod accounting and the bonus could not be sent there, so it was not approved.","x-meaning-ar":"الشركة مرتبطة بمحاسبة قيود وتعذّر إرسال المكافأة إليها، فلم تُعتمد.","x-fix":"Try again in a moment; if it persists, an admin should check the Qoyod accounting connection.","x-fix-ar":"أعد المحاولة بعد قليل، وإن تكرر فليتحقق مسؤول النظام من الربط مع محاسبة قيود."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Only draft bonuses can be approved.","code":"validation_failed"}}}}}}},"/payroll/bonuses/{id}/reject":{"patch":{"summary":"Reject a bonus","operationId":"bonuses.reject","tags":["Bonuses"],"description":"Rejects a draft bonus, with an optional reason. A rejected bonus is never paid and stays on file,\nread-only.\n\n**When to use:** to turn down a manager's proposal while keeping the record. To drop your own mistake,\n`bonuses.delete` is simpler.\n\n**Prerequisites:** the bonus `id` from `bonuses.list`; it must be `draft`. The token's owner must be an\nemployee — the rejection is recorded in their name.\n\n**Side effects:** the manager who proposed it is emailed the rejection and the reason. Recorded in the\naudit log. Not offered to Claude: it decides money an employee is paid.","x-summary-ar":"رفض مكافأة","x-description-ar":"يرفض مكافأة مسودة مع سبب اختياري. المكافأة المرفوضة لا تُصرف أبداً وتبقى في السجل للقراءة فقط.\n\n**متى تستخدمه:** لرفض اقتراح مدير مع إبقاء السجل. لإزالة خطأ منك `bonuses.delete` أبسط.\n\n**المتطلبات:** رقم `id` المكافأة من `bonuses.list`، ويجب أن تكون `draft`. ويجب أن يكون صاحب الرمز موظفاً —\nفالرفض يُسجَّل باسمه.\n\n**الآثار الجانبية:** يصل المديرَ المقترِح بريد بالرفض وسببه. يُسجَّل في سجل التدقيق. لا يُعرض على Claude:\nلأنه يحدد مالاً يُصرف للموظف.","x-access":"write","x-permission":{"key":"bonus/approve","label":"Approve bonuses","x-label-ar":"اعتماد المكافآت"},"x-feature":"bonus","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/bonus_id"}],"responses":{"200":{"description":"The rejected bonus.","x-description-ar":"المكافأة المرفوضة.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"rejected","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":{"id":91,"full_name":"Huda Saleh"},"rejected_at":"2026-11-20T08:15:00Z","rejection_reason":"Commission already included in the October payroll."},"schema":{"$ref":"#/components/schemas/bonus"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The bonus cannot be rejected.","x-description-ar":"لا يمكن رفض المكافأة.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"Only a draft can be approved or rejected; this one was already decided.","x-meaning-ar":"لا تُعتمد أو تُرفض إلا المسودة، وهذه حُسم أمرها.","x-fix":"Read its `status` with `bonuses.show`; nothing to do.","x-fix-ar":"اقرأ `status` عبر `bonuses.show`؛ لا يلزم شيء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Why it is rejected; shown to the manager.","x-description-ar":"سبب الرفض؛ يظهر للمدير."}}},"example":{"reason":"Commission already included in the October payroll."}}},"required":true,"description":"The reason, optional."}}},"/payroll/components":{"get":{"summary":"List pay components","operationId":"payroll_components.list","tags":["Salaries"],"description":"Returns the company's catalogue of named pay components — earnings (allowances) and deductions — in the\norder they were added, including the built-in ones every company starts with.\n\n**When to use:** to see which allowance and deduction names the company uses.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مكوّنات الراتب","x-description-ar":"يعرض قائمة الشركة لمكوّنات الراتب المسمّاة — الاستحقاقات (البدلات) والاستقطاعات — بترتيب إضافتها، بما فيها\nالمكوّنات المدمجة التي تبدأ بها كل شركة.\n\n**متى تستخدمه:** لمعرفة أسماء البدلات والاستقطاعات التي تستخدمها الشركة.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"salary/view","label":"View compensation","x-label-ar":"عرض الرواتب"},"x-feature":"salary","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of components.","x-description-ar":"صفحة من المكوّنات.","content":{"application/json":{"example":{"records":[{"id":6,"name_en":"Phone allowance","name_ar":"بدل الهاتف","name":"Phone allowance","component_type":"earning","calc_basis":"Fixed monthly amount","is_builtin":false}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/payroll_component"},"description":"The components.","x-description-ar":"المكوّنات."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a pay component","operationId":"payroll_components.create","tags":["Salaries"],"description":"Adds a named earning or deduction to the company's pay component catalogue. Names must be unique in English\nand in Arabic.\n\n**When to use:** when the company introduces a new kind of allowance or deduction.\n\n**Prerequisites:** none. Check the existing names with `payroll_components.list`.\n\n**Side effects:** recorded in the audit log; no pay changes. Not offered to Claude, as company payroll setup.","x-summary-ar":"إضافة مكوّن راتب","x-description-ar":"يضيف استحقاقاً أو استقطاعاً مسمّى إلى قائمة مكوّنات الراتب في الشركة. يجب أن يكون الاسم فريداً بالعربية\nوالإنجليزية.\n\n**متى تستخدمه:** عندما تستحدث الشركة نوعاً جديداً من البدلات أو الاستقطاعات.\n\n**المتطلبات:** لا شيء. راجع الأسماء الحالية عبر `payroll_components.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق ولا يتغير أي راتب. لا يُعرض على Claude لأنه من إعدادات الرواتب.","x-access":"write","x-permission":{"key":"salary/create","label":"Set compensation","x-label-ar":"تحديد الراتب"},"x-feature":"salary","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new component.","x-description-ar":"المكوّن الجديد.","content":{"application/json":{"example":{"id":6,"name_en":"Phone allowance","name_ar":"بدل الهاتف","name":"Phone allowance","component_type":"earning","calc_basis":"Fixed monthly amount","is_builtin":false},"schema":{"$ref":"#/components/schemas/payroll_component"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The component was refused.","x-description-ar":"رُفض المكوّن.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["component"],"properties":{"component":{"type":"object","required":["name_en","name_ar","component_type"],"description":"The component's fields.","x-description-ar":"حقول المكوّن.","properties":{"name_en":{"type":"string","description":"Name in English, unique.","x-description-ar":"الاسم بالإنجليزية، فريد."},"name_ar":{"type":"string","description":"Name in Arabic, unique.","x-description-ar":"الاسم بالعربية، فريد."},"component_type":{"type":"string","description":"`earning` or `deduction`.","x-description-ar":"`earning` استحقاق أو `deduction` استقطاع.","enum":["earning","deduction"]},"calc_basis":{"type":"string","description":"Free-text note on how it is calculated.","x-description-ar":"ملاحظة حرة عن طريقة الحساب."}}}}},"example":{"component":{"name_en":"Phone allowance","name_ar":"بدل الهاتف","component_type":"earning","calc_basis":"Fixed monthly amount"}}}},"required":true,"description":"The component."}}},"/payroll/components/{id}":{"patch":{"summary":"Change a pay component","operationId":"payroll_components.update","tags":["Salaries"],"description":"Renames a pay component or changes its type or calculation note. Names stay unique in both languages.\n\n**When to use:** to correct a component's name or type.\n\n**Prerequisites:** the component `id` from `payroll_components.list`.\n\n**Side effects:** recorded in the audit log; no pay changes. Not offered to Claude, as company payroll setup.","x-summary-ar":"تعديل مكوّن راتب","x-description-ar":"يعيد تسمية مكوّن الراتب أو يغيّر نوعه أو ملاحظة حسابه. تبقى الأسماء فريدة باللغتين.\n\n**متى تستخدمه:** لتصحيح اسم المكوّن أو نوعه.\n\n**المتطلبات:** رقم `id` المكوّن من `payroll_components.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق ولا يتغير أي راتب. لا يُعرض على Claude لأنه من إعدادات الرواتب.","x-access":"write","x-permission":{"key":"salary/edit","label":"Update compensation","x-label-ar":"تعديل الراتب"},"x-feature":"salary","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_component_id"}],"responses":{"200":{"description":"The component after the change.","x-description-ar":"المكوّن بعد التعديل.","content":{"application/json":{"example":{"id":6,"name_en":"Mobile allowance","name_ar":"بدل الهاتف","name":"Mobile allowance","component_type":"earning","calc_basis":"Fixed monthly amount","is_builtin":false},"schema":{"$ref":"#/components/schemas/payroll_component"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["component"],"properties":{"component":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تعديلها فقط.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"component_type":{"type":"string","description":"`earning` or `deduction`.","x-description-ar":"`earning` أو `deduction`.","enum":["earning","deduction"]},"calc_basis":{"type":"string","description":"Calculation note.","x-description-ar":"ملاحظة الحساب."}}}}},"example":{"component":{"name_en":"Mobile allowance"}}}},"required":true,"description":"The fields to change."}}},"/payroll/deductions":{"get":{"summary":"List deductions","operationId":"deductions.list","tags":["Deductions"],"description":"Returns every one-off deduction in the company, newest first: who it is for, kind, amount, date, status\nand, for a manager's proposal, who submitted it. Drafts waiting for approval and rejected deductions are\nincluded.\n\n**When to use:** to review deductions waiting for approval (`status: draft`), or to answer \"what was\ndeducted from Sara this month?\". For one deduction with what accounting said about it, use\n`deductions.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الاستقطاعات","x-description-ar":"يعرض كل الاستقطاعات غير الثابتة في الشركة، الأحدث أولاً: على من هي ونوعها ومبلغها وتاريخها وحالتها، ومن\nاقترحها إن كانت من مدير. تشمل القائمة المسودات المنتظرة للاعتماد والاستقطاعات المرفوضة.\n\n**متى تستخدمه:** لمراجعة الاستقطاعات المنتظرة للاعتماد (`status: draft`)، أو للإجابة عن «ماذا استُقطع من\nسارة هذا الشهر؟». لاستقطاع واحد مع رأي المحاسبة فيه استخدم `deductions.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"deduction/view","label":"View deductions","x-label-ar":"عرض الخصومات"},"x-feature":"deduction","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of deductions.","x-description-ar":"صفحة من الاستقطاعات.","content":{"application/json":{"example":{"records":[{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/deduction"},"description":"The deductions, newest first.","x-description-ar":"الاستقطاعات، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a deduction for an employee","operationId":"deductions.create","tags":["Deductions"],"description":"Adds a one-off deduction for one employee as a `draft`. It is deducted only after approval\n(`deductions.approve`): then the next payroll run takes it from the employee's payslip as a deduction line,\nunless it is settled directly or in an end-of-service package first.\n\n**When to use:** for a penalty, a repayment or a reimbursement owed by one employee. For the same deduction\non many employees use `deductions.bulk_create`; a manager proposing one for a direct report uses\n`team_deductions.create`. A deduction taken every month belongs on the salary (`salaries.update`).\n\n**Prerequisites:** `employee_id` from `employees.list`.\n\n**Side effects:** recorded in the audit log; no notification. Not offered to Claude: it decides money taken\nfrom an employee's pay.","x-summary-ar":"إضافة استقطاع على موظف","x-description-ar":"يضيف استقطاعاً لمرة واحدة على موظف بحالة `draft` مسودة. لا يُستقطع إلا بعد اعتماده (`deductions.approve`):\nعندها يأخذه مسيّر الرواتب التالي من قسيمة الموظف بنداً مستقطعاً، ما لم يُسوَّ مباشرة أو في مستحقات نهاية\nالخدمة قبل ذلك.\n\n**متى تستخدمه:** لجزاء أو سداد أو مبلغ مستحق الاسترداد على موظف واحد. للاستقطاع نفسه على عدة موظفين استخدم\n`deductions.bulk_create`، أما المدير الذي يقترح استقطاعاً على أحد مرؤوسيه فيستخدم `team_deductions.create`.\nوالاستقطاع المتكرر كل شهر مكانه الراتب (`salaries.update`).\n\n**المتطلبات:** `employee_id` من `employees.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق دون إشعار. لا يُعرض على Claude: لأنه يحدد مالاً يُستقطع من راتب\nالموظف.","x-access":"write","x-permission":{"key":"deduction/create","label":"Add deductions","x-label-ar":"إضافة خصم"},"x-feature":"deduction","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new deduction, as a draft.","x-description-ar":"الاستقطاع الجديد بحالة مسودة.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":null,"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/deduction"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The deduction was refused.","x-description-ar":"رُفض الاستقطاع.","x-codes":[{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The amount must be greater than zero.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["deduction"],"properties":{"deduction":{"allOf":[{"$ref":"#/components/schemas/deduction_input"}],"type":"object","required":["employee_id","kind","amount"],"description":"The deduction, for `employee_id`.","x-description-ar":"الاستقطاع على الموظف `employee_id`.","properties":{"employee_id":{"type":"integer","description":"The employee, from `employees.list`.","x-description-ar":"الموظف، من `employees.list`."}}}}},"example":{"deduction":{"employee_id":1203,"kind":"policy_violation","amount":"300.00","date":"2026-11-12","description":"Repeated late arrival"}}}},"required":true,"description":"The deduction."}}},"/payroll/deductions/bulk":{"post":{"summary":"Add the same deduction to many employees","operationId":"deductions.bulk_create","tags":["Deductions"],"description":"Adds one draft deduction per employee in `employee_ids`, all with the same kind, amount, date and\ndescription. All or nothing: if one cannot be saved, none is.\n\n**When to use:** for the same charge on many people (a shared training fee). For one employee use\n`deductions.create`.\n\n**Prerequisites:** `employee_ids` from `employees.list`.\n\n**Side effects:** each deduction is a draft that still needs `deductions.approve`. Recorded in the audit\nlog. Not offered to Claude: a bulk money change.","x-summary-ar":"إضافة الاستقطاع نفسه على عدة موظفين","x-description-ar":"يضيف استقطاعاً مسودة على كل موظف في `employee_ids`، كلها بالنوع والمبلغ والتاريخ والوصف نفسه. إما أن تُحفظ\nكلها أو لا يُحفظ شيء.\n\n**متى تستخدمه:** لمبلغ واحد على عدة أشخاص (رسوم تدريب مشتركة). لموظف واحد استخدم `deductions.create`.\n\n**المتطلبات:** `employee_ids` من `employees.list`.\n\n**الآثار الجانبية:** كل استقطاع مسودة يحتاج `deductions.approve`. يُسجَّل في سجل التدقيق. لا يُعرض على\nClaude: لأنه تغيير مالي جماعي.","x-access":"write","x-permission":{"key":"deduction/create","label":"Add deductions","x-label-ar":"إضافة خصم"},"x-feature":"deduction","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"How many were added, and their references.","x-description-ar":"عدد الاستقطاعات المضافة ومراجعها.","content":{"application/json":{"example":{"created":2,"deductions":[{"id":234,"reference":"DCN-0018","status":"draft"},{"id":235,"reference":"DCN-0019","status":"draft"}]},"schema":{"type":"object","properties":{"created":{"type":"integer","description":"Deductions added.","x-description-ar":"عدد الاستقطاعات المضافة."},"deductions":{"type":"array","description":"The new deductions.","x-description-ar":"الاستقطاعات الجديدة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Deduction id.","x-description-ar":"رقم الاستقطاع."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."},"status":{"type":"string","description":"Always `draft`.","x-description-ar":"دائماً `draft`."}}}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The deductions were refused.","x-description-ar":"رُفضت الاستقطاعات.","x-codes":[{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The amount must be greater than zero.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/deduction_input"}],"type":"object","required":["employee_ids","kind","amount"],"properties":{"employee_ids":{"type":"array","description":"The employees, from `employees.list`.","x-description-ar":"الموظفون، من `employees.list`.","items":{"type":"integer"}}}},"example":{"employee_ids":[1203,1204],"kind":"other","amount":"250.00","date":"2026-11-12","description":"Safety training fee"}}},"required":true,"description":"The employees and the deduction."}}},"/payroll/deductions/export":{"get":{"summary":"Export deductions to Excel or CSV","operationId":"deductions.export","tags":["Deductions"],"description":"Builds a file of every one-off deduction, newest first, one row per deduction, with the columns you choose (reference,\nemployee, kind, currency, amount, status, date…) and a total of the amounts per currency. It holds the same\ndeductions as `deductions.list`.\n\n**When to use:** to hand the month's deductions to finance, or to archive them. To read them, `deductions.list`\nis lighter.\n\n**Prerequisites:** column keys from `deductions.export_columns`. You need \"Export payroll data\" as well as\n\"View deductions\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير الاستقطاعات إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بكل الاستقطاعات غير الثابتة، الأحدث أولاً، صف لكل استقطاع، بالأعمدة التي تختارها (المرجع والموظف والنوع والعملة\nوالمبلغ والحالة والتاريخ…) مع مجموع المبالغ لكل عملة. يضم الاستقطاعات نفسها التي تعرضها `deductions.list`.\n\n**متى تستخدمه:** لتسليم استقطاعات الشهر إلى المالية أو لأرشفتها. لقراءتها `deductions.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `deductions.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض\nالاستقطاعات» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"deduction/view","label":"View deductions","x-label-ar":"عرض الخصومات"}]},"x-feature":"deduction","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/payroll/deductions/export/columns":{"get":{"summary":"List the columns a deductions export can have","operationId":"deductions.export_columns","tags":["Deductions"],"description":"Returns the columns of the deductions export, in screen order, with their header in the requested language and\nwhether QHR ticks them by default.\n\n**When to use:** before `deductions.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View deductions\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير الاستقطاعات","x-description-ar":"يعرض أعمدة تصدير الاستقطاعات بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب، وهل يحددها QHR افتراضياً.\n\n**متى تستخدمه:** قبل `deductions.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض الاستقطاعات».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"deduction/view","label":"View deductions","x-label-ar":"عرض الخصومات"}]},"x-feature":"deduction","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"amount","label":"Amount","default":true,"type":"money"},{"key":"status","label":"Status","default":true,"type":"enum"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/deductions/{id}":{"get":{"summary":"Get a deduction","operationId":"deductions.show","tags":["Deductions"],"description":"Returns one deduction with its status and, when the company posts to Qoyod accounting, the accountant's\nlatest answer (`accounting`): waiting, approved or declined, with the reason.\n\n**When to use:** to answer \"why has this deduction not been taken yet?\" — it may be a draft, waiting for\nthe accountant, or declined.\n\n**Prerequisites:** the deduction `id` from `deductions.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض استقطاع","x-description-ar":"يعرض استقطاعاً واحداً بحالته، وإن كانت الشركة مرتبطة بمحاسبة قيود فآخر رد للمحاسب (`accounting`): بالانتظار\nأو معتمد أو مرفوض مع السبب.\n\n**متى تستخدمه:** للإجابة عن «لماذا لم يُستقطع هذا المبلغ بعد؟» — قد يكون مسودة أو بانتظار المحاسب أو مرفوضاً.\n\n**المتطلبات:** رقم `id` الاستقطاع من `deductions.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"deduction/view","label":"View deductions","x-label-ar":"عرض الخصومات"},"x-feature":"deduction","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/deduction_id"}],"responses":{"200":{"description":"The deduction.","x-description-ar":"الاستقطاع.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null,"accounting":null},"schema":{"$ref":"#/components/schemas/deduction_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a draft deduction","operationId":"deductions.update","tags":["Deductions"],"description":"Changes the kind, amount, date or description of a deduction that is still a draft. An approved or\nrejected deduction is frozen.\n\n**When to use:** to correct a deduction before approving it.\n\n**Prerequisites:** the deduction `id` from `deductions.list`; it must be `draft`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it changes money taken from an\nemployee's pay.","x-summary-ar":"تعديل استقطاع مسودة","x-description-ar":"يعدّل نوع الاستقطاع أو مبلغه أو تاريخه أو وصفه ما دام مسودة. أما المعتمد أو المرفوض فمجمّد.\n\n**متى تستخدمه:** لتصحيح الاستقطاع قبل اعتماده.\n\n**المتطلبات:** رقم `id` الاستقطاع من `deductions.list`، ويجب أن يكون `draft`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يغيّر مالاً يُستقطع من راتب الموظف.","x-access":"write","x-permission":{"key":"deduction/edit","label":"Edit deductions","x-label-ar":"تعديل خصم"},"x-feature":"deduction","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/deduction_id"}],"responses":{"200":{"description":"The deduction after the change.","x-description-ar":"الاستقطاع بعد التعديل.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"200.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/deduction"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"The deduction is no longer a draft: once approved or rejected it cannot be changed or deleted.","x-meaning-ar":"الاستقطاع لم يعد مسودة: بعد اعتماده أو رفضه لا يمكن تعديله أو حذفه.","x-fix":"Leave it, and add a bonus or a new deduction to correct the amount.","x-fix-ar":"اتركه، وأضف مكافأة أو استقطاعاً جديداً لتصحيح المبلغ."},{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"DCN-0017 has been approved and can no longer be edited.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["deduction"],"properties":{"deduction":{"$ref":"#/components/schemas/deduction_input"}}},"example":{"deduction":{"amount":"200.00"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a draft deduction","operationId":"deductions.delete","tags":["Deductions"],"description":"Deletes a deduction that is still a draft. Approved and rejected deductions stay on file and cannot be\ndeleted.\n\n**When to use:** to drop a deduction added by mistake. To refuse a manager's proposal and keep the record,\nuse `deductions.reject`.\n\n**Prerequisites:** the deduction `id` from `deductions.list`; it must be `draft`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude: it deletes a record.","x-summary-ar":"حذف استقطاع مسودة","x-description-ar":"يحذف استقطاعاً ما دام مسودة. الاستقطاعات المعتمدة والمرفوضة تبقى في السجل ولا تُحذف.\n\n**متى تستخدمه:** لإزالة استقطاع أُضيف خطأً. لرفض اقتراح مدير مع إبقاء السجل استخدم `deductions.reject`.\n\n**المتطلبات:** رقم `id` الاستقطاع من `deductions.list`، ويجب أن يكون `draft`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يحذف سجلاً.","x-access":"write","x-permission":{"key":"deduction/delete","label":"Delete deductions","x-label-ar":"حذف خصم"},"x-feature":"deduction","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/deduction_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The deduction cannot be deleted.","x-description-ar":"لا يمكن حذف الاستقطاع.","x-codes":[{"code":"validation_failed","meaning":"The deduction is no longer a draft: once approved or rejected it cannot be changed or deleted.","x-meaning-ar":"الاستقطاع لم يعد مسودة: بعد اعتماده أو رفضه لا يمكن تعديله أو حذفه.","x-fix":"Leave it, and add a bonus or a new deduction to correct the amount.","x-fix-ar":"اتركه، وأضف مكافأة أو استقطاعاً جديداً لتصحيح المبلغ."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"DCN-0017 has been approved and can no longer be deleted.","code":"validation_failed"}}}}}}},"/payroll/deductions/{id}/approve":{"patch":{"summary":"Approve a deduction","operationId":"deductions.approve","tags":["Deductions"],"description":"Approves a draft deduction. Without Qoyod accounting it becomes `not_paid`, and the next payroll run\ndeducts it. When the company posts to Qoyod accounting it becomes `with_accounting` and is sent to the\naccountant; it is deducted only once they approve it there.\n\n**When to use:** after checking a draft (`deductions.show`), including a manager's proposal.\n\n**Prerequisites:** the deduction `id` from `deductions.list`; it must be `draft`. The token's owner must be\nan employee — the approval is recorded in their name.\n\n**Side effects:** the manager who proposed it is emailed the outcome; with accounting, a posting is queued\nto Qoyod. Recorded in the audit log. Irreversible: an approved deduction is frozen and, with accounting, cannot be\nwithdrawn. Not offered to Claude: it commits money to be taken from pay.","x-summary-ar":"اعتماد استقطاع","x-description-ar":"يعتمد استقطاعاً مسودة. دون محاسبة قيود يصبح `not_paid` فيستقطعه المسيّر التالي. وإن كانت الشركة مرتبطة\nبمحاسبة قيود يصبح `with_accounting` ويُرسل إلى المحاسب، ولا يُستقطع إلا بعد موافقته هناك.\n\n**متى تستخدمه:** بعد مراجعة المسودة (`deductions.show`)، بما فيها اقتراحات المديرين.\n\n**المتطلبات:** رقم `id` الاستقطاع من `deductions.list`، ويجب أن يكون `draft`. ويجب أن يكون صاحب الرمز\nموظفاً — فالاعتماد يُسجَّل باسمه.\n\n**الآثار الجانبية:** يصل المديرَ المقترِح بريد بالنتيجة، ومع المحاسبة يُجدوَل قيد إلى قيود. يُسجَّل في سجل\nالتدقيق. لا رجعة فيه: الاستقطاع المعتمد مجمّد، ومع المحاسبة لا يمكن سحبه. لا يُعرض على Claude: لأنه يُلزم\nباستقطاع مال من الراتب.","x-access":"write","x-permission":{"key":"deduction/approve","label":"Approve deductions","x-label-ar":"اعتماد الخصومات"},"x-feature":"deduction","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/deduction_id"}],"responses":{"200":{"description":"The approved deduction.","x-description-ar":"الاستقطاع المعتمد.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"not_paid","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/deduction"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The deduction cannot be approved.","x-description-ar":"لا يمكن اعتماد الاستقطاع.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"Only a draft can be approved or rejected; this one was already decided.","x-meaning-ar":"لا يُعتمد أو يُرفض إلا المسودة، وهذا الاستقطاع حُسم أمره.","x-fix":"Read its `status` with `deductions.show`; nothing to do.","x-fix-ar":"اقرأ `status` عبر `deductions.show`؛ لا يلزم شيء."},{"code":"validation_failed","meaning":"The company posts to Qoyod accounting and the deduction could not be sent there, so it was not approved.","x-meaning-ar":"الشركة مرتبطة بمحاسبة قيود وتعذّر إرسال الاستقطاع إليها، فلم يُعتمد.","x-fix":"Try again in a moment; if it persists, an admin should check the Qoyod accounting connection.","x-fix-ar":"أعد المحاولة بعد قليل، وإن تكرر فليتحقق مسؤول النظام من الربط مع محاسبة قيود."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Only draft deductions can be approved.","code":"validation_failed"}}}}}}},"/payroll/deductions/{id}/reject":{"patch":{"summary":"Reject a deduction","operationId":"deductions.reject","tags":["Deductions"],"description":"Rejects a draft deduction, with an optional reason. A rejected deduction is never taken from pay and stays\non file, read-only.\n\n**When to use:** to turn down a manager's proposal while keeping the record. To drop your own mistake,\n`deductions.delete` is simpler.\n\n**Prerequisites:** the deduction `id` from `deductions.list`; it must be `draft`. The token's owner must be\nan employee — the rejection is recorded in their name.\n\n**Side effects:** the manager who proposed it is emailed the rejection and the reason. Recorded in the\naudit log. Not offered to Claude: it decides money taken from an employee's pay.","x-summary-ar":"رفض استقطاع","x-description-ar":"يرفض استقطاعاً مسودة مع سبب اختياري. الاستقطاع المرفوض لا يُؤخذ من الراتب أبداً ويبقى في السجل للقراءة\nفقط.\n\n**متى تستخدمه:** لرفض اقتراح مدير مع إبقاء السجل. لإزالة خطأ منك `deductions.delete` أبسط.\n\n**المتطلبات:** رقم `id` الاستقطاع من `deductions.list`، ويجب أن يكون `draft`. ويجب أن يكون صاحب الرمز\nموظفاً — فالرفض يُسجَّل باسمه.\n\n**الآثار الجانبية:** يصل المديرَ المقترِح بريد بالرفض وسببه. يُسجَّل في سجل التدقيق. لا يُعرض على Claude:\nلأنه يحدد مالاً يُستقطع من راتب الموظف.","x-access":"write","x-permission":{"key":"deduction/approve","label":"Approve deductions","x-label-ar":"اعتماد الخصومات"},"x-feature":"deduction","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/deduction_id"}],"responses":{"200":{"description":"The rejected deduction.","x-description-ar":"الاستقطاع المرفوض.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"rejected","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":{"id":91,"full_name":"Huda Saleh"},"rejected_at":"2026-11-20T08:15:00Z","rejection_reason":"The late arrivals were excused by the department head."},"schema":{"$ref":"#/components/schemas/deduction"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The deduction cannot be rejected.","x-description-ar":"لا يمكن رفض الاستقطاع.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"Only a draft can be approved or rejected; this one was already decided.","x-meaning-ar":"لا يُعتمد أو يُرفض إلا المسودة، وهذا الاستقطاع حُسم أمره.","x-fix":"Read its `status` with `deductions.show`; nothing to do.","x-fix-ar":"اقرأ `status` عبر `deductions.show`؛ لا يلزم شيء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Why it is rejected; shown to the manager.","x-description-ar":"سبب الرفض؛ يظهر للمدير."}}},"example":{"reason":"The late arrivals were excused by the department head."}}},"required":true,"description":"The reason, optional."}}},"/payroll/employee_earnings/{id}":{"patch":{"summary":"Change a payslip line","operationId":"payslips.update_line","tags":["Payslips"],"description":"Changes the amount or the labels of one payslip line; the payslip's totals, net and loan and custody\nsettlement are recomputed.\n\n**When to use:** for a one-off correction this month (a wrong overtime figure). For a lasting change edit\nthe source instead — the salary, the bonus or the deduction — and recalculate.\n\n**Prerequisites:** the line `id` from `payslips.show` (`payslip.earnings[].id`). The run must not be\nfinalised.\n\n**Side effects:** the payslip and run totals change; `payslips.recalculate` would overwrite the edit.\nRecorded in the audit log. Not offered to Claude, because it changes what the employee is paid.","x-summary-ar":"تعديل بند في قسيمة راتب","x-description-ar":"يغيّر مبلغ بند واحد في القسيمة أو وصفه، وتُعاد حسبة إجماليات القسيمة وصافيها وتسوية السلف والعهد.\n\n**متى تستخدمه:** لتصحيح لمرة واحدة هذا الشهر (رقم عمل إضافي خاطئ). للتغيير الدائم عدّل المصدر — الراتب\nأو المكافأة أو الاستقطاع — ثم أعد الاحتساب.\n\n**المتطلبات:** رقم `id` البند من `payslips.show` (`payslip.earnings[].id`). يجب ألا يكون المسيّر معتمداً\nنهائياً.\n\n**الآثار الجانبية:** تتغير إجماليات القسيمة والمسيّر، وتلغي `payslips.recalculate` هذا التعديل. يُسجَّل في\nسجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف للموظف.","x-access":"write","x-permission":{"key":"payslip/edit","label":"Edit, delete and toggle payslip earnings","x-label-ar":"تعديل وحذف وتبديل مستحقات كشف الراتب"},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_earning_id"}],"responses":{"200":{"description":"The line after the change.","x-description-ar":"البند بعد التعديل.","content":{"application/json":{"example":{"employee_earning":{"id":90412,"earnable_type":"Benefit","earnable_id":311,"kind":"income","amount":"1650.0","applies":true,"flag":false,"description_en":"Housing allowance","description_ar":"بدل السكن","auto_deferred":false,"applies_overridden":false,"currency":"SAR"}},"schema":{"type":"object","properties":{"employee_earning":{"$ref":"#/components/schemas/employee_earning"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The line cannot be changed.","x-description-ar":"لا يمكن تعديل البند.","x-codes":[{"code":"validation_failed","meaning":"The payroll run is finalised; its payslips can no longer change.","x-meaning-ar":"المسيّر معتمد نهائياً، فلم تعد قسائمه قابلة للتعديل.","x-fix":"Nothing to fix here: correct it in next month's run (a bonus or a deduction).","x-fix-ar":"لا يمكن التعديل هنا: صحّح ذلك في مسيّر الشهر التالي (مكافأة أو استقطاع)."},{"code":"validation_failed","meaning":"The line is the employer's insurance share, which is never part of the employee's pay and cannot be changed.","x-meaning-ar":"البند هو حصة المنشأة من التأمينات، وهي ليست جزءاً من راتب الموظف ولا يمكن تعديلها.","x-fix":"Change the insurance itself (Insurance) if the share is wrong.","x-fix-ar":"عدّل التأمين نفسه (التأمينات) إن كانت الحصة خاطئة."},{"code":"custody_amount_locked","meaning":"The line is a custody installment, which is collected whole or not at all, so its amount cannot change.","x-meaning-ar":"البند قسط عهدة، والقسط يُحصَّل كاملاً أو لا يُحصَّل، فلا يمكن تغيير مبلغه.","x-fix":"Switch the line off with `payslips.toggle_line` to skip it this month.","x-fix-ar":"عطّل البند عبر `payslips.toggle_line` لتأجيله هذا الشهر."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A custody installment is deducted in full or not at all. Switch the line off to skip it this month instead of changing its amount.","code":"custody_amount_locked","error_code":"custody_amount_locked"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_earning"],"properties":{"employee_earning":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تعديلها فقط.","properties":{"amount":{"type":"string","description":"New amount, decimal string.","x-description-ar":"المبلغ الجديد، نص عشري."},"description_en":{"type":"string","description":"Label in English.","x-description-ar":"الوصف بالإنجليزية."},"description_ar":{"type":"string","description":"Label in Arabic.","x-description-ar":"الوصف بالعربية."}}}}},"example":{"employee_earning":{"amount":"1650.00"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a payslip line","operationId":"payslips.delete_line","tags":["Payslips"],"description":"Removes one line from a payslip and recomputes its totals, net and loan and custody settlement.\n\n**When to use:** to drop a line that should not be on this payslip at all. To skip it only this month\nand keep it visible, use `payslips.toggle_line`.\n\n**Prerequisites:** the line `id` from `payslips.show`. The run must not be finalised.\n\n**Side effects:** the line is gone (recalculating the payslip may bring it back from its source); the\npayslip and run totals change. Recorded in the audit log. Irreversible, so not offered to Claude.","x-summary-ar":"حذف بند من قسيمة راتب","x-description-ar":"يحذف بنداً واحداً من القسيمة ويعيد حساب إجمالياتها وصافيها وتسوية السلف والعهد.\n\n**متى تستخدمه:** لإزالة بند لا ينبغي أن يكون في هذه القسيمة أصلاً. لتأجيله هذا الشهر مع إبقائه ظاهراً\nاستخدم `payslips.toggle_line`.\n\n**المتطلبات:** رقم `id` البند من `payslips.show`. يجب ألا يكون المسيّر معتمداً نهائياً.\n\n**الآثار الجانبية:** يُحذف البند (وقد تعيده إعادة احتساب القسيمة من مصدره)، وتتغير إجماليات القسيمة\nوالمسيّر. يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"payslip/edit","label":"Edit, delete and toggle payslip earnings","x-label-ar":"تعديل وحذف وتبديل مستحقات كشف الراتب"},"x-feature":"payslip","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_earning_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The line cannot be deleted.","x-description-ar":"لا يمكن حذف البند.","x-codes":[{"code":"validation_failed","meaning":"The payroll run is finalised; its payslips can no longer change.","x-meaning-ar":"المسيّر معتمد نهائياً، فلم تعد قسائمه قابلة للتعديل.","x-fix":"Nothing to fix here: correct it in next month's run (a bonus or a deduction).","x-fix-ar":"لا يمكن التعديل هنا: صحّح ذلك في مسيّر الشهر التالي (مكافأة أو استقطاع)."},{"code":"validation_failed","meaning":"The line is the employer's insurance share, which is never part of the employee's pay and cannot be changed.","x-meaning-ar":"البند هو حصة المنشأة من التأمينات، وهي ليست جزءاً من راتب الموظف ولا يمكن تعديلها.","x-fix":"Change the insurance itself (Insurance) if the share is wrong.","x-fix-ar":"عدّل التأمين نفسه (التأمينات) إن كانت الحصة خاطئة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This payslip belongs to a finalized payroll run and its earnings can no longer be edited.","code":"validation_failed"}}}}}}},"/payroll/employee_earnings/{id}/toggle":{"patch":{"summary":"Switch a payslip line on or off","operationId":"payslips.toggle_line","tags":["Payslips"],"description":"Switches one payslip line off (it stays visible but no longer counts) or back on, and recomputes the\npayslip's totals and settlement. Each call flips the line.\n\n**When to use:** to skip an installment or a deduction this month — e.g. a loan installment the employee's\nnet cannot carry — without deleting it.\n\n**Prerequisites:** the line `id` from `payslips.show`. The run must not be finalised.\n\n**Side effects:** the line is marked as set by hand, so QHR's automatic deferral no longer touches it;\na skipped loan or custody installment stays owed. Totals change; recorded in the audit log. Not offered to\nClaude, because it changes what the employee is paid.","x-summary-ar":"تفعيل بند في قسيمة راتب أو تعطيله","x-description-ar":"يعطّل بنداً في القسيمة (يبقى ظاهراً لكنه لا يُحتسب) أو يعيد تفعيله، ويعيد حساب إجماليات القسيمة والتسوية.\nكل استدعاء يعكس حالة البند.\n\n**متى تستخدمه:** لتأجيل قسط أو استقطاع هذا الشهر — مثل قسط سلفة لا يكفي له صافي الراتب — دون حذفه.\n\n**المتطلبات:** رقم `id` البند من `payslips.show`. يجب ألا يكون المسيّر معتمداً نهائياً.\n\n**الآثار الجانبية:** يُعلَّم البند بأنه مضبوط يدوياً فلا يمسه الترحيل التلقائي بعد ذلك، ويبقى قسط السلفة أو\nالعهدة المؤجل مستحقاً. تتغير الإجماليات ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف\nللموظف.","x-access":"write","x-permission":{"key":"payslip/edit","label":"Edit, delete and toggle payslip earnings","x-label-ar":"تعديل وحذف وتبديل مستحقات كشف الراتب"},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_earning_id"}],"responses":{"200":{"description":"The line after the switch.","x-description-ar":"البند بعد التبديل.","content":{"application/json":{"example":{"employee_earning":{"id":90412,"earnable_type":"Benefit","earnable_id":311,"kind":"income","amount":"1500.0","applies":false,"flag":false,"description_en":"Housing allowance","description_ar":"بدل السكن","auto_deferred":false,"applies_overridden":true,"currency":"SAR"}},"schema":{"type":"object","properties":{"employee_earning":{"$ref":"#/components/schemas/employee_earning"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The line cannot be switched.","x-description-ar":"لا يمكن تبديل البند.","x-codes":[{"code":"validation_failed","meaning":"The payroll run is finalised; its payslips can no longer change.","x-meaning-ar":"المسيّر معتمد نهائياً، فلم تعد قسائمه قابلة للتعديل.","x-fix":"Nothing to fix here: correct it in next month's run (a bonus or a deduction).","x-fix-ar":"لا يمكن التعديل هنا: صحّح ذلك في مسيّر الشهر التالي (مكافأة أو استقطاع)."},{"code":"validation_failed","meaning":"The line is the employer's insurance share, which is never part of the employee's pay and cannot be changed.","x-meaning-ar":"البند هو حصة المنشأة من التأمينات، وهي ليست جزءاً من راتب الموظف ولا يمكن تعديلها.","x-fix":"Change the insurance itself (Insurance) if the share is wrong.","x-fix-ar":"عدّل التأمين نفسه (التأمينات) إن كانت الحصة خاطئة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The employer's insurance share is a company cost, not an employee deduction, and cannot be edited, deleted, or toggled.","code":"validation_failed"}}}}}}},"/payroll/employee_payments":{"get":{"summary":"List payments to and from employees","operationId":"payments.list","tags":["Payments"],"description":"Returns the payments recorded for employees — salaries paid, loan disbursements and end-of-service payouts\n(`paid`), and repayments received back (`received`) — with how much of each is already applied\n(`allocated`) and how much is left (`unallocated`).\n\n**When to use:** to answer \"what did we pay Sara this year?\" or to find a payment's `id`.\n\n**Prerequisites:** none. `q[employee_id_eq]` takes an id from `employees.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض المدفوعات للموظفين ومنهم","x-description-ar":"يعرض المدفوعات المسجّلة للموظفين — الرواتب المصروفة وصرف السلف ومستحقات نهاية الخدمة (`paid`) والمبالغ\nالمستردة منهم (`received`) — مع ما خُصص من كل دفعة (`allocated`) وما تبقى منها (`unallocated`).\n\n**متى تستخدمه:** للإجابة عن «كم دفعنا لسارة هذا العام؟» أو لمعرفة رقم `id` دفعة.\n\n**المتطلبات:** لا شيء. `q[employee_id_eq]` يأخذ رقماً من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"payment/view","label":"View employee payments and allocations","x-label-ar":"عرض مدفوعات الموظفين وتخصيصاتها"},"x-feature":"payment","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee.","x-description-ar":"هذا الموظف فقط.","example":1203},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["paid","received"]},"description":"Only paid or only received.","x-description-ar":"المدفوعة فقط أو المستلمة فقط.","example":"paid"},{"name":"q[reference_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference contains.","x-description-ar":"المرجع يحتوي على.","example":"EPY-09"},{"name":"q[date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Dated on or after.","x-description-ar":"بتاريخ في هذا اليوم أو بعده.","example":"2026-01-01"},{"name":"q[date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Dated on or before.","x-description-ar":"بتاريخ في هذا اليوم أو قبله.","example":"2026-12-31"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of payments.","x-description-ar":"صفحة من المدفوعات.","content":{"application/json":{"example":{"records":[{"id":910,"reference":"EPY-0910","employee_id":1203,"employee_name":"Sara Ahmed","kind":"paid","date":"2026-10-27","amount":"9555.00","allocated":"9555.00","unallocated":"0.00","currency":"SAR","account_ref":"SNB-001","description":"October salary","created_at":"2026-10-27T07:00:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/employee_payment"},"description":"The payments.","x-description-ar":"المدفوعات."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Record a payment to or from an employee","operationId":"payments.create","tags":["Payments"],"description":"Records money transferred to an employee (`paid`) or received back from them (`received`). The payment\nsettles nothing until it is applied with `allocations.create`.\n\n**When to use:** to record a salary transfer made outside a payroll run's \"pay all\", or money an employee\npaid back, so it can be applied to what it settles. In a company where accounting approves payroll in Qoyod,\npayments are created by that approval and this answers 422.\n\n**Prerequisites:** `employee_id` from `employees.list`.\n\n**Side effects:** a payment with a new reference (`EPY-0910`); recorded in the audit log. Not offered to Claude,\nbecause it records where company money went.","x-summary-ar":"تسجيل دفعة للموظف أو منه","x-description-ar":"يسجل مبلغاً حُوِّل إلى الموظف (`paid`) أو استُلم منه (`received`). لا تسدد الدفعة شيئاً حتى تُخصَّص عبر\n`allocations.create`.\n\n**متى تستخدمه:** لتسجيل تحويل راتب تم خارج «صرف الكل» في المسيّر، أو مبلغ أعاده الموظف، ليُخصَّص لما يسدده. في\nالشركة التي تعتمد المحاسبة رواتبها في قيود تُنشأ المدفوعات عند ذلك الاعتماد ويُرجع هذا 422.\n\n**المتطلبات:** `employee_id` من `employees.list`.\n\n**الآثار الجانبية:** دفعة بمرجع جديد (`EPY-0910`)، وتُسجَّل في سجل التدقيق. لا تُعرض على Claude لأنها تسجل أين\nذهبت أموال الشركة.","x-access":"write","x-permission":{"key":"payment/create","label":"Record payments and allocate them","x-label-ar":"تسجيل المدفوعات وتخصيصها"},"x-feature":"payment","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The payment.","x-description-ar":"الدفعة.","content":{"application/json":{"example":{"employee_payment":{"id":910,"reference":"EPY-0910","employee_id":1203,"employee_name":"Sara Ahmed","kind":"paid","date":"2026-10-27","amount":"9555.00","allocated":"0.00","unallocated":"9555.00","currency":"SAR","account_ref":"SNB-001","description":"October salary","created_at":"2026-10-27T07:00:00Z"}},"schema":{"type":"object","properties":{"employee_payment":{"$ref":"#/components/schemas/employee_payment"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The payment cannot be recorded.","x-description-ar":"لا يمكن تسجيل الدفعة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"not_available_in_approval_mode","meaning":"The company is connected to Qoyod accounting with approval on, so payments are created only when accounting approves the run.","x-meaning-ar":"الشركة مرتبطة بمحاسبة قيود مع تفعيل الاعتماد، فلا تُنشأ المدفوعات إلا عند موافقة المحاسبة على المسيّر.","x-fix":"Let the accountant approve the payroll run in Qoyod; the payments follow.","x-fix-ar":"دع المحاسب يوافق على المسيّر في قيود، وستُنشأ المدفوعات تبعاً لذلك."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Payments are created when accounting approves this run.","code":"not_available_in_approval_mode","error_code":"not_available_in_approval_mode"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_payment"],"properties":{"employee_payment":{"type":"object","required":["employee_id","date","amount","kind"],"description":"The payment's fields.","x-description-ar":"حقول الدفعة.","properties":{"employee_id":{"type":"integer","description":"The employee, from `employees.list`.","x-description-ar":"الموظف، من `employees.list`."},"kind":{"type":"string","description":"`paid` or `received`.","x-description-ar":"`paid` مدفوعة أو `received` مستلمة.","enum":["paid","received"]},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date"},"amount":{"type":"string","description":"Amount, more than zero.","x-description-ar":"المبلغ، أكبر من صفر."},"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر."},"account_ref":{"type":"string","description":"Bank or cash account reference.","x-description-ar":"مرجع الحساب البنكي أو النقدي."}}}}},"example":{"employee_payment":{"employee_id":1203,"kind":"paid","date":"2026-10-27","amount":"9555.00","description":"October salary","account_ref":"SNB-001"}}}},"required":true,"description":"The payment."}}},"/payroll/employee_payments/export":{"get":{"summary":"Export payments to Excel or CSV","operationId":"payments.export","tags":["Payments"],"description":"Builds a file of the payments to and from employees, one row per payment, with the columns you choose\n(reference, employee, kind, date, currency, amount, allocated, unallocated…) and a totals row per currency.\nIt takes the same filters as `payments.list`, so the file matches what the list shows.\n\n**When to use:** to reconcile transfers with the bank or hand them to finance. To read figures,\n`payments.list` is lighter.\n\n**Prerequisites:** column keys from `payments.export_columns`. You need \"Export payroll data\" as well as\n\"View payments\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير المدفوعات إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بالمدفوعات للموظفين ومنهم، صفاً لكل دفعة، بالأعمدة التي تختارها (المرجع والموظف والنوع والتاريخ\nوالعملة والمبلغ والمخصص وغير المخصص…) مع صف إجماليات لكل عملة. يقبل مرشحات `payments.list` نفسها، فيطابق\nالملف ما تعرضه القائمة.\n\n**متى تستخدمه:** لمطابقة التحويلات مع البنك أو تسليمها إلى المالية. لقراءة الأرقام فقط `payments.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `payments.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض\nالمدفوعات» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payment/view","label":"View employee payments and allocations","x-label-ar":"عرض مدفوعات الموظفين وتخصيصاتها"}]},"x-feature":"payment","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["paid","received"]},"description":"Only paid or only received.","x-description-ar":"المدفوعة فقط أو المستلمة فقط.","example":"paid"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee, from `employees.list`.","x-description-ar":"هذا الموظف فقط، من `employees.list`.","example":1203}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/payroll/employee_payments/export/columns":{"get":{"summary":"List the columns a payments export can have","operationId":"payments.export_columns","tags":["Payments"],"description":"Returns the columns of the payments export that your role may see, in screen order, with their header in the\nrequested language and whether QHR ticks them by default.\n\n**When to use:** before `payments.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View payments\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير المدفوعات","x-description-ar":"يعرض أعمدة تصدير المدفوعات التي يحق لدورك رؤيتها بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب وهل يحدده QHR\nافتراضياً.\n\n**متى تستخدمه:** قبل `payments.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض المدفوعات».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payment/view","label":"View employee payments and allocations","x-label-ar":"عرض مدفوعات الموظفين وتخصيصاتها"}]},"x-feature":"payment","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"kind","label":"Kind","default":true,"type":"enum"},{"key":"amount","label":"Amount","default":true,"type":"money"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/employee_payments/{id}":{"get":{"summary":"Get a payment with what it settles","operationId":"payments.show","tags":["Payments"],"description":"Returns one payment with its allocations: each payslip, bonus or deduction it settles, the amount applied and\na readable label (`2026-10 — Sara Ahmed`).\n\n**When to use:** to answer \"which payslips did this transfer pay?\" or before `allocations.delete`.\n\n**Prerequisites:** the payment `id` from `payments.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض دفعة مع ما تسدده","x-description-ar":"يعرض دفعة واحدة مع تخصيصاتها: كل قسيمة أو مكافأة أو استقطاع تسدده، والمبلغ المخصص، ووصفاً مقروءاً\n(`2026-10 — Sara Ahmed`).\n\n**متى تستخدمه:** للإجابة عن «أي القسائم سدّدها هذا التحويل؟» أو قبل `allocations.delete`.\n\n**المتطلبات:** رقم `id` الدفعة من `payments.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payment/view","label":"View employee payments and allocations","x-label-ar":"عرض مدفوعات الموظفين وتخصيصاتها"},"x-feature":"payment","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_payment_id"}],"responses":{"200":{"description":"The payment.","x-description-ar":"الدفعة.","content":{"application/json":{"example":{"employee_payment":{"id":910,"reference":"EPY-0910","employee_id":1203,"employee_name":"Sara Ahmed","kind":"paid","date":"2026-10-27","amount":"9555.00","allocated":"9555.00","unallocated":"0.00","currency":"SAR","account_ref":"SNB-001","description":"October salary","created_at":"2026-10-27T07:00:00Z","allocations":[{"id":3301,"source_id":910,"source_type":"EmployeePayment","allocatee_id":5120,"allocatee_type":"Payslip","amount":"9555.00","date":"2026-10-27","currency":"SAR","allocatee_label":"2026-10 — Sara Ahmed"}]}},"schema":{"type":"object","properties":{"employee_payment":{"$ref":"#/components/schemas/employee_payment_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a payment","operationId":"payments.update","tags":["Payments"],"description":"Changes a payment's date, amount, description or account reference. The employee and the direction (`kind`)\ncannot change. The amount cannot drop below what is already allocated. Unlike `payments.create`, this is\nnot blocked in a company where accounting approves payroll in Qoyod: it still changes the amount and date\nof a payment that approval created, so correct such payments in Qoyod instead.\n\n**When to use:** to correct a mistyped payment.\n\n**Prerequisites:** the payment `id` from `payments.list`.\n\n**Side effects:** recorded in the audit log. Not offered to Claude, because it changes the record of company\nmoney paid.","x-summary-ar":"تعديل دفعة","x-description-ar":"يغيّر تاريخ الدفعة أو مبلغها أو وصفها أو مرجع الحساب. لا يتغير الموظف ولا الاتجاه (`kind`)، ولا يقل المبلغ عن\nالمخصص منه. وبخلاف `payments.create` لا يُمنع هذا في الشركة التي تعتمد المحاسبة رواتبها في قيود: فهو يغيّر\nمبلغ وتاريخ الدفعة التي أنشأها ذلك الاعتماد، لذا صحّح مثل هذه الدفعات في قيود بدلاً من ذلك.\n\n**متى تستخدمه:** لتصحيح دفعة أُدخلت خطأً.\n\n**المتطلبات:** رقم `id` الدفعة من `payments.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر سجل أموال الشركة المدفوعة.","x-access":"write","x-permission":{"key":"payment/edit","label":"Edit employee payments","x-label-ar":"تعديل مدفوعات الموظفين"},"x-feature":"payment","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_payment_id"}],"responses":{"200":{"description":"The payment after the change.","x-description-ar":"الدفعة بعد التعديل.","content":{"application/json":{"example":{"employee_payment":{"id":910,"reference":"EPY-0910","employee_id":1203,"employee_name":"Sara Ahmed","kind":"paid","date":"2026-10-27","amount":"9555.00","allocated":"9555.00","unallocated":"0.00","currency":"SAR","account_ref":"SNB-002","description":"October salary","created_at":"2026-10-27T07:00:00Z"}},"schema":{"type":"object","properties":{"employee_payment":{"$ref":"#/components/schemas/employee_payment"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_payment"],"properties":{"employee_payment":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تعديلها فقط.","properties":{"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date"},"amount":{"type":"string","description":"Amount, not below what is allocated.","x-description-ar":"المبلغ، لا يقل عن المخصص."},"description":{"type":"string","description":"Description.","x-description-ar":"الوصف."},"account_ref":{"type":"string","description":"Account reference.","x-description-ar":"مرجع الحساب."}}}}},"example":{"employee_payment":{"account_ref":"SNB-002"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a payment","operationId":"payments.delete","tags":["Payments"],"description":"Removes a payment and its allocations. Whatever it settled is open again: the payslips, bonuses and deductions\nbecome unpaid or partly paid, and loan installments collected through those payslips are no longer repaid.\n\n**When to use:** to undo a payment recorded by mistake.\n\n**Prerequisites:** the payment `id` from `payments.list`.\n\n**Side effects:** as above; recorded in the audit log. Refused when a payslip it paid collected custody that an\nend-of-service package or a settlement has already closed. Irreversible, so not offered to Claude.","x-summary-ar":"حذف دفعة","x-description-ar":"يحذف الدفعة وتخصيصاتها، فيعود ما سددته مفتوحاً: تصبح القسائم والمكافآت والاستقطاعات غير مصروفة أو مصروفة جزئياً،\nولا تعود أقساط السلف المحصّلة عبر تلك القسائم مسددة.\n\n**متى تستخدمه:** للتراجع عن دفعة سُجّلت خطأً.\n\n**المتطلبات:** رقم `id` الدفعة من `payments.list`.\n\n**الآثار الجانبية:** ما سبق، ويُسجَّل في سجل التدقيق. يُرفض إذا كانت قسيمة سددتها قد حصّلت عهدة أغلقتها تسوية\nنهاية خدمة أو تسوية سابقة. لا يمكن التراجع عنه، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"payment/delete","label":"Delete payments and remove allocations","x-label-ar":"حذف المدفوعات وإزالة التخصيصات"},"x-feature":"payment","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/employee_payment_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The payment cannot be deleted.","x-description-ar":"لا يمكن حذف الدفعة.","x-codes":[{"code":"custody_balance_frozen","meaning":"A payslip this money paid collected custody installments that an end-of-service package or a settlement has already closed; removing it would leave that money unrecovered.","x-meaning-ar":"قسيمة سددها هذا المبلغ حصّلت أقساط عهدة أغلقتها تسوية نهاية خدمة أو تسوية سابقة، وحذفه يترك ذلك المبلغ دون استرداد.","x-fix":"Leave the payment; correct the custody settlement instead.","x-fix-ar":"أبقِ الدفعة، وصحّح تسوية العهدة بدلاً من ذلك."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This payment cannot be removed: it collected custody installments of CUS-0007, whose remaining balance a termination package or a settlement has already closed. Removing it would leave that money unrecovered","code":"custody_balance_frozen","error_code":"custody_balance_frozen"}}}}}}},"/payroll/insurances":{"get":{"summary":"List insurance plans","operationId":"insurances.list","tags":["Insurance"],"description":"Returns the company's insurance plans, alphabetically by English name, with the employee's and the\ncompany's percentage of each.\n\n**When to use:** to answer \"how much GOSI do we deduct?\" or to find the `insurance_id` for\n`salaries.enrol_insurance`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض خطط التأمين","x-description-ar":"يعرض خطط التأمين في الشركة مرتبة أبجدياً بالاسم الإنجليزي، مع نسبة الموظف ونسبة الشركة في كل خطة.\n\n**متى تستخدمه:** للإجابة عن «كم نستقطع للتأمينات الاجتماعية؟» أو لمعرفة `insurance_id` المطلوب في\n`salaries.enrol_insurance`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"insurance/view","label":"View insurance plans","x-label-ar":"عرض خطط التأمين"},"x-feature":"insurance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of plans.","x-description-ar":"صفحة من الخطط.","content":{"application/json":{"example":{"records":[{"id":1,"reference":"INS-0001","name_en":"GOSI (Saudi)","name_ar":"التأمينات الاجتماعية (سعودي)","employee_share":"9.75","company_share":"11.75","company_liability_account_ref":null,"company_expense_account_ref":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/insurance"},"description":"The plans, by English name.","x-description-ar":"الخطط حسب الاسم الإنجليزي."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add an insurance plan","operationId":"insurances.create","tags":["Insurance"],"description":"Adds an insurance plan with the percentage deducted from the employee and the percentage the company pays.\nQHR gives it the next reference (`INS-0002`…).\n\n**When to use:** when the company starts a new scheme (a medical plan, a GOSI rate for a new category).\n\n**Prerequisites:** none. Check the existing plans with `insurances.list`.\n\n**Side effects:** none on pay until a salary is enrolled with `salaries.enrol_insurance`. Recorded in the\naudit log. Not offered to Claude, as company payroll setup.","x-summary-ar":"إضافة خطة تأمين","x-description-ar":"يضيف خطة تأمين بالنسبة المستقطعة من الموظف والنسبة التي تدفعها الشركة. يعطيها QHR المرجع التالي\n(`INS-0002`…).\n\n**متى تستخدمه:** عندما تبدأ الشركة نظاماً جديداً (تأمين طبي، أو نسبة تأمينات لفئة جديدة).\n\n**المتطلبات:** لا شيء. راجع الخطط الحالية عبر `insurances.list`.\n\n**الآثار الجانبية:** لا أثر على الرواتب حتى يُشترك راتب في الخطة عبر `salaries.enrol_insurance`. يُسجَّل في\nسجل التدقيق. لا يُعرض على Claude لأنه من إعدادات الرواتب.","x-access":"write","x-permission":{"key":"insurance/create","label":"Add an insurance plan","x-label-ar":"إضافة خطة تأمين"},"x-feature":"insurance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new plan.","x-description-ar":"الخطة الجديدة.","content":{"application/json":{"example":{"insurance":{"id":2,"reference":"INS-0002","name_en":"Medical (Class A)","name_ar":"التأمين الطبي (الفئة أ)","employee_share":"0.0","company_share":"4.5","company_liability_account_ref":null,"company_expense_account_ref":null}},"schema":{"type":"object","properties":{"insurance":{"$ref":"#/components/schemas/insurance"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The plan was refused.","x-description-ar":"رُفضت الخطة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Employee share must be greater than or equal to 0","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["insurance"],"properties":{"insurance":{"allOf":[{"$ref":"#/components/schemas/insurance_input"}],"required":["employee_share","company_share"],"description":"The plan's fields.","x-description-ar":"حقول الخطة."}}},"example":{"insurance":{"name_en":"Medical (Class A)","name_ar":"التأمين الطبي (الفئة أ)","employee_share":"0","company_share":"4.5"}}}},"required":true,"description":"The plan."}}},"/payroll/insurances/{id}":{"get":{"summary":"Get an insurance plan","operationId":"insurances.show","tags":["Insurance"],"description":"Returns one insurance plan: its names, reference, the employee's and company's percentages, and its\naccounting references.\n\n**When to use:** before `insurances.update`, or to explain an insurance line on a payslip.\n\n**Prerequisites:** the plan `id` from `insurances.list` (or `insurance_id` on a salary's enrolment).\n\n**Side effects:** none.","x-summary-ar":"عرض خطة تأمين","x-description-ar":"يعرض خطة تأمين واحدة: أسماءها ومرجعها ونسبتي الموظف والشركة ومراجعها المحاسبية.\n\n**متى تستخدمه:** قبل `insurances.update`، أو لشرح بند تأمين في قسيمة راتب.\n\n**المتطلبات:** رقم `id` الخطة من `insurances.list` (أو `insurance_id` في اشتراك الراتب).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"insurance/view","label":"View insurance plans","x-label-ar":"عرض خطط التأمين"},"x-feature":"insurance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/insurance_id"}],"responses":{"200":{"description":"The plan.","x-description-ar":"الخطة.","content":{"application/json":{"example":{"insurance":{"id":1,"reference":"INS-0001","name_en":"GOSI (Saudi)","name_ar":"التأمينات الاجتماعية (سعودي)","employee_share":"9.75","company_share":"11.75","company_liability_account_ref":null,"company_expense_account_ref":null}},"schema":{"type":"object","properties":{"insurance":{"$ref":"#/components/schemas/insurance"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change an insurance plan","operationId":"insurances.update","tags":["Insurance"],"description":"Changes the fields you send on an insurance plan — names, percentages or accounting references.\n\n**When to use:** when a rate changes (a new GOSI percentage) or to correct a name.\n\n**Prerequisites:** the plan `id` from `insurances.list`.\n\n**Side effects:** a new percentage applies to every employee enrolled in the plan from the next payroll\ncalculation; finalised payslips keep their figures. Recorded in the audit log. Not offered to Claude,\nbecause it changes what employees are paid.","x-summary-ar":"تعديل خطة تأمين","x-description-ar":"يعدّل الحقول التي ترسلها في خطة التأمين — الأسماء أو النسب أو المراجع المحاسبية.\n\n**متى تستخدمه:** عند تغيّر النسبة (نسبة تأمينات جديدة) أو لتصحيح اسم.\n\n**المتطلبات:** رقم `id` الخطة من `insurances.list`.\n\n**الآثار الجانبية:** تُطبَّق النسبة الجديدة على كل موظف مشترك في الخطة من الاحتساب التالي للرواتب، وتحتفظ القسائم\nالمعتمدة بأرقامها. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف للموظفين.","x-access":"write","x-permission":{"key":"insurance/edit","label":"Edit an insurance plan","x-label-ar":"تعديل خطة تأمين"},"x-feature":"insurance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/insurance_id"}],"responses":{"200":{"description":"The plan after the change.","x-description-ar":"الخطة بعد التعديل.","content":{"application/json":{"example":{"insurance":{"id":1,"reference":"INS-0001","name_en":"GOSI (Saudi)","name_ar":"التأمينات الاجتماعية (سعودي)","employee_share":"10.0","company_share":"11.75","company_liability_account_ref":null,"company_expense_account_ref":null}},"schema":{"type":"object","properties":{"insurance":{"$ref":"#/components/schemas/insurance"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Company share must be greater than or equal to 0","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["insurance"],"properties":{"insurance":{"$ref":"#/components/schemas/insurance_input"}}},"example":{"insurance":{"employee_share":"10.0"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete an insurance plan","operationId":"insurances.delete","tags":["Insurance"],"description":"Deletes an insurance plan that no salary is enrolled in. A plan with enrolments is refused (422); remove\nthem first with `salaries.remove_insurance`.\n\n**When to use:** to retire a plan the company no longer offers.\n\n**Prerequisites:** the plan `id` from `insurances.list`.\n\n**Side effects:** the plan disappears from the lists; payslips already calculated keep their insurance\nlines. Recorded in the audit log. Not offered to Claude, because it cannot be undone from the API.","x-summary-ar":"حذف خطة تأمين","x-description-ar":"يحذف خطة تأمين لا يشترك فيها أي راتب. تُرفض الخطة التي عليها اشتراكات (422)؛ احذفها أولاً عبر\n`salaries.remove_insurance`.\n\n**متى تستخدمه:** لإيقاف خطة لم تعد الشركة تقدمها.\n\n**المتطلبات:** رقم `id` الخطة من `insurances.list`.\n\n**الآثار الجانبية:** تختفي الخطة من القوائم، وتحتفظ القسائم المحتسبة ببنود التأمين. يُسجَّل في سجل التدقيق. لا\nيُعرض على Claude لأنه لا يمكن التراجع عنه من الواجهة.","x-access":"write","x-permission":{"key":"insurance/delete","label":"Remove an insurance plan","x-label-ar":"حذف خطة تأمين"},"x-feature":"insurance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/insurance_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The plan is in use.","x-description-ar":"الخطة مستخدمة.","x-codes":[{"code":"validation_failed","meaning":"Salaries are still enrolled in the plan.","x-meaning-ar":"ما زالت رواتب مشتركة في الخطة.","x-fix":"Remove the enrolments with `salaries.remove_insurance`, then delete.","x-fix-ar":"احذف الاشتراكات عبر `salaries.remove_insurance` ثم احذف الخطة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot delete record because dependent insurance deductions exist","code":"validation_failed"}}}}}}},"/payroll/locations":{"get":{"summary":"List work locations","operationId":"locations.list","tags":["Locations"],"description":"Returns the company's work locations, newest first, each with its geo-fence and how many employed\nemployees are assigned to it (main and additional). Inactive locations are included; filter with\n`q[is_active_eq]`.\n\n**When to use:** to answer \"which sites do we have and who is where?\", or to find a `location_id` for an\nemployee or a payroll run. For the counts alone use `locations.stat_cards`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مواقع العمل","x-description-ar":"يعرض مواقع العمل في الشركة، الأحدث أولاً، مع السياج الجغرافي لكل موقع وعدد الموظفين على رأس العمل المعيّنين\nعليه (رئيسي وإضافي). تشمل القائمة المواقع غير النشطة؛ صفِّ بـ `q[is_active_eq]`.\n\n**متى تستخدمه:** للإجابة عن «ما مواقعنا ومن في كل موقع؟»، أو لمعرفة `location_id` لموظف أو لمسيّر رواتب.\nللأعداد فقط استخدم `locations.stat_cards`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"location/view","label":"View locations","x-label-ar":"عرض المواقع"},"x-feature":"location","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/location_filter_name_cont"},{"$ref":"#/components/parameters/location_filter_is_active_eq"},{"$ref":"#/components/parameters/location_filter_geo_fenced"},{"$ref":"#/components/parameters/location_filter_fence_type"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of locations.","x-description-ar":"صفحة من المواقع.","content":{"application/json":{"example":{"records":[{"id":2,"name_en":"Riyadh HQ","name_ar":"المقر الرئيسي - الرياض","name":"Riyadh HQ","is_active":true,"employees_count":31,"primary_employees_count":28,"additional_employees_count":3,"geo_fencing":{"enabled":true,"latitude":24.7135517,"longitude":46.6752957,"radius_meters":200,"allowed_ips":["91.72.10.0/24"],"enforce_on_check_out":false}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/location"},"description":"The locations.","x-description-ar":"المواقع."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Add a work location","operationId":"locations.create","tags":["Locations"],"description":"Adds a work location with its names and, optionally, a geo-fence: a map pin with a radius, office network\naddresses, or both. With `geo_fencing_enabled: true`, employees assigned to it can only check in inside\nthe fence.\n\n**When to use:** when the company opens a site.\n\n**Prerequisites:** none. Names must be unique; the pin needs latitude, longitude and radius together.\n\n**Side effects:** none until employees are assigned (`employees.update`). Recorded in the audit log. Not\noffered to Claude: it decides where people may record attendance.","x-summary-ar":"إضافة موقع عمل","x-description-ar":"يضيف موقع عمل باسميه، واختيارياً سياجاً جغرافياً: نقطة على الخريطة مع نطاق، أو عناوين شبكات المكتب، أو كليهما.\nمع `geo_fencing_enabled: true` لا يستطيع الموظفون المعيّنون عليه تسجيل الحضور إلا داخل السياج.\n\n**متى تستخدمه:** عند افتتاح الشركة موقعاً جديداً.\n\n**المتطلبات:** لا شيء. يجب أن يكون الاسمان فريدين، وأن تُرسل النقطة بخط العرض والطول والنطاق معاً.\n\n**الآثار الجانبية:** لا شيء حتى يُعيَّن عليه موظفون (`employees.update`). يُسجَّل في سجل التدقيق. لا يُعرض على\nClaude لأنه يحدد أين يستطيع الموظفون تسجيل حضورهم.","x-access":"write","x-permission":{"key":"location/create","label":"Add a location","x-label-ar":"إضافة موقع"},"x-feature":"location","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new location.","x-description-ar":"الموقع الجديد.","content":{"application/json":{"example":{"id":5,"name_en":"Jeddah Branch","name_ar":"فرع جدة","name":"Jeddah Branch","is_active":true,"employees_count":0,"primary_employees_count":0,"additional_employees_count":0,"geo_fencing":{"enabled":true,"latitude":21.4858,"longitude":39.1925,"radius_meters":150,"allowed_ips":[],"enforce_on_check_out":false}},"schema":{"$ref":"#/components/schemas/location"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The location was refused.","x-description-ar":"رُفض الموقع.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Geo-fencing needs latitude, longitude and radius together, or none of them.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["location"],"properties":{"location":{"allOf":[{"$ref":"#/components/schemas/location_input"}],"required":["name_en","name_ar"],"description":"The location's fields.","x-description-ar":"حقول الموقع."}}},"example":{"location":{"name_en":"Jeddah Branch","name_ar":"فرع جدة","is_active":true,"geo_fencing_enabled":true,"latitude":21.4858,"longitude":39.1925,"radius_meters":150}}}},"required":true,"description":"The location."}}},"/payroll/locations/inactive_with_employees":{"get":{"summary":"List inactive locations that still have employees","operationId":"locations.inactive_with_employees","tags":["Locations"],"description":"Returns every inactive location that still has employed employees assigned (as main or additional\nlocation), with the total and up to 10 of them by name. Until they are moved, those employees can check in\nfrom anywhere and are recorded as remote.\n\n**When to use:** to find who must be moved after switching a site off.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض المواقع غير النشطة التي ما زال عليها موظفون","x-description-ar":"يعرض كل موقع غير نشط ما زال عليه موظفون على رأس العمل (كموقع رئيسي أو إضافي)، مع عددهم وحتى ١٠ منهم بالاسم.\nإلى أن يُنقلوا، يستطيع هؤلاء تسجيل الحضور من أي مكان ويُسجَّلون عن بُعد.\n\n**متى تستخدمه:** لمعرفة من يجب نقله بعد إيقاف موقع.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"location/view","label":"View locations","x-label-ar":"عرض المواقع"},"x-feature":"location","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Inactive locations with employees.","x-description-ar":"المواقع غير النشطة التي عليها موظفون.","content":{"application/json":{"example":{"data":[{"id":7,"name":"Dammam Office","employees_total":2,"employees":[{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","assignment":"primary"},{"id":1210,"employee_no":"E-0049","name":"Omar Ali","assignment":"additional"}]}]},"schema":{"type":"object","properties":{"data":{"type":"array","description":"One entry per location.","x-description-ar":"مدخل لكل موقع.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Location id.","x-description-ar":"رقم الموقع."},"name":{"type":"string","description":"Location name.","x-description-ar":"اسم الموقع."},"employees_total":{"type":"integer","description":"Employed employees still assigned.","x-description-ar":"الموظفون على رأس العمل الذين ما زالوا معيّنين."},"employees":{"type":"array","description":"Up to 10, by name.","x-description-ar":"حتى ١٠ مرتبين بالاسم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"assignment":{"type":"string","description":"`primary` or `additional`.","x-description-ar":"`primary` رئيسي أو `additional` إضافي."}}}}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/locations/stat_cards":{"get":{"summary":"Count work locations by status and fence","operationId":"locations.stat_cards","tags":["Locations"],"description":"Returns how many locations there are — active and inactive, with and without a geo-fence in force, and\nfenced by map pin or by office network — over the same filters as `locations.list`. A location fenced both\nways counts in both `geo_fenced_map` and `geo_fenced_ip`.\n\n**When to use:** for \"how many of our sites enforce geo-fencing?\" without paging through the list.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عدّ مواقع العمل حسب الحالة والسياج","x-description-ar":"يعرض عدد المواقع — النشطة وغير النشطة، والتي سياجها مفعّل والتي بلا سياج، والمسيّجة بنقطة خريطة أو بشبكة مكتب —\nبالمرشحات نفسها التي تقبلها `locations.list`. الموقع المسيّج بالطريقتين يُعدّ في `geo_fenced_map` و`geo_fenced_ip`\nمعاً.\n\n**متى تستخدمه:** لمعرفة «كم من مواقعنا يطبّق السياج الجغرافي؟» دون تصفح القائمة.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"location/view","label":"View locations","x-label-ar":"عرض المواقع"},"x-feature":"location","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/location_filter_name_cont"},{"$ref":"#/components/parameters/location_filter_is_active_eq"},{"$ref":"#/components/parameters/location_filter_geo_fenced"},{"$ref":"#/components/parameters/location_filter_fence_type"}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"data":{"total":4,"active":3,"inactive":1,"geo_fenced":2,"not_geo_fenced":2,"geo_fenced_map":2,"geo_fenced_ip":1}},"schema":{"type":"object","properties":{"data":{"type":"object","description":"Counts over the filtered locations.","x-description-ar":"الأعداد على المواقع بعد التصفية.","properties":{"total":{"type":"integer","description":"All locations.","x-description-ar":"كل المواقع."},"active":{"type":"integer","description":"Active.","x-description-ar":"النشطة."},"inactive":{"type":"integer","description":"Inactive.","x-description-ar":"غير النشطة."},"geo_fenced":{"type":"integer","description":"Fence in force.","x-description-ar":"سياجها مفعّل."},"not_geo_fenced":{"type":"integer","description":"No fence in force.","x-description-ar":"بلا سياج مفعّل."},"geo_fenced_map":{"type":"integer","description":"Fenced by a map pin.","x-description-ar":"مسيّجة بنقطة خريطة."},"geo_fenced_ip":{"type":"integer","description":"Fenced by an office network.","x-description-ar":"مسيّجة بشبكة مكتب."}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/locations/{id}":{"patch":{"summary":"Change a work location","operationId":"locations.update","tags":["Locations"],"description":"Changes the fields you send on a location: names, active switch, or geo-fence. Switching a location off\n(`is_active: false`) is refused while employed employees are assigned to it; the refusal names them.\n\n**When to use:** to rename a site, move or resize its fence, add an office network, or close a site.\n\n**Prerequisites:** the location `id` from `locations.list`.\n\n**Side effects:** a new fence applies to the next check-in of every assigned employee. Recorded in the\naudit log. Not offered to Claude: it decides where people may record attendance.","x-summary-ar":"تعديل موقع عمل","x-description-ar":"يعدّل الحقول التي ترسلها في الموقع: الاسمين أو حالة التفعيل أو السياج. يُرفض إيقاف الموقع (`is_active: false`)\nما دام عليه موظفون على رأس العمل، ويذكر الرفض أسماءهم.\n\n**متى تستخدمه:** لإعادة تسمية موقع، أو نقل سياجه أو تغيير نطاقه، أو إضافة شبكة مكتب، أو إغلاق موقع.\n\n**المتطلبات:** رقم `id` الموقع من `locations.list`.\n\n**الآثار الجانبية:** يُطبَّق السياج الجديد على تسجيل الحضور التالي لكل موظف معيّن عليه. يُسجَّل في سجل التدقيق. لا\nيُعرض على Claude لأنه يحدد أين يستطيع الموظفون تسجيل حضورهم.","x-access":"write","x-permission":{"key":"location/edit","label":"Edit a location","x-label-ar":"تعديل موقع"},"x-feature":"location","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/location_id"}],"responses":{"200":{"description":"The location after the change.","x-description-ar":"الموقع بعد التعديل.","content":{"application/json":{"example":{"id":2,"name_en":"Riyadh HQ","name_ar":"المقر الرئيسي - الرياض","name":"Riyadh HQ","is_active":true,"employees_count":31,"primary_employees_count":28,"additional_employees_count":3,"geo_fencing":{"enabled":true,"latitude":24.7135517,"longitude":46.6752957,"radius_meters":300,"allowed_ips":["91.72.10.0/24"],"enforce_on_check_out":false}},"schema":{"$ref":"#/components/schemas/location"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"location_has_active_employees","meaning":"Employed employees are still assigned to the location. `employees_total` says how many and `employees` names up to 50 (`id`, `employee_no`, `name`, `assignment`: `primary` or `additional`).","x-meaning-ar":"ما زال موظفون على رأس العمل معيّنين على الموقع. يذكر `employees_total` عددهم و`employees` حتى ٥٠ منهم (`id` و`employee_no` و`name` و`assignment`: `primary` أو `additional`).","x-fix":"Move those employees to another location with `employees.update`, then try again.","x-fix-ar":"انقل هؤلاء الموظفين إلى موقع آخر عبر `employees.update` ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"1 active employee is assigned to Riyadh HQ.","code":"location_has_active_employees","employees_total":1,"employees":[{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","assignment":"primary"}]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["location"],"properties":{"location":{"$ref":"#/components/schemas/location_input"}}},"example":{"location":{"radius_meters":300}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a work location","operationId":"locations.delete","tags":["Locations"],"description":"Deletes a location that no employed employee is assigned to and no payroll run or attendance device uses.\nWhile an employee is assigned, the deletion is refused and the refusal names them (up to 50); a location a\npayroll run or an attendance device points at is refused too.\n\n**When to use:** to remove a site the company no longer uses. To keep its history visible, switch it off\nwith `locations.update` instead.\n\n**Prerequisites:** the location `id` from `locations.list`. Move its employees first; a location used by a\npayroll run (`payroll_runs.list`) or an attendance device can only be switched off with `locations.update`.\n\n**Side effects:** the location leaves the lists; attendance already recorded there is kept, and Qoyod\naccounting keeps posting a leaver's last pay to its cost centre. Recorded in the audit log. Not offered to\nClaude, because it cannot be undone from the API.","x-summary-ar":"حذف موقع عمل","x-description-ar":"يحذف موقعاً لا يُعيَّن عليه أي موظف على رأس العمل ولا يستخدمه أي مسيّر رواتب أو جهاز حضور. ما دام عليه موظف\nيُرفض الحذف ويذكر الرفض أسماءهم (حتى ٥٠)، ويُرفض كذلك حذف موقع يشير إليه مسيّر رواتب أو جهاز حضور.\n\n**متى تستخدمه:** لإزالة موقع لم تعد الشركة تستخدمه. للإبقاء على سجله ظاهراً أوقفه عبر `locations.update` بدلاً من\nذلك.\n\n**المتطلبات:** رقم `id` الموقع من `locations.list`. انقل موظفيه أولاً؛ أما الموقع الذي يستخدمه مسيّر رواتب\n(`payroll_runs.list`) أو جهاز حضور فلا يمكن إلا إيقافه عبر `locations.update`.\n\n**الآثار الجانبية:** يختفي الموقع من القوائم، ويبقى الحضور المسجل فيه، وتواصل محاسبة قيود ترحيل آخر راتب لمن غادر\nإلى مركز تكلفته. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه لا يمكن التراجع عنه من الواجهة.","x-access":"write","x-permission":{"key":"location/delete","label":"Remove a location","x-label-ar":"حذف موقع"},"x-feature":"location","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/location_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The location cannot be deleted.","x-description-ar":"لا يمكن حذف الموقع.","x-codes":[{"code":"validation_failed","meaning":"A payroll run or an attendance device uses the location, so it cannot be deleted.","x-meaning-ar":"يستخدم الموقعَ مسيّرُ رواتب أو جهازُ حضور، فلا يمكن حذفه.","x-fix":"Switch it off with `locations.update` (`is_active: false`) instead.","x-fix-ar":"أوقفه عبر `locations.update` (`is_active: false`) بدلاً من ذلك."},{"code":"location_has_active_employees","meaning":"Employed employees are still assigned to the location. `employees_total` says how many and `employees` names up to 50 (`id`, `employee_no`, `name`, `assignment`: `primary` or `additional`).","x-meaning-ar":"ما زال موظفون على رأس العمل معيّنين على الموقع. يذكر `employees_total` عددهم و`employees` حتى ٥٠ منهم (`id` و`employee_no` و`name` و`assignment`: `primary` أو `additional`).","x-fix":"Move those employees to another location with `employees.update`, then try again.","x-fix-ar":"انقل هؤلاء الموظفين إلى موقع آخر عبر `employees.update` ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot delete record because dependent payrolls exist","code":"validation_failed","employees_total":1,"employees":[{"id":1203,"employee_no":"E-0042","name":"Sara Ahmed","assignment":"primary"}]}}}}}}},"/payroll/me/payslips":{"get":{"summary":"List my payslips","operationId":"payslips.my_list","tags":["Payslips"],"description":"Returns the token owner's own payslips, newest first: month, net pay, currency and payment status. Only\nissued payslips appear — a run still being prepared, or waiting for accounting approval, is not shown.\n\n**When to use:** for an employee's questions about their own pay (\"what was my net in October?\",\n\"has my salary been paid?\"). HR viewing other people's payslips uses `payslips.list`.\n\n**Prerequisites:** the token's owner must be an employee with an activated QHR login.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض قسائم راتبي","x-description-ar":"يعرض قسائم راتب صاحب الرمز، الأحدث أولاً: الشهر وصافي الراتب والعملة وحالة الصرف. تظهر القسائم الصادرة\nفقط — لا يظهر مسيّر ما زال قيد الإعداد أو بانتظار موافقة المحاسبة.\n\n**متى تستخدمه:** لأسئلة الموظف عن راتبه («كم كان صافي راتبي في أكتوبر؟»، «هل صُرف راتبي؟»). أما اطلاع\nالموارد البشرية على قسائم الآخرين فعبر `payslips.list`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً مفعّلاً دخوله إلى QHR.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"payslip/view_own","label":"View and download own payslips","x-label-ar":"عرض وتنزيل كشوف الرواتب الخاصة"},"x-feature":"payslip","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of your payslips.","x-description-ar":"صفحة من قسائمك.","content":{"application/json":{"example":{"records":[{"id":5120,"period":"2026-10","net_pay":"9555.0","currency":"SAR","status":"paid","finalized":true}],"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/my_payslip"},"description":"Your issued payslips.","x-description-ar":"قسائمك الصادرة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The owner cannot have payslips.","x-description-ar":"لا يمكن أن تكون لصاحب الرمز قسائم.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"The owner's QHR login is not activated yet.","x-meaning-ar":"لم يُفعَّل دخول صاحب الرمز إلى QHR بعد.","x-fix":"HR must invite the employee and the employee must accept the invitation.","x-fix-ar":"يجب أن تدعو الموارد البشرية الموظف وأن يقبل الدعوة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Your employee portal access has not been activated yet. Contact your HR administrator.","code":"validation_failed"}}}}}}},"/payroll/me/payslips/{id}":{"get":{"summary":"Get one of my payslips with its lines","operationId":"payslips.my_show","tags":["Payslips"],"description":"Returns one of the token owner's issued payslips with every line: salary, allowances, overtime, bonuses,\ndeductions, installments and insurance.\n\n**When to use:** when an employee asks why their pay is what it is (\"why was 945 deducted?\").\n\n**Prerequisites:** the payslip `id` from `payslips.my_list`. Another person's payslip, or one not issued\nyet, answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض إحدى قسائم راتبي مع بنودها","x-description-ar":"يعرض إحدى قسائم صاحب الرمز الصادرة مع كل بنودها: الراتب والبدلات والعمل الإضافي والمكافآت والاستقطاعات\nوالأقساط والتأمينات.\n\n**متى تستخدمه:** عندما يسأل الموظف لماذا جاء راتبه بهذا المبلغ («لماذا استُقطع ٩٤٥؟»).\n\n**المتطلبات:** رقم `id` القسيمة من `payslips.my_list`. قسيمة شخص آخر أو قسيمة لم تصدر بعد تُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payslip/view_own","label":"View and download own payslips","x-label-ar":"عرض وتنزيل كشوف الرواتب الخاصة"},"x-feature":"payslip","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/my_payslip_id"}],"responses":{"200":{"description":"Your payslip.","x-description-ar":"قسيمتك.","content":{"application/json":{"example":{"payslip":{"id":5120,"period":"2026-10","net_pay":"9555.0","currency":"SAR","status":"paid","finalized":true,"earnings":[{"id":90411,"earnable_type":"Salary","earnable_id":310,"kind":"income","amount":"9000.0","applies":true,"flag":false,"description_en":"Basic salary","description_ar":"الراتب الأساسي","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90412,"earnable_type":"Benefit","earnable_id":311,"kind":"income","amount":"1500.0","applies":true,"flag":false,"description_en":"Housing allowance","description_ar":"بدل السكن","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90413,"earnable_type":"InsuranceDeduction","earnable_id":52,"kind":"deduction","amount":"945.0","applies":true,"flag":true,"description_en":"GOSI (employee share)","description_ar":"التأمينات الاجتماعية (حصة الموظف)","auto_deferred":false,"applies_overridden":false,"currency":"SAR"}]}},"schema":{"type":"object","properties":{"payslip":{"$ref":"#/components/schemas/my_payslip_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/me/payslips/{id}/pdf":{"get":{"summary":"Download one of my payslips as PDF","operationId":"payslips.my_pdf","tags":["Payslips"],"description":"Returns one of the token owner's issued payslips as a bilingual PDF, the same file HR downloads.\n\n**When to use:** when an employee needs their payslip for a bank, a visa or a rental application.\n\n**Prerequisites:** the payslip `id` from `payslips.my_list`.\n\n**Side effects:** none. Returns a file (`application/pdf`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل إحدى قسائم راتبي بصيغة PDF","x-description-ar":"يعيد إحدى قسائم صاحب الرمز الصادرة ملف PDF ثنائي اللغة، وهو الملف نفسه الذي تنزّله الموارد البشرية.\n\n**متى تستخدمه:** عندما يحتاج الموظف قسيمته لبنك أو تأشيرة أو عقد إيجار.\n\n**المتطلبات:** رقم `id` القسيمة من `payslips.my_list`.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`application/pdf`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"payslip/view_own","label":"View and download own payslips","x-label-ar":"عرض وتنزيل كشوف الرواتب الخاصة"},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/my_payslip_id"}],"responses":{"200":{"description":"The PDF file.","x-description-ar":"ملف PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/payrolls":{"get":{"summary":"List payroll runs, grouped by month","operationId":"payroll_runs.list","tags":["Payroll runs"],"description":"Returns the company's payroll runs grouped by the month their period starts in, newest month first. Each\nrecord is a month with its runs (`payrolls`) and the month's totals per currency — incomes, deductions,\npaid and still due — summed over the runs shown.\n\n**When to use:** to find a run's `id`, or to answer \"has October's payroll been finalised?\" and \"how much\nis still unpaid this month?\". Filter by step with `q[status_eq]`. For the payslips inside a run use\n`payslips.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 12 months per page; the order is fixed (a `q[s]` sort is ignored).","x-summary-ar":"عرض مسيّرات الرواتب مجمّعة حسب الشهر","x-description-ar":"يعرض مسيّرات رواتب الشركة مجمّعة حسب الشهر الذي تبدأ فيه فترتها، الأحدث أولاً. كل سجل شهرٌ مع مسيّراته\n(`payrolls`) وإجماليات الشهر لكل عملة — الاستحقاقات والاستقطاعات والمصروف والمتبقي — محسوبة على المسيّرات\nالمعروضة.\n\n**متى تستخدمه:** لمعرفة رقم `id` المسيّر، أو للإجابة عن «هل اعتُمد مسيّر أكتوبر؟» و«كم بقي دون صرف هذا\nالشهر؟». صفِّ حسب الخطوة بـ `q[status_eq]`. لقسائم مسيّر بعينه استخدم `payslips.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ١٢ شهراً في الصفحة، والترتيب ثابت (يُتجاهل الفرز `q[s]`).","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["verify_info","verify_time","verify_earnings","verify_payments","pending_accounting","finalized"]},"description":"Only runs at this step.","x-description-ar":"المسيّرات في هذه الخطوة فقط.","example":"finalized"},{"name":"q[reference_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference contains, e.g. `PYR-004`.","x-description-ar":"المرجع يحتوي على، مثل `PYR-004`.","example":"PYR-004"},{"name":"q[from_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Period starts on or after this date.","x-description-ar":"تبدأ الفترة في هذا التاريخ أو بعده.","example":"2026-01-01"},{"name":"q[to_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Period ends on or before this date.","x-description-ar":"تنتهي الفترة في هذا التاريخ أو قبله.","example":"2026-12-31"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of months with their runs.","x-description-ar":"صفحة من الأشهر مع مسيّراتها.","content":{"application/json":{"example":{"records":[{"period":"2026-10","period_start":"2026-10-01","period_end":"2026-10-31","runs_count":1,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}},"payrolls":[{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}}]}],"pagination":{"current_page":1,"per_page":12,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"One entry per month.","x-description-ar":"مدخل لكل شهر.","items":{"type":"object","properties":{"period":{"type":"string","description":"Month, `YYYY-MM`.","x-description-ar":"الشهر بالشكل `YYYY-MM`."},"period_start":{"type":"string","description":"First day of the month.","x-description-ar":"أول يوم في الشهر.","format":"date"},"period_end":{"type":"string","description":"Last day of the month.","x-description-ar":"آخر يوم في الشهر.","format":"date"},"runs_count":{"type":"integer","description":"Runs shown for the month.","x-description-ar":"عدد المسيّرات المعروضة للشهر."},"total_due":{"type":"object","description":"Still to pay, per currency.","x-description-ar":"المتبقي للصرف لكل عملة."},"totals":{"type":"object","description":"Totals per currency, as on a run.","x-description-ar":"الإجماليات لكل عملة كما في المسيّر."},"payrolls":{"type":"array","items":{"$ref":"#/components/schemas/payroll_run"},"description":"The month's runs, newest first.","x-description-ar":"مسيّرات الشهر، الأحدث أولاً."}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Start a payroll run","operationId":"payroll_runs.create","tags":["Payroll runs"],"description":"Creates a run for a period and pay cycle, at its first step (`verify_info`). Its employees are everyone with\nan active salary in the period and pay cycle (optionally one work location), minus anyone an overlapping run\nor a termination package already pays. Send `employee_ids` to pay only those, or `excluded_employee_ids` to\nleave some out. QHR gives it the next reference (`PYR-0043`).\n\n**When to use:** at the start of each pay period. Preview the roster first with `payroll_runs.roster_preview`.\n\n**Prerequisites:** `location_id` from `employees.meta_data`; employee ids from `payroll_runs.roster_preview`.\n\n**Side effects:** none on pay yet — nothing is calculated until `payroll_runs.calculate_time`. Recorded in\nthe audit log. Not offered to Claude: it starts the process that pays the company's employees.","x-summary-ar":"بدء مسيّر رواتب","x-description-ar":"ينشئ مسيّراً لفترة ودورية صرف، في خطوته الأولى (`verify_info`). موظفوه كل من له راتب نشط في الفترة والدورية\n(واختيارياً في موقع عمل واحد)، عدا من يصرف له مسيّر متداخل أو مستحقات نهاية خدمة. أرسل `employee_ids` لصرف\nهؤلاء فقط، أو `excluded_employee_ids` لاستبعاد بعضهم. يعطيه QHR المرجع التالي (`PYR-0043`).\n\n**متى تستخدمه:** في بداية كل فترة صرف. عاين القائمة أولاً عبر `payroll_runs.roster_preview`.\n\n**المتطلبات:** `location_id` من `employees.meta_data`، وأرقام الموظفين من `payroll_runs.roster_preview`.\n\n**الآثار الجانبية:** لا أثر على الرواتب بعد — لا يُحتسب شيء قبل `payroll_runs.calculate_time`. يُسجَّل في سجل\nالتدقيق. لا يُعرض على Claude لأنه يبدأ عملية صرف رواتب موظفي الشركة.","x-access":"write","x-permission":{"key":"payroll_run/create","label":"Create payroll runs","x-label-ar":"إنشاء مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new run.","x-description-ar":"المسيّر الجديد.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"verify_info","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{},"totals":{}}},"schema":{"type":"object","properties":{"payroll":{"$ref":"#/components/schemas/payroll_run"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The run cannot be created.","x-description-ar":"لا يمكن إنشاء المسيّر.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"Every employee asked for is already paid by an overlapping run of the same pay cycle, or by a termination package (`error` names it).","x-meaning-ar":"كل الموظفين المطلوبين يصرف لهم مسيّر متداخل بالدورية نفسها أو مستحقات نهاية خدمة (يسمّيه `error`).","x-fix":"Change the period, or revert or delete the run named.","x-fix-ar":"غيّر الفترة، أو أرجع المسيّر المذكور أو احذفه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"To must be on or after the start date","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payroll"],"properties":{"payroll":{"type":"object","required":["from","to","pay_cycle"],"description":"The run's period and roster.","x-description-ar":"فترة المسيّر وموظفوه.","properties":{"from":{"type":"string","description":"First day of the period.","x-description-ar":"أول يوم في الفترة.","format":"date"},"to":{"type":"string","description":"Last day, on or after `from`.","x-description-ar":"آخر يوم، في `from` أو بعده.","format":"date"},"pay_cycle":{"type":"string","description":"`monthly`, `weekly` or `daily`.","x-description-ar":"`monthly` أو `weekly` أو `daily`.","enum":["monthly","weekly","daily"]},"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر."},"location_id":{"type":"integer","description":"Limit the run to one work location.","x-description-ar":"قصر المسيّر على موقع عمل واحد."},"employee_ids":{"type":"array","description":"Pay only these employees.","x-description-ar":"صرف هؤلاء الموظفين فقط.","items":{"type":"integer"}},"excluded_employee_ids":{"type":"array","description":"Leave these employees out.","x-description-ar":"استبعاد هؤلاء الموظفين.","items":{"type":"integer"}}}}}},"example":{"payroll":{"from":"2026-11-01","to":"2026-11-30","pay_cycle":"monthly","description":"November 2026 payroll"}}}},"required":true,"description":"The run."}}},"/payroll/payrolls/employees_info":{"get":{"summary":"Preview who a new payroll run would pay","operationId":"payroll_runs.roster_preview","tags":["Payroll runs"],"description":"For a period and a pay cycle, returns the employees a new run would pay (`records`: name, basic salary,\ncurrency, location, department), and separately the ones it may not (`excluded`) because an overlapping run\nof the same pay cycle, or a termination package paying their final salary, already covers them.\n\n**When to use:** before `payroll_runs.create`, to check the roster and pick `employee_ids` or\n`excluded_employee_ids`. Send `payroll_id` when re-picking the roster of an existing run, so its own\nemployees still show.\n\n**Prerequisites:** `location_id` and `department_id` (optional filters) from `employees.meta_data`.\n\n**Side effects:** none. Up to 50 candidates per page; `excluded` is never paginated.","x-summary-ar":"معاينة من سيشملهم مسيّر رواتب جديد","x-description-ar":"لفترة ودورية صرف محددتين، يعرض الموظفين الذين سيصرف لهم مسيّر جديد (`records`: الاسم والراتب الأساسي والعملة\nوالموقع والقسم)، ويعرض منفصلين من لا يمكن صرفهم (`excluded`) لأن مسيّراً متداخلاً بالدورية نفسها، أو مستحقات\nنهاية خدمة تصرف راتبهم الأخير، يغطيهم مسبقاً.\n\n**متى تستخدمه:** قبل `payroll_runs.create` لمراجعة القائمة واختيار `employee_ids` أو `excluded_employee_ids`.\nأرسل `payroll_id` عند إعادة اختيار موظفي مسيّر قائم كي يظهر موظفوه.\n\n**المتطلبات:** `location_id` و`department_id` (مرشّحان اختياريان) من `employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ مرشحاً في الصفحة؛ و`excluded` لا يُقسَّم على صفحات.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"period","in":"query","required":true,"schema":{"type":"string"},"description":"A month `YYYY-MM`, or a range `YYYY-MM-DD,YYYY-MM-DD`.","x-description-ar":"شهر بالشكل `YYYY-MM`، أو مدى `YYYY-MM-DD,YYYY-MM-DD`.","example":"2026-11"},{"name":"pay_cycle","in":"query","required":true,"schema":{"type":"string","enum":["monthly","weekly","daily"]},"description":"Pay cycle of the run.","x-description-ar":"دورية صرف المسيّر.","example":"monthly"},{"name":"location_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees of this work location.","x-description-ar":"موظفو موقع العمل هذا فقط.","example":2},{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees of this department.","x-description-ar":"موظفو هذا القسم فقط.","example":4},{"name":"payroll_id","in":"query","required":false,"schema":{"type":"integer"},"description":"The run whose roster is being re-picked, from `payroll_runs.list`.","x-description-ar":"المسيّر الذي يُعاد اختيار موظفيه، من `payroll_runs.list`.","example":77},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The candidates, and who is already covered.","x-description-ar":"المرشحون، ومن يغطيه مسيّر آخر.","content":{"application/json":{"example":{"records":[{"id":1203,"employee_no":"E-0042","location_id":2,"department_id":4,"name":"Sara Ahmed","basic_salary_amount":"9000.0","currency":"SAR","included":true}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1},"excluded":[{"employee_id":1188,"employee_no":"E-0031","name":"Omar Ali","payroll_id":76,"payroll_reference":"PYR-0041","reason":"payroll_run","termination_package_reference":null,"message":null}]},"schema":{"type":"object","required":["records","pagination","excluded"],"properties":{"records":{"type":"array","description":"Employees the run may pay.","x-description-ar":"الموظفون الذين يمكن للمسيّر صرفهم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"location_id":{"type":"integer","description":"Work location id.","x-description-ar":"رقم موقع العمل.","nullable":true},"department_id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم.","nullable":true},"basic_salary_amount":{"type":"string","description":"Active basic salary, decimal string.","x-description-ar":"الراتب الأساسي النشط، نص عشري.","nullable":true},"currency":{"type":"string","description":"Pay currency.","x-description-ar":"عملة الراتب."},"included":{"type":"boolean","description":"Always true: candidates start included.","x-description-ar":"دائماً صحيح: المرشحون مشمولون مبدئياً."}}}},"pagination":{"$ref":"#/components/schemas/pagination"},"excluded":{"type":"array","description":"Employees already covered, and by what.","x-description-ar":"الموظفون المغطّون مسبقاً، وما يغطيهم.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"reason":{"type":"string","description":"`payroll_run` or `termination_package`.","x-description-ar":"`payroll_run` أو `termination_package`."},"payroll_id":{"type":"integer","description":"The overlapping run.","x-description-ar":"المسيّر المتداخل.","nullable":true},"payroll_reference":{"type":"string","description":"Its reference.","x-description-ar":"مرجعه.","nullable":true},"termination_package_reference":{"type":"string","description":"The termination package's reference.","x-description-ar":"مرجع مستحقات نهاية الخدمة.","nullable":true},"message":{"type":"string","description":"Explanation for a termination package.","x-description-ar":"توضيح عند مستحقات نهاية الخدمة.","nullable":true}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The period or pay cycle is not valid.","x-description-ar":"الفترة أو دورية الصرف غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"`period` is missing or not a month or date range, or `pay_cycle` is not `monthly`, `weekly` or `daily`.","x-meaning-ar":"`period` ناقص أو ليس شهراً أو مدى تواريخ، أو `pay_cycle` ليست `monthly` أو `weekly` أو `daily`.","x-fix":"Send `period=2026-11` (or `2026-11-01,2026-11-30`) and a valid `pay_cycle`.","x-fix-ar":"أرسل `period=2026-11` (أو `2026-11-01,2026-11-30`) و`pay_cycle` صحيحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A valid period is required.","code":"validation_failed"}}}}}}},"/payroll/payrolls/export":{"get":{"summary":"Export payroll runs to Excel or CSV","operationId":"payroll_runs.export","tags":["Payroll runs"],"description":"Builds a file of the company's payroll runs, newest first, one row per run and pay currency, with the\ncolumns you choose (reference, period, step, payment status, payslips, incomes, deductions, paid, due, pay\ndate…) and a totals row per currency. It takes the same filters as `payroll_runs.list`.\n\n**When to use:** to hand a year of payroll totals to finance or the auditors. To read the figures,\n`payroll_runs.list` is lighter; for one row per employee use `payslips.export`.\n\n**Prerequisites:** column keys from `payroll_runs.export_columns`. You need \"Export payroll data\" as well as\n\"View payroll runs\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير مسيّرات الرواتب إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بمسيّرات رواتب الشركة، الأحدث أولاً، صفاً لكل مسيّر وعملة صرف، بالأعمدة التي تختارها (المرجع\nوالفترة والخطوة وحالة الصرف وعدد القسائم والاستحقاقات والاستقطاعات والمصروف والمتبقي وتاريخ الصرف…) مع صف\nإجماليات لكل عملة. يقبل مرشحات `payroll_runs.list` نفسها.\n\n**متى تستخدمه:** لتسليم إجماليات رواتب سنة إلى المالية أو المراجعين. لقراءة الأرقام `payroll_runs.list` أخف،\nولصف لكل موظف استخدم `payslips.export`.\n\n**المتطلبات:** مفاتيح الأعمدة من `payroll_runs.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض\nمسيّرات الرواتب» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"}]},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["verify_info","verify_time","verify_earnings","verify_payments","pending_accounting","finalized"]},"description":"Only runs at this step.","x-description-ar":"المسيّرات في هذه الخطوة فقط.","example":"finalized"},{"name":"q[from_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Period starts on or after this date.","x-description-ar":"تبدأ الفترة في هذا التاريخ أو بعده.","example":"2026-01-01"},{"name":"q[to_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Period ends on or before this date.","x-description-ar":"تنتهي الفترة في هذا التاريخ أو قبله.","example":"2026-12-31"}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/payroll/payrolls/export/columns":{"get":{"summary":"List the columns a payroll runs export can have","operationId":"payroll_runs.export_columns","tags":["Payroll runs"],"description":"Returns the columns of the payroll runs export that your role may see, in screen order, with their header in\nthe requested language and whether QHR ticks them by default.\n\n**When to use:** before `payroll_runs.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View payroll runs\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير مسيّرات الرواتب","x-description-ar":"يعرض أعمدة تصدير مسيّرات الرواتب التي يحق لدورك رؤيتها بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب وهل يحدده\nQHR افتراضياً.\n\n**متى تستخدمه:** قبل `payroll_runs.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض مسيّرات الرواتب».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"}]},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"period_from","label":"Period From","default":true,"type":"date"},{"key":"status","label":"Status","default":true,"type":"enum"},{"key":"total_due","label":"Total Due","default":true,"type":"money"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/payrolls/{id}":{"get":{"summary":"Get a payroll run with its accounting status","operationId":"payroll_runs.show","tags":["Payroll runs"],"description":"Returns one run: its period, step (`status`), pay date, employee count and money per currency; leave\nadvisories to review before finalising (`leave_warnings`); and where it stands in Qoyod accounting\n(`accounting`).\n\n**When to use:** before moving a run to its next step, to see which step it is at, or to explain why a\nfinalised run is not yet posted in accounting.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض مسيّر رواتب مع حالة المحاسبة","x-description-ar":"يعرض مسيّراً واحداً: فترته وخطوته (`status`) وتاريخ صرفه وعدد موظفيه ومبالغه لكل عملة، وتنبيهات الإجازات\nالتي ينبغي مراجعتها قبل الاعتماد (`leave_warnings`)، وموقفه في محاسبة قيود (`accounting`).\n\n**متى تستخدمه:** قبل نقل المسيّر إلى خطوته التالية، أو لمعرفة خطوته الحالية، أو لتفسير عدم ترحيل مسيّر\nمعتمد إلى المحاسبة بعد.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run.","x-description-ar":"المسيّر.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a payroll run","operationId":"payroll_runs.update","tags":["Payroll runs"],"description":"Changes a run's description and pay date at any step. While the run is still at `verify_info` you can also\nchange its period, pay cycle and location, and re-pick its employees (`employee_ids` or\n`excluded_employee_ids`); later those fields are ignored.\n\n**When to use:** to set the pay date before submitting for accounting approval, or to fix the roster before\ncalculating.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; roster ids from `payroll_runs.roster_preview` (send\n`payroll_id`).\n\n**Side effects:** recorded in the audit log. Not offered to Claude, because it changes who is paid in the run.","x-summary-ar":"تعديل مسيّر رواتب","x-description-ar":"يعدّل وصف المسيّر وتاريخ صرفه في أي خطوة. وما دام المسيّر في `verify_info` يمكنك أيضاً تعديل فترته ودوريته\nوموقعه وإعادة اختيار موظفيه (`employee_ids` أو `excluded_employee_ids`)؛ وبعدها تُتجاهل هذه الحقول.\n\n**متى تستخدمه:** لتحديد تاريخ الصرف قبل الإرسال لموافقة المحاسبة، أو لتصحيح قائمة الموظفين قبل الاحتساب.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`، وأرقام الموظفين من `payroll_runs.roster_preview` (مع\n`payroll_id`).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر من يُصرف لهم في المسيّر.","x-access":"write","x-permission":{"key":"payroll_run/edit","label":"Edit payroll runs","x-label-ar":"تعديل مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run after the change.","x-description-ar":"المسيّر بعد التعديل.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}}},"schema":{"type":"object","properties":{"payroll":{"$ref":"#/components/schemas/payroll_run"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"To must be on or after the start date","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["payroll"],"properties":{"payroll":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تعديلها فقط.","properties":{"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر."},"payment_date":{"type":"string","description":"Pay date; required before submitting for accounting approval.","x-description-ar":"تاريخ الصرف؛ مطلوب قبل الإرسال لموافقة المحاسبة.","format":"date"},"from":{"type":"string","description":"First day (at `verify_info` only).","x-description-ar":"أول يوم (في `verify_info` فقط).","format":"date"},"to":{"type":"string","description":"Last day (at `verify_info` only).","x-description-ar":"آخر يوم (في `verify_info` فقط).","format":"date"},"pay_cycle":{"type":"string","description":"Pay cycle (at `verify_info` only).","x-description-ar":"دورية الصرف (في `verify_info` فقط).","enum":["monthly","weekly","daily"]},"location_id":{"type":"integer","description":"Work location (at `verify_info` only).","x-description-ar":"موقع العمل (في `verify_info` فقط)."},"employee_ids":{"type":"array","description":"Pay only these (at `verify_info` only).","x-description-ar":"صرف هؤلاء فقط (في `verify_info` فقط).","items":{"type":"integer"}},"excluded_employee_ids":{"type":"array","description":"Leave these out (at `verify_info` only).","x-description-ar":"استبعاد هؤلاء (في `verify_info` فقط).","items":{"type":"integer"}}}}}},"example":{"payroll":{"payment_date":"2026-11-27"}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a payroll run","operationId":"payroll_runs.delete","tags":["Payroll runs"],"description":"Deletes a run that is not finalised, with its timesheets and payslips. Everything the run had claimed —\napproved overtime, absences, bonuses, deductions and loan installments — is released, so the next run picks\nthem up again.\n\n**When to use:** to discard a run started by mistake. A finalised run cannot be deleted; a run waiting for\naccounting approval must first be withdrawn with `payroll_runs.revert`.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`.\n\n**Side effects:** the run, its timesheets and payslips are gone; recorded in the audit log. Irreversible, so\nnot offered to Claude.","x-summary-ar":"حذف مسيّر رواتب","x-description-ar":"يحذف مسيّراً غير معتمد مع سجلات وقته وقسائمه. ويُحرَّر كل ما حجزه المسيّر — العمل الإضافي والغياب والمكافآت\nوالاستقطاعات وأقساط السلف المعتمدة — ليلتقطها المسيّر التالي.\n\n**متى تستخدمه:** لإلغاء مسيّر بُدئ خطأً. لا يمكن حذف مسيّر معتمد، والمسيّر الذي ينتظر موافقة المحاسبة يجب سحبه\nأولاً عبر `payroll_runs.revert`.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`.\n\n**الآثار الجانبية:** يُحذف المسيّر وسجلات وقته وقسائمه ويُسجَّل ذلك في سجل التدقيق. لا يمكن التراجع عنه، لذلك لا\nيُعرض على Claude.","x-access":"write","x-permission":{"key":"payroll_run/delete","label":"Delete payroll runs","x-label-ar":"حذف مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The run cannot be deleted.","x-description-ar":"لا يمكن حذف المسيّر.","x-codes":[{"code":"validation_failed","meaning":"The run is finalised; a finalised run is permanent.","x-meaning-ar":"المسيّر معتمد نهائياً، والمسيّر المعتمد دائم.","x-fix":"Nothing to delete: correct it in the next run.","x-fix-ar":"لا شيء للحذف: صحّح ذلك في المسيّر التالي."},{"code":"submitted_immutable","meaning":"The run is with accounting, waiting for its approval.","x-meaning-ar":"المسيّر لدى المحاسبة بانتظار موافقتها.","x-fix":"Withdraw it with `payroll_runs.revert` first, then delete it.","x-fix-ar":"اسحبه أولاً عبر `payroll_runs.revert` ثم احذفه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This run is with accounting. Withdraw it before deleting it.","code":"submitted_immutable","error_code":"submitted_immutable"}}}}}}},"/payroll/payrolls/{id}/accounting_event":{"get":{"summary":"Get what a payroll run sent to accounting","operationId":"payroll_runs.accounting_event","tags":["Payroll runs"],"description":"Returns exactly what QHR sent to Qoyod accounting for a run: the event id, its state, the run reference,\nwhen it happened, and the payslip lines as Qoyod received them — frozen at sending time, so a salary changed\nsince does not show here. `employee_no` narrows the lines to one employee.\n\n**When to use:** to reconcile a journal entry in Qoyod with the run (\"why is Sara's housing 2,250 in\nQoyod?\"). For the run's accounting status alone, `payroll_runs.show` (`accounting`) is enough.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`. A run never sent to accounting answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض ما أرسله مسيّر الرواتب إلى المحاسبة","x-description-ar":"يعرض ما أرسله QHR إلى محاسبة قيود عن المسيّر كما هو: رقم الحدث وحالته ومرجع المسيّر ووقته وبنود القسائم كما\nاستلمتها قيود — مجمّدة وقت الإرسال، فلا يظهر هنا راتب تغيّر بعده. يحصر `employee_no` البنود في موظف واحد.\n\n**متى تستخدمه:** لمطابقة قيد في قيود مع المسيّر («لماذا بدل سكن سارة ٢٬٢٥٠ في قيود؟»). لحالة المحاسبة فقط\nيكفي `payroll_runs.show` (`accounting`).\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`. المسيّر الذي لم يُرسل إلى المحاسبة يُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"},{"name":"employee_no","in":"query","required":false,"schema":{"type":"string"},"description":"Only this employee's lines.","x-description-ar":"بنود هذا الموظف فقط.","example":"E-0042"}],"responses":{"200":{"description":"The event sent to accounting.","x-description-ar":"الحدث المرسل إلى المحاسبة.","content":{"application/json":{"example":{"event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","state":"posted","reference":"PYR-0042","occurred_at":"2026-10-27T09:00:00Z","payslips":[{"employee":{"employee_no":"E-0042","name":"Sara Ahmed"},"lines":[{"cost_type":"basic_salary","amount":"9000.00","currency":"SAR"},{"cost_type":"allowance_housing","amount":"2250.00","currency":"SAR"}]}]},"schema":{"type":"object","properties":{"event_id":{"type":"string","description":"Event id.","x-description-ar":"رقم الحدث."},"state":{"type":"string","description":"Accounting state, as in `payroll_runs.show`.","x-description-ar":"حالة المحاسبة كما في `payroll_runs.show`."},"reference":{"type":"string","description":"Run reference.","x-description-ar":"مرجع المسيّر."},"occurred_at":{"type":"string","description":"When the event was raised, UTC ISO 8601.","x-description-ar":"وقت إنشاء الحدث بتوقيت UTC وصيغة ISO 8601.","format":"date-time"},"payslips":{"type":"array","items":{"type":"object"},"description":"Payslip lines as sent: employee, cost types and amounts.","x-description-ar":"بنود القسائم كما أُرسلت: الموظف وأنواع التكلفة والمبالغ."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"description":"No such run, or it was never sent to accounting.","x-description-ar":"المسيّر غير موجود، أو لم يُرسل إلى المحاسبة قط.","x-codes":[{"code":"not_found","meaning":"The record does not exist, or you cannot see it.","x-meaning-ar":"السجل غير موجود أو ليس لديك صلاحية رؤيته.","x-fix":"Check the id. List the records first to get a valid one.","x-fix-ar":"تأكد من الرقم. اعرض القائمة أولاً للحصول على رقم صحيح."},{"code":"no_event","meaning":"The run has never been sent to accounting.","x-meaning-ar":"لم يُرسل المسيّر إلى المحاسبة قط.","x-fix":"A run is sent when it is finalised and accounting is connected; check `payroll_runs.show`.","x-fix-ar":"يُرسل المسيّر عند اعتماده إذا كانت المحاسبة مرتبطة؛ راجع `payroll_runs.show`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This run has not been sent to the accounting system.","code":"no_event","error_code":"no_event"}}}}}}},"/payroll/payrolls/{id}/accounting_event/repost":{"post":{"summary":"Re-post a run after its entry was reversed","operationId":"payroll_runs.accounting_repost","tags":["Payroll runs"],"description":"Sends a finalised run to Qoyod accounting again, under a new event id that names the reversed one, after\nthe original journal entry was reversed in Qoyod. Qoyod cannot count the run twice.\n\n**When to use:** when `payroll_runs.show` reports `accounting.state: reversed` and\n`accounting.repost_allowed: true` — typically after an accountant reversed the entry to re-map accounts.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`.\n\n**Side effects:** a new journal entry is posted in Qoyod. Not offered to Claude, because it posts to the\ncompany's books.","x-summary-ar":"إعادة ترحيل مسيّر بعد عكس قيده","x-description-ar":"يرسل مسيّراً معتمداً إلى محاسبة قيود مرة أخرى، برقم حدث جديد يشير إلى الحدث المعكوس، بعد عكس القيد الأصلي في\nقيود. لا يمكن لقيود احتساب المسيّر مرتين.\n\n**متى تستخدمه:** عندما يذكر `payroll_runs.show` أن `accounting.state: reversed` و`accounting.repost_allowed: true`\n— عادةً بعد أن يعكس المحاسب القيد لإعادة ربط الحسابات.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`.\n\n**الآثار الجانبية:** يُرحَّل قيد يومي جديد في قيود. لا يُعرض على Claude لأنه يرحّل إلى دفاتر الشركة.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run's accounting status after queuing.","x-description-ar":"حالة المحاسبة للمسيّر بعد وضعه في القائمة.","content":{"application/json":{"example":{"accounting":{"state":"queued","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":null,"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"type":"object","properties":{"accounting":{"$ref":"#/components/schemas/payroll_run_accounting"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"description":"No such run, or it was never sent.","x-description-ar":"المسيّر غير موجود أو لم يُرسل قط.","x-codes":[{"code":"not_found","meaning":"The record does not exist, or you cannot see it.","x-meaning-ar":"السجل غير موجود أو ليس لديك صلاحية رؤيته.","x-fix":"Check the id. List the records first to get a valid one.","x-fix-ar":"تأكد من الرقم. اعرض القائمة أولاً للحصول على رقم صحيح."},{"code":"no_event","meaning":"The run has never been sent to accounting, so there is no event to act on.","x-meaning-ar":"لم يُرسل المسيّر إلى المحاسبة قط، فلا حدث يمكن التعامل معه.","x-fix":"Nothing to retry: a run is sent when it is finalised and accounting is connected.","x-fix-ar":"لا شيء لإعادة المحاولة: يُرسل المسيّر عند اعتماده إذا كانت المحاسبة مرتبطة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This run has not been sent to the accounting system.","code":"no_event","error_code":"no_event"}}}},"409":{"description":"The entry was not reversed.","x-description-ar":"لم يُعكس القيد.","x-codes":[{"code":"not_reversed","meaning":"Qoyod has not reversed the original entry, or forbade re-posting it.","x-meaning-ar":"لم تعكس قيود القيد الأصلي، أو منعت إعادة ترحيله.","x-fix":"Reverse the entry in Qoyod first.","x-fix-ar":"اعكس القيد في قيود أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Re-post is only available after Qoyod has reversed the original entry.","code":"not_reversed","error_code":"not_reversed"}}}}}}},"/payroll/payrolls/{id}/accounting_event/retry":{"post":{"summary":"Re-send a run that failed to reach accounting","operationId":"payroll_runs.accounting_retry","tags":["Payroll runs"],"description":"Queues the run's accounting event again, under the same event id, after its delivery to Qoyod failed\n(`accounting.state: failed`). The same id makes the re-send safe: Qoyod never posts it twice.\n\n**When to use:** when `payroll_runs.show` reports `accounting.retryable: true`. A run that is `held` or\n`needs_decision` is fixed in Qoyod (map the account, open the period), not by retrying.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`.\n\n**Side effects:** the event is delivered to Qoyod again, which posts the journal entry. Not offered to\nClaude, because it posts to the company's books.","x-summary-ar":"إعادة إرسال مسيّر فشل وصوله إلى المحاسبة","x-description-ar":"يعيد وضع حدث المحاسبة الخاص بالمسيّر في قائمة الإرسال، بالرقم نفسه، بعد فشل وصوله إلى قيود\n(`accounting.state: failed`). الرقم نفسه يجعل الإعادة آمنة: لا ترحّله قيود مرتين.\n\n**متى تستخدمه:** عندما يذكر `payroll_runs.show` أن `accounting.retryable: true`. أما المسيّر المعلّق `held` أو\n`needs_decision` فيُعالج في قيود (ربط الحساب، فتح الفترة) لا بإعادة المحاولة.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`.\n\n**الآثار الجانبية:** يُرسل الحدث إلى قيود مجدداً فيُرحَّل القيد. لا يُعرض على Claude لأنه يرحّل إلى دفاتر الشركة.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run's accounting status after queuing.","x-description-ar":"حالة المحاسبة للمسيّر بعد وضعه في القائمة.","content":{"application/json":{"example":{"accounting":{"state":"queued","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":null,"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"type":"object","properties":{"accounting":{"$ref":"#/components/schemas/payroll_run_accounting"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"description":"No such run, or it was never sent.","x-description-ar":"المسيّر غير موجود أو لم يُرسل قط.","x-codes":[{"code":"not_found","meaning":"The record does not exist, or you cannot see it.","x-meaning-ar":"السجل غير موجود أو ليس لديك صلاحية رؤيته.","x-fix":"Check the id. List the records first to get a valid one.","x-fix-ar":"تأكد من الرقم. اعرض القائمة أولاً للحصول على رقم صحيح."},{"code":"no_event","meaning":"The run has never been sent to accounting, so there is no event to act on.","x-meaning-ar":"لم يُرسل المسيّر إلى المحاسبة قط، فلا حدث يمكن التعامل معه.","x-fix":"Nothing to retry: a run is sent when it is finalised and accounting is connected.","x-fix-ar":"لا شيء لإعادة المحاولة: يُرسل المسيّر عند اعتماده إذا كانت المحاسبة مرتبطة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This run has not been sent to the accounting system.","code":"no_event","error_code":"no_event"}}}},"409":{"description":"The delivery did not fail, so there is nothing to retry.","x-description-ar":"لم يفشل الإرسال، فلا شيء لإعادة المحاولة.","x-codes":[{"code":"not_retryable","meaning":"The event is not in `failed` state: it is posted, being sent, or being handled in Qoyod.","x-meaning-ar":"الحدث ليس بحالة `failed`: رُحّل أو يُرسل أو يُعالج في قيود.","x-fix":"Read `accounting.reason` with `payroll_runs.show` and act in Qoyod if needed.","x-fix-ar":"اقرأ `accounting.reason` عبر `payroll_runs.show` وتصرّف في قيود عند الحاجة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This event cannot be retried from here — it is being handled in Qoyod.","code":"not_retryable","error_code":"not_retryable"}}}}}}},"/payroll/payrolls/{id}/calculate_earnings":{"patch":{"summary":"Calculate a run's payslips","operationId":"payroll_runs.calculate_earnings","tags":["Payroll runs"],"description":"Moves a run from `verify_time` to `verify_earnings`: re-syncs timesheets that nobody edited, then builds every\nemployee's payslip — salary, allowances, overtime and absence, approved bonuses and deductions, loan and custody\ninstallments, insurance shares — and claims those bonuses, deductions and installments for this run so no other\nrun pays them twice.\n\n**When to use:** once the timesheets are right. Review the payslips with `payslips.list`, then continue with\n`payroll_runs.calculate_payments`.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; the run must be at `verify_time`.\n\n**Side effects:** payslips are calculated (as drafts employees cannot see); bonuses, deductions and installments are\nclaimed. Recorded in the audit log. Not offered to Claude, as a payroll step.","x-summary-ar":"احتساب قسائم المسيّر","x-description-ar":"ينقل المسيّر من `verify_time` إلى `verify_earnings`: يعيد مزامنة سجلات الوقت التي لم يعدّلها أحد، ثم يبني قسيمة كل\nموظف — الراتب والبدلات والإضافي والغياب والمكافآت والاستقطاعات المعتمدة وأقساط السلف والعهد وحصص التأمين — ويحجز\nتلك المكافآت والاستقطاعات والأقساط لهذا المسيّر فلا يصرفها مسيّر آخر مرتين.\n\n**متى تستخدمه:** بعد ضبط سجلات الوقت. راجع القسائم عبر `payslips.list` ثم تابع بـ `payroll_runs.calculate_payments`.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ ويجب أن يكون في `verify_time`.\n\n**الآثار الجانبية:** تُحتسب القسائم (مسودات لا يراها الموظفون) وتُحجز المكافآت والاستقطاعات والأقساط. يُسجَّل في سجل\nالتدقيق. لا يُعرض على Claude لأنه خطوة رواتب.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run at its new step.","x-description-ar":"المسيّر في خطوته الجديدة.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The step is not allowed now.","x-description-ar":"الخطوة غير مسموحة الآن.","x-codes":[{"code":"validation_failed","meaning":"This step is not allowed from the run's current status.","x-meaning-ar":"هذه الخطوة غير مسموحة من حالة المسيّر الحالية.","x-fix":"Read the run's `status` with `payroll_runs.show` and call the step that follows it.","x-fix-ar":"اقرأ `status` المسيّر عبر `payroll_runs.show` واستدعِ الخطوة التالية له."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This step is not allowed from the run's current status.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{id}/calculate_payments":{"patch":{"summary":"Move a run to payment review","operationId":"payroll_runs.calculate_payments","tags":["Payroll runs"],"description":"Moves a run from `verify_earnings` to `verify_payments`, the last review before finalising: the payslips are settled\nand the pay date is chosen.\n\n**When to use:** once the payslips are right. Set the pay date with `payroll_runs.update`, check the bank file with\n`payroll_runs.wps_export`, then `payroll_runs.finalize`.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; the run must be at `verify_earnings`.\n\n**Side effects:** the step changes; nothing is paid. Recorded in the audit log. Not offered to Claude, as a payroll step.","x-summary-ar":"نقل المسيّر إلى مراجعة الصرف","x-description-ar":"ينقل المسيّر من `verify_earnings` إلى `verify_payments`، وهي المراجعة الأخيرة قبل الاعتماد: تُثبَّت القسائم ويُختار\nتاريخ الصرف.\n\n**متى تستخدمه:** بعد ضبط القسائم. حدّد تاريخ الصرف عبر `payroll_runs.update` وراجع ملف البنك عبر\n`payroll_runs.wps_export` ثم `payroll_runs.finalize`.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ ويجب أن يكون في `verify_earnings`.\n\n**الآثار الجانبية:** تتغير الخطوة ولا يُصرف شيء. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه خطوة رواتب.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run at its new step.","x-description-ar":"المسيّر في خطوته الجديدة.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The step is not allowed now.","x-description-ar":"الخطوة غير مسموحة الآن.","x-codes":[{"code":"validation_failed","meaning":"This step is not allowed from the run's current status.","x-meaning-ar":"هذه الخطوة غير مسموحة من حالة المسيّر الحالية.","x-fix":"Read the run's `status` with `payroll_runs.show` and call the step that follows it.","x-fix-ar":"اقرأ `status` المسيّر عبر `payroll_runs.show` واستدعِ الخطوة التالية له."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This step is not allowed from the run's current status.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{id}/calculate_time":{"patch":{"summary":"Calculate a run's time","operationId":"payroll_runs.calculate_time","tags":["Payroll runs"],"description":"Moves a run from `verify_info` to `verify_time` and builds a timesheet for each employee from the approved sources:\nscheduled hours, approved overtime requests, and absence and lateness incidents marked for deduction.\n\n**When to use:** once the roster is right. Then review the timesheets with `timesheets.list`, correct them with\n`timesheets.update` or `timesheets.bulk_upload`, and continue with `payroll_runs.calculate_earnings`.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; the run must be at `verify_info`.\n\n**Side effects:** timesheets are created; nothing is paid. Recorded in the audit log. Not offered to Claude, as a\npayroll step.","x-summary-ar":"احتساب أوقات المسيّر","x-description-ar":"ينقل المسيّر من `verify_info` إلى `verify_time` وينشئ سجل وقت لكل موظف من المصادر المعتمدة: الساعات المجدولة\nوطلبات العمل الإضافي المعتمدة وحالات الغياب والتأخير المقررة للاستقطاع.\n\n**متى تستخدمه:** بعد ضبط قائمة الموظفين. ثم راجع سجلات الوقت عبر `timesheets.list` وصحّحها عبر\n`timesheets.update` أو `timesheets.bulk_upload`، وتابع بـ `payroll_runs.calculate_earnings`.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ ويجب أن يكون في `verify_info`.\n\n**الآثار الجانبية:** تُنشأ سجلات الوقت ولا يُصرف شيء. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه خطوة رواتب.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run at its new step.","x-description-ar":"المسيّر في خطوته الجديدة.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The step is not allowed now.","x-description-ar":"الخطوة غير مسموحة الآن.","x-codes":[{"code":"validation_failed","meaning":"This step is not allowed from the run's current status.","x-meaning-ar":"هذه الخطوة غير مسموحة من حالة المسيّر الحالية.","x-fix":"Read the run's `status` with `payroll_runs.show` and call the step that follows it.","x-fix-ar":"اقرأ `status` المسيّر عبر `payroll_runs.show` واستدعِ الخطوة التالية له."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This step is not allowed from the run's current status.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{id}/finalize":{"patch":{"summary":"Finalise a payroll run","operationId":"payroll_runs.finalize","tags":["Payroll runs"],"description":"Closes a run at `verify_payments`. Without accounting approval (`accounting.mode: legacy`) the run becomes\n`finalized`: its payslips can no longer change, and when Qoyod accounting is connected the run is posted there as a\njournal entry. With accounting approval (`mode: approval`) the run is submitted instead and waits at\n`pending_accounting`; when accounting approves, it is finalised, its payslips are issued to the employees and the\npayments are recorded.\n\n**When to use:** when the run is verified and ready to pay. In approval mode set `payment_date` first\n(`payroll_runs.update`).\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; the run must be at `verify_payments`.\n\n**Side effects:** a finalised run is permanent — corrections go into the next run, or, once posted, through a\nreversal in Qoyod and `payroll_runs.accounting_repost`. Sends the run to Qoyod accounting; recorded in the audit\nlog. Not offered to Claude.","x-summary-ar":"اعتماد مسيّر الرواتب نهائياً","x-description-ar":"يغلق المسيّر الموجود في `verify_payments`. بدون موافقة المحاسبة (`accounting.mode: legacy`) يصبح المسيّر\n`finalized`: لا تتغير قسائمه بعد ذلك، ويُرحَّل قيداً يومياً إلى محاسبة قيود إن كانت مرتبطة. ومع موافقة المحاسبة\n(`mode: approval`) يُرسل المسيّر بدلاً من ذلك وينتظر في `pending_accounting`؛ وعند موافقة المحاسبة يُعتمد وتصدر قسائمه\nللموظفين وتُسجَّل الدفعات.\n\n**متى تستخدمه:** عندما يكون المسيّر مراجَعاً وجاهزاً للصرف. في وضع الموافقة حدّد `payment_date` أولاً\n(`payroll_runs.update`).\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ ويجب أن يكون في `verify_payments`.\n\n**الآثار الجانبية:** المسيّر المعتمد نهائي — تُصحَّح الأخطاء في المسيّر التالي، أو بعد الترحيل عبر عكس القيد في قيود\nثم `payroll_runs.accounting_repost`. يُرسل المسيّر إلى محاسبة قيود ويُسجَّل في سجل التدقيق. لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run at its new step.","x-description-ar":"المسيّر في خطوته الجديدة.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The step is not allowed now.","x-description-ar":"الخطوة غير مسموحة الآن.","x-codes":[{"code":"validation_failed","meaning":"This step is not allowed from the run's current status.","x-meaning-ar":"هذه الخطوة غير مسموحة من حالة المسيّر الحالية.","x-fix":"Read the run's `status` with `payroll_runs.show` and call the step that follows it.","x-fix-ar":"اقرأ `status` المسيّر عبر `payroll_runs.show` واستدعِ الخطوة التالية له."},{"code":"validation_failed","meaning":"In accounting-approval mode the run needs a pay date before it is submitted.","x-meaning-ar":"في وضع موافقة المحاسبة يحتاج المسيّر تاريخ صرف قبل إرساله.","x-fix":"Set `payment_date` with `payroll_runs.update`, then finalise again.","x-fix-ar":"حدّد `payment_date` عبر `payroll_runs.update` ثم أعد الاعتماد."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This step is not allowed from the run's current status.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{id}/pay_all":{"post":{"summary":"Record a finalised run as paid","operationId":"payroll_runs.pay_all","tags":["Payroll runs"],"description":"Records the payment of every payslip of a finalised run that still has money due: one employee payment per\npayslip, for the outstanding amount, on `date`, allocated to that payslip. Payslips that were still drafts\nare issued to their employees, the bonuses and deductions the run paid are marked paid, loan installments\ndeducted are settled, and `date` becomes the run's pay date.\n\n**When to use:** after the bank transfer (e.g. the WPS file from `payroll_runs.wps_export`) went through.\nCompanies whose Qoyod accounting approves payroll never call this: payments are recorded when accounting\napproves the run.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; the run must be `finalized`.\n\n**Side effects:** money is recorded as paid to every employee on the run and payslips become visible to them;\nrecorded in the audit log. Not offered to Claude: it records the company's salaries as paid.","x-summary-ar":"تسجيل صرف مسيّر رواتب معتمد","x-description-ar":"يسجّل صرف كل قسيمة في مسيّر معتمد بقي عليها مبلغ مستحق: دفعة موظف لكل قسيمة بالمبلغ المتبقي في تاريخ `date`،\nمخصّصة لتلك القسيمة. وتصدر للموظفين القسائم التي كانت مسودات، وتُعلَّم المكافآت والاستقطاعات التي صرفها المسيّر\nمصروفة، وتُسوّى أقساط السلف المستقطعة، ويصبح `date` تاريخ صرف المسيّر.\n\n**متى تستخدمه:** بعد إتمام التحويل البنكي (مثلاً بملف `payroll_runs.wps_export`). الشركات التي توافق فيها محاسبة\nقيود على الرواتب لا تستدعيه: تُسجَّل الدفعات عند موافقة المحاسبة.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ ويجب أن يكون `finalized`.\n\n**الآثار الجانبية:** يُسجَّل المال مصروفاً لكل موظفي المسيّر وتظهر لهم القسائم، ويُسجَّل ذلك في سجل التدقيق. لا يُعرض\nعلى Claude لأنه يسجّل رواتب الشركة مصروفة.","x-access":"write","x-permission":{"key":"payment/create","label":"Record payments and allocate them","x-label-ar":"تسجيل المدفوعات وتخصيصها"},"x-feature":"payment","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"201":{"description":"What was paid, and the run.","x-description-ar":"ما صُرف، والمسيّر.","content":{"application/json":{"example":{"payments_created":42,"allocations_created":42,"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}}},"schema":{"type":"object","properties":{"payments_created":{"type":"integer","description":"Employee payments recorded.","x-description-ar":"عدد دفعات الموظفين المسجّلة."},"allocations_created":{"type":"integer","description":"Allocations to payslips.","x-description-ar":"عدد التخصيصات على القسائم."},"payroll":{"$ref":"#/components/schemas/payroll_run"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The run cannot be paid.","x-description-ar":"لا يمكن صرف المسيّر.","x-codes":[{"code":"validation_failed","meaning":"`date` is missing, or the run is not finalised.","x-meaning-ar":"`date` ناقص، أو المسيّر غير معتمد.","x-fix":"Send `date`; finalise the run first with `payroll_runs.finalize`.","x-fix-ar":"أرسل `date`، واعتمد المسيّر أولاً عبر `payroll_runs.finalize`."},{"code":"not_available_in_approval_mode","meaning":"The company's Qoyod accounting approves payroll, so payments are recorded when accounting approves the run.","x-meaning-ar":"محاسبة قيود في الشركة توافق على الرواتب، فتُسجَّل الدفعات عند موافقة المحاسبة على المسيّر.","x-fix":"Nothing to do here: wait for the approval in Qoyod.","x-fix-ar":"لا شيء تفعله هنا: انتظر الموافقة في قيود."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Payments are created when accounting approves this run.","code":"not_available_in_approval_mode","error_code":"not_available_in_approval_mode"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["date"],"properties":{"date":{"type":"string","description":"Date the money was paid.","x-description-ar":"تاريخ صرف المال.","format":"date"},"account_ref":{"type":"string","description":"Bank or cash account the money left from, as your books name it.","x-description-ar":"الحساب البنكي أو النقدي الذي خرج منه المال كما تسميه دفاترك."}}},"example":{"date":"2026-10-27","account_ref":"Al Rajhi 0123"}}},"required":true,"description":"The payment."}}},"/payroll/payrolls/{id}/revert":{"patch":{"summary":"Move a payroll run back one step","operationId":"payroll_runs.revert","tags":["Payroll runs"],"description":"Moves a run back one step: `verify_time` → `verify_info`, `verify_earnings` → `verify_time` (releasing the bonuses,\ndeductions and installments it had claimed), `verify_payments` → `verify_earnings`, and `pending_accounting` →\n`verify_payments`, which withdraws the submission and tells Qoyod accounting to discard it. A finalised run cannot\nbe reverted.\n\n**When to use:** to correct something an earlier step produced — the roster, a timesheet, a bonus.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; any status except `verify_info` and `finalized`.\n\n**Side effects:** claimed items return to the pool; a withdrawal is sent to accounting. Recorded in the audit log.\nNot offered to Claude.","x-summary-ar":"إرجاع مسيّر الرواتب خطوة","x-description-ar":"يرجع المسيّر خطوة واحدة: `verify_time` ← `verify_info`، و`verify_earnings` ← `verify_time` (مع تحرير ما حجزه من\nمكافآت واستقطاعات وأقساط)، و`verify_payments` ← `verify_earnings`، و`pending_accounting` ← `verify_payments` وهو سحب\nللإرسال مع إبلاغ محاسبة قيود بإهماله. لا يمكن إرجاع مسيّر معتمد نهائياً.\n\n**متى تستخدمه:** لتصحيح شيء أنتجته خطوة سابقة — قائمة الموظفين أو سجل وقت أو مكافأة.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ بأي حالة عدا `verify_info` و`finalized`.\n\n**الآثار الجانبية:** تعود البنود المحجوزة إلى المتاح، ويُرسل السحب إلى المحاسبة. يُسجَّل في سجل التدقيق. لا يُعرض على\nClaude.","x-access":"write","x-permission":{"key":"payroll_run/transition","label":"Advance or revert a payroll run","x-label-ar":"تقديم أو إرجاع مسير الرواتب"},"x-feature":"payroll_run","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"}],"responses":{"200":{"description":"The run at its new step.","x-description-ar":"المسيّر في خطوته الجديدة.","content":{"application/json":{"example":{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"leave_warnings":[],"accounting":{"state":"posted","mode":"legacy","event_id":"6f1c2a7e-3b44-4c1e-9a55-2f0d7c9b1e20","journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"reason":null,"retryable":false,"repost_allowed":false}},"schema":{"$ref":"#/components/schemas/payroll_run_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The step is not allowed now.","x-description-ar":"الخطوة غير مسموحة الآن.","x-codes":[{"code":"validation_failed","meaning":"This step is not allowed from the run's current status.","x-meaning-ar":"هذه الخطوة غير مسموحة من حالة المسيّر الحالية.","x-fix":"Read the run's `status` with `payroll_runs.show` and call the step that follows it.","x-fix-ar":"اقرأ `status` المسيّر عبر `payroll_runs.show` واستدعِ الخطوة التالية له."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This step is not allowed from the run's current status.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{id}/wps_export":{"get":{"summary":"Download a run's WPS bank file","operationId":"payroll_runs.wps_export","tags":["Payroll runs"],"description":"Returns the Wage Protection System (WPS) upload for the bank as an Excel file: one row per payslip with a\npositive net — ID or Iqama, IBAN, name, bank code, basic, housing, other allowances, deductions and the\ntotal to transfer. A row with a missing IBAN or unknown bank is written with that cell blank; employees\npaid in a currency other than SAR are left out, since WPS transfers riyals only.\n\n**When to use:** to pay a run through the bank. Call it first with `validate_only=true` to get, as JSON,\nthe `warnings` (`iban_missing`, `unknown_bank`, `foreign_currency`, naming each employee) and the number of\n`rows`, then fix the data or download.\n\n**Prerequisites:** the run `id` from `payroll_runs.list`; usually a finalised run.\n\n**Side effects:** none. Returns a file (`.xlsx`) unless `validate_only=true`, so it is not offered to Claude.","x-summary-ar":"تنزيل ملف حماية الأجور (WPS) لمسيّر","x-description-ar":"يعيد ملف نظام حماية الأجور (WPS) للبنك بصيغة Excel: صف لكل قسيمة صافيها موجب — رقم الهوية أو الإقامة والآيبان\nوالاسم ورمز البنك والأساسي والسكن والبدلات الأخرى والاستقطاعات والمبلغ المطلوب تحويله. الصف الذي ينقصه آيبان\nأو بنك معروف يُكتب مع ترك الخانة فارغة، ويُستبعد من تُصرف رواتبهم بغير الريال لأن النظام يحوّل بالريال فقط.\n\n**متى تستخدمه:** لصرف المسيّر عبر البنك. استدعِه أولاً مع `validate_only=true` لتحصل بصيغة JSON على\n`warnings` (`iban_missing` و`unknown_bank` و`foreign_currency` مع اسم كل موظف) وعدد `rows`، ثم صحّح البيانات\nأو نزّل الملف.\n\n**المتطلبات:** رقم `id` المسيّر من `payroll_runs.list`؛ وعادةً يكون معتمداً نهائياً.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`.xlsx`) ما لم يُرسل `validate_only=true`، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payroll_run_id"},{"name":"validate_only","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` answers JSON `{ warnings, rows }` instead of the file.","x-description-ar":"`true` يعيد JSON بالشكل `{ warnings, rows }` بدل الملف.","example":true}],"responses":{"200":{"description":"The WPS file; or, with `validate_only=true`, the JSON preflight `{ warnings, rows }`.","x-description-ar":"ملف حماية الأجور؛ أو مع `validate_only=true` فحص مسبق بصيغة JSON بالشكل `{ warnings, rows }`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"type":"object","description":"The preflight, answered instead of the file when `validate_only=true`.","x-description-ar":"الفحص المسبق، يُعاد بدل الملف عند `validate_only=true`.","properties":{"rows":{"type":"integer","description":"Rows the file would have (payslips with a positive net, paid in SAR).","x-description-ar":"عدد صفوف الملف (القسائم ذات الصافي الموجب المصروفة بالريال)."},"warnings":{"type":"array","description":"Employees whose row needs attention.","x-description-ar":"موظفون يحتاج صفهم إلى مراجعة.","items":{"type":"object","properties":{"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Employee name.","x-description-ar":"اسم الموظف."},"issue":{"type":"string","description":"`iban_missing` (cell left blank; the bank rejects the row), `unknown_bank` (bank code left blank), or `foreign_currency` (left out of the file; pay another way).","x-description-ar":"`iban_missing` خانة الآيبان فارغة ويرفض البنك الصف، `unknown_bank` رمز البنك فارغ، `foreign_currency` مستبعد من الملف فاصرف له بطريقة أخرى.","enum":["iban_missing","unknown_bank","foreign_currency"]},"currency":{"type":"string","description":"The pay currency, on `foreign_currency`.","x-description-ar":"عملة الراتب مع `foreign_currency`."}}}}}},"example":{"warnings":[{"employee_no":"E-0042","name":"Sara Ahmed","issue":"iban_missing"},{"employee_no":"E-0051","name":"John Smith","issue":"foreign_currency","currency":"USD"}],"rows":40}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/payrolls/{payroll_id}/timesheets":{"get":{"summary":"List a payroll run's timesheets","operationId":"timesheets.list","tags":["Payroll runs"],"description":"Returns one timesheet per employee on the run, in minutes: scheduled, worked, overtime, absence and\nundertime, whether the figures were typed by hand, and how many approved overtime requests and incidents\nfed them.\n\n**When to use:** at the `verify_time` step, to check the time payroll will price (\"how much overtime does\nSara have this month?\") before `payroll_runs.calculate_earnings`.\n\n**Prerequisites:** `payroll_id` from `payroll_runs.list`. Timesheets exist once\n`payroll_runs.calculate_time` has run.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض سجلات الوقت لمسيّر رواتب","x-description-ar":"يعرض سجل وقت لكل موظف في المسيّر بالدقائق: المجدول والمحتسب والإضافي والغياب والنقص، وهل أُدخلت الأرقام يدوياً،\nوعدد طلبات العمل الإضافي والحالات المعتمدة التي غذّتها.\n\n**متى تستخدمه:** في خطوة `verify_time` لمراجعة الوقت الذي سيسعّره المسيّر («كم ساعة إضافية لسارة هذا الشهر؟»)\nقبل `payroll_runs.calculate_earnings`.\n\n**المتطلبات:** `payroll_id` من `payroll_runs.list`. تُنشأ سجلات الوقت بعد تنفيذ `payroll_runs.calculate_time`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/timesheet_payroll_id"},{"name":"q[employee_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"name":"q[employee_first_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"First name contains.","x-description-ar":"الاسم الأول يحتوي على.","example":"Sara"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of timesheets.","x-description-ar":"صفحة من سجلات الوقت.","content":{"application/json":{"example":{"records":[{"id":4410,"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","required_mins":9600,"worked_mins":9720,"absence":0,"overtime":180,"undertime":60,"manual_override":false,"balanced":true,"sources":{"overtime_requests":1,"absence_incidents":0,"undertime_incidents":2}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/timesheet"},"description":"The timesheets, by id.","x-description-ar":"سجلات الوقت حسب الرقم."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/payrolls/{payroll_id}/timesheets/bulk_upload":{"post":{"summary":"Upload a run's timesheets from a spreadsheet","operationId":"timesheets.bulk_upload","tags":["Payroll runs"],"description":"Reads an Excel file (the one from `timesheets.template`) with the columns `employee_no`, `overtime_hours`,\n`absence_hours` and `undertime_hours`, and sets those hours on each employee's timesheet. Rows whose figures\nchanged are marked as typed by hand. Rows that fail (an employee not on the run, too many hours) are listed in\n`errors` with their row number; the others are saved.\n\n**When to use:** at `verify_time`, to load time recorded outside QHR for many employees at once.\n\n**Prerequisites:** `payroll_id` from `payroll_runs.list`; the run must be at `verify_time`.\n\n**Side effects:** overwrites the time of every employee in the file, which payroll then prices. Recorded in the\naudit log. A file upload changing many employees' pay, so not offered to Claude.","x-summary-ar":"رفع سجلات وقت المسيّر من ملف Excel","x-description-ar":"يقرأ ملف Excel (الملف من `timesheets.template`) بالأعمدة `employee_no` و`overtime_hours` و`absence_hours`\nو`undertime_hours`، ويضع هذه الساعات في سجل وقت كل موظف. تُعلَّم الصفوف التي تغيّرت أرقامها بأنها مُدخلة يدوياً.\nالصفوف التي تفشل (موظف ليس في المسيّر، ساعات زائدة) تُذكر في `errors` برقم الصف، ويُحفظ الباقي.\n\n**متى تستخدمه:** في `verify_time` لتحميل وقت سُجّل خارج QHR لعدد كبير من الموظفين دفعة واحدة.\n\n**المتطلبات:** `payroll_id` من `payroll_runs.list`؛ ويجب أن يكون المسيّر في `verify_time`.\n\n**الآثار الجانبية:** يستبدل وقت كل موظف في الملف، ويسعّره المسيّر بعد ذلك. يُسجَّل في سجل التدقيق. رفع ملف يغيّر\nرواتب موظفين كثيرين، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"payroll_run/edit","label":"Edit payroll runs","x-label-ar":"تعديل مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/timesheet_payroll_id"}],"responses":{"200":{"description":"How many rows were saved, and which failed.","x-description-ar":"عدد الصفوف المحفوظة، والصفوف التي فشلت.","content":{"application/json":{"example":{"imported":41,"errors":[{"row":9,"employee_no":"E-9999","message":"employee not found on this run"}]},"schema":{"type":"object","properties":{"imported":{"type":"integer","description":"Rows saved.","x-description-ar":"عدد الصفوف المحفوظة."},"errors":{"type":"array","description":"Rows not saved.","x-description-ar":"الصفوف التي لم تُحفظ.","items":{"type":"object","properties":{"row":{"type":"integer","description":"Row number in the file.","x-description-ar":"رقم الصف في الملف."},"employee_no":{"type":"string","description":"Employee number on the row.","x-description-ar":"الرقم الوظيفي في الصف."},"message":{"type":"string","description":"Why it failed.","x-description-ar":"سبب الفشل."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The file was refused.","x-description-ar":"رُفض الملف.","x-codes":[{"code":"validation_failed","meaning":"The run is not at the time-verification step (`verify_time`).","x-meaning-ar":"المسيّر ليس في خطوة مراجعة الوقت (`verify_time`).","x-fix":"Move the run back with `payroll_runs.revert` until it is at `verify_time`.","x-fix-ar":"أرجع المسيّر عبر `payroll_runs.revert` حتى يصل إلى `verify_time`."},{"code":"validation_failed","meaning":"The file is not a readable `.xlsx` with the required columns.","x-meaning-ar":"الملف ليس `.xlsx` مقروءاً بالأعمدة المطلوبة.","x-fix":"Download `timesheets.template`, fill it in and upload it unchanged in shape.","x-fix-ar":"نزّل `timesheets.template` واملأه وارفعه دون تغيير شكله."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The file could not be read. Upload a valid .xlsx with the required columns.","code":"validation_failed"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"string","format":"binary"}}},"required":true,"description":"The filled-in `.xlsx`, from `timesheets.template`."}}},"/payroll/payrolls/{payroll_id}/timesheets/refresh":{"post":{"summary":"Refresh a run's timesheets from approved records","operationId":"timesheets.refresh","tags":["Payroll runs"],"description":"Re-reads approved overtime requests and absence and lateness incidents for the run's period and updates every\ntimesheet nobody typed by hand. It is all or nothing: if one row would become invalid, nothing changes and\nthe error names the employee.\n\n**When to use:** at `verify_time`, after overtime or incidents were approved since the timesheets were built.\n\n**Prerequisites:** `payroll_id` from `payroll_runs.list`; the run must be at `verify_time`.\n\n**Side effects:** timesheets change, and so will the pay calculated from them. Recorded in the audit log. Not\noffered to Claude, as a payroll step.","x-summary-ar":"تحديث سجلات وقت المسيّر من السجلات المعتمدة","x-description-ar":"يعيد قراءة طلبات العمل الإضافي وحالات الغياب والتأخير المعتمدة لفترة المسيّر ويحدّث كل سجل وقت لم يُدخله أحد\nيدوياً. يتم كله أو لا يتم: إن كان سيصبح أحد الصفوف غير صحيح فلا يتغير شيء ويذكر الخطأ اسم الموظف.\n\n**متى تستخدمه:** في `verify_time` بعد اعتماد عمل إضافي أو حالات منذ إنشاء سجلات الوقت.\n\n**المتطلبات:** `payroll_id` من `payroll_runs.list`؛ ويجب أن يكون المسيّر في `verify_time`.\n\n**الآثار الجانبية:** تتغير سجلات الوقت ومعها الرواتب المحتسبة منها. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nخطوة رواتب.","x-access":"write","x-permission":{"key":"payroll_run/edit","label":"Edit payroll runs","x-label-ar":"تعديل مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/timesheet_payroll_id"}],"responses":{"200":{"description":"What the refresh did.","x-description-ar":"ما قام به التحديث.","content":{"application/json":{"example":{"created":0,"refreshed":3,"unchanged":38,"skipped_manual_override":1,"skipped_employee_ids":[1203]},"schema":{"type":"object","properties":{"created":{"type":"integer","description":"Timesheets created for employees that had none.","x-description-ar":"سجلات أُنشئت لموظفين بلا سجل."},"refreshed":{"type":"integer","description":"Timesheets whose figures changed.","x-description-ar":"سجلات تغيّرت أرقامها."},"unchanged":{"type":"integer","description":"Timesheets already up to date.","x-description-ar":"سجلات كانت محدّثة."},"skipped_manual_override":{"type":"integer","description":"Timesheets left alone because typed by hand.","x-description-ar":"سجلات تُركت لأنها مُدخلة يدوياً."},"skipped_employee_ids":{"type":"array","description":"Employees of those skipped rows.","x-description-ar":"موظفو السجلات المتروكة.","items":{"type":"integer"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The timesheets cannot be refreshed.","x-description-ar":"لا يمكن تحديث سجلات الوقت.","x-codes":[{"code":"validation_failed","meaning":"The run is not at the time-verification step (`verify_time`).","x-meaning-ar":"المسيّر ليس في خطوة مراجعة الوقت (`verify_time`).","x-fix":"Move the run back with `payroll_runs.revert` until it is at `verify_time`.","x-fix-ar":"أرجع المسيّر عبر `payroll_runs.revert` حتى يصل إلى `verify_time`."},{"code":"validation_failed","meaning":"A row would become invalid (absence and undertime exceed the employee's time); `error` names the employee. Nothing was changed.","x-meaning-ar":"سيصبح أحد الصفوف غير صحيح (الغياب والنقص يتجاوزان وقت الموظف)؛ ويذكر `error` الموظف. لم يتغير شيء.","x-fix":"Correct that employee's time with `timesheets.update`, then refresh again.","x-fix-ar":"صحّح وقت ذلك الموظف عبر `timesheets.update` ثم أعد التحديث."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Timesheets can only be edited while the run is in the time-verification step.","code":"validation_failed"}}}}}}},"/payroll/payrolls/{payroll_id}/timesheets/template":{"get":{"summary":"Download a run's timesheet spreadsheet","operationId":"timesheets.template","tags":["Payroll runs"],"description":"Returns an Excel file with one row per employee on the run, pre-filled with their current overtime, absence\nand undertime hours, in the columns `timesheets.bulk_upload` expects.\n\n**When to use:** to correct many employees' time outside QHR: download, edit, upload with\n`timesheets.bulk_upload`.\n\n**Prerequisites:** `payroll_id` from `payroll_runs.list`.\n\n**Side effects:** none. Returns a file (`.xlsx`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل ملف سجلات الوقت لمسيّر","x-description-ar":"يعيد ملف Excel بصف لكل موظف في المسيّر، معبّأ مسبقاً بساعات العمل الإضافي والغياب والنقص الحالية، بالأعمدة التي\nيتوقعها `timesheets.bulk_upload`.\n\n**متى تستخدمه:** لتصحيح وقت موظفين كثيرين خارج QHR: نزّل الملف وعدّله ثم ارفعه عبر `timesheets.bulk_upload`.\n\n**المتطلبات:** `payroll_id` من `payroll_runs.list`.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`.xlsx`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"payroll_run/view","label":"View payroll runs","x-label-ar":"عرض مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/timesheet_payroll_id"}],"responses":{"200":{"description":"The spreadsheet.","x-description-ar":"الملف.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/payrolls/{payroll_id}/timesheets/{id}":{"patch":{"summary":"Correct an employee's time on a payroll run","operationId":"timesheets.update","tags":["Payroll runs"],"description":"Sets an employee's overtime, absence and undertime minutes on the run. The figures you send win from now on:\nthe row is marked as typed by hand and `timesheets.refresh` leaves it alone.\n\n**When to use:** at `verify_time`, for time the approved records do not reflect (an overtime agreed outside\nQHR). For many employees at once use `timesheets.bulk_upload`.\n\n**Prerequisites:** `payroll_id` from `payroll_runs.list` and the timesheet `id` from `timesheets.list`. The\nrun must be at `verify_time`.\n\n**Side effects:** the employee's payslip will be priced from these minutes. Recorded in the audit log. Not\noffered to Claude, because it changes what the employee is paid.","x-summary-ar":"تصحيح وقت موظف في مسيّر رواتب","x-description-ar":"يحدّد دقائق العمل الإضافي والغياب والنقص للموظف في المسيّر. تُعتمد الأرقام المرسلة من الآن: يُعلَّم السجل بأنه\nمُدخل يدوياً ولا يغيّره `timesheets.refresh`.\n\n**متى تستخدمه:** في `verify_time` لوقت لا تعكسه السجلات المعتمدة (عمل إضافي اتُّفق عليه خارج QHR). لعدد كبير من\nالموظفين استخدم `timesheets.bulk_upload`.\n\n**المتطلبات:** `payroll_id` من `payroll_runs.list` ورقم `id` السجل من `timesheets.list`. يجب أن يكون المسيّر في\n`verify_time`.\n\n**الآثار الجانبية:** تُسعَّر قسيمة الموظف من هذه الدقائق. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما\nيُصرف للموظف.","x-access":"write","x-permission":{"key":"payroll_run/edit","label":"Edit payroll runs","x-label-ar":"تعديل مسيرات الرواتب"},"x-feature":"payroll_run","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/timesheet_payroll_id"},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Timesheet id, from `timesheets.list`.","x-description-ar":"رقم سجل الوقت، من `timesheets.list`.","example":4410}],"responses":{"200":{"description":"The timesheet after the change.","x-description-ar":"سجل الوقت بعد التعديل.","content":{"application/json":{"example":{"id":4410,"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","required_mins":9600,"worked_mins":9720,"absence":0,"overtime":180,"undertime":60,"manual_override":true,"balanced":true,"sources":{"overtime_requests":1,"absence_incidents":0,"undertime_incidents":2}},"schema":{"$ref":"#/components/schemas/timesheet"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The time cannot be set.","x-description-ar":"لا يمكن تعيين الوقت.","x-codes":[{"code":"validation_failed","meaning":"The run is not at the time-verification step (`verify_time`).","x-meaning-ar":"المسيّر ليس في خطوة مراجعة الوقت (`verify_time`).","x-fix":"Move the run back with `payroll_runs.revert` until it is at `verify_time`.","x-fix-ar":"أرجع المسيّر عبر `payroll_runs.revert` حتى يصل إلى `verify_time`."},{"code":"validation_failed","meaning":"A figure is negative, or absence and undertime exceed the available time (required + overtime).","x-meaning-ar":"رقم سالب، أو يتجاوز الغياب والنقص الوقت المتاح (المجدول + الإضافي).","x-fix":"Send whole, non-negative minutes that fit the employee's time.","x-fix-ar":"أرسل دقائق صحيحة غير سالبة تتسع لها أوقات الموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This timesheet belongs to a run that is not in the time-verification step and can no longer be edited.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["timesheet"],"properties":{"timesheet":{"type":"object","description":"Only the figures to change, in whole minutes.","x-description-ar":"الأرقام المراد تعديلها فقط، بالدقائق الصحيحة.","properties":{"overtime":{"type":"integer","description":"Overtime minutes.","x-description-ar":"دقائق العمل الإضافي.","minimum":0},"absence":{"type":"integer","description":"Absence minutes.","x-description-ar":"دقائق الغياب.","minimum":0},"undertime":{"type":"integer","description":"Lateness and early-leave minutes.","x-description-ar":"دقائق التأخير والخروج المبكر.","minimum":0}}}}},"example":{"timesheet":{"overtime":180,"absence":0,"undertime":60}}}},"required":true,"description":"The minutes to set."}}},"/payroll/payslips":{"get":{"summary":"List payslips, grouped by payroll run","operationId":"payslips.list","tags":["Payslips"],"description":"Returns payslips grouped by payroll run, newest run first: each record is a run's summary (`payroll`)\nwith its matching payslips (`payslips`) — totals, net, what was paid and what is still due. Draft payslips\nof runs still being prepared are included; employees cannot see those yet.\n\n**When to use:** to answer \"what did we pay in October?\", \"who is still unpaid?\" (`status=unpaid`) or\n\"what was Sara's net last month?\" (`q[employee_id_eq]`). For one payslip's lines use `payslips.show`.\n\n**Prerequisites:** none. `payroll_id` comes from `payroll_runs.list`, `employee_id` from `employees.list`.\n\n**Side effects:** none. A page holds up to 20 runs; a run with no matching payslip is left out.","x-summary-ar":"عرض قسائم الرواتب مجمّعة حسب المسيّر","x-description-ar":"يعرض قسائم الرواتب مجمّعة حسب مسيّر الرواتب، الأحدث أولاً: كل سجل هو ملخص مسيّر (`payroll`) مع قسائمه\nالمطابقة (`payslips`) — الإجماليات والصافي والمصروف والمتبقي. تشمل القائمة القسائم المسودة لمسيّرات\nما زالت قيد الإعداد، ولا يراها الموظفون بعد.\n\n**متى تستخدمه:** للإجابة عن «ماذا صرفنا في أكتوبر؟» و«من لم يُصرف له بعد؟» (`status=unpaid`) و«كم كان\nصافي راتب سارة الشهر الماضي؟» (`q[employee_id_eq]`). لبنود قسيمة واحدة استخدم `payslips.show`.\n\n**المتطلبات:** لا شيء. `payroll_id` من `payroll_runs.list`، و`employee_id` من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. الصفحة تضم حتى ٢٠ مسيّراً، ويُستبعد المسيّر الذي لا قسيمة مطابقة فيه.","x-access":"read","x-permission":{"key":"payslip/view","label":"View payslips and earnings","x-label-ar":"عرض كشوف الرواتب والمستحقات"},"x-feature":"payslip","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"payroll_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this payroll run, from `payroll_runs.list`.","x-description-ar":"هذا المسيّر فقط، من `payroll_runs.list`.","example":77},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["unpaid","partial","paid","not_required"]},"description":"Only payslips with this payment status.","x-description-ar":"القسائم بحالة الصرف هذه فقط.","example":"unpaid"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee, from `employees.list`.","x-description-ar":"هذا الموظف فقط، من `employees.list`.","example":1203},{"name":"q[employee_employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee name contains.","x-description-ar":"اسم الموظف يحتوي على.","example":"Sara"},{"name":"q[employee_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"E-004"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of payroll runs with their payslips.","x-description-ar":"صفحة من المسيّرات مع قسائمها.","content":{"application/json":{"example":{"records":[{"payroll":{"id":77,"reference":"PYR-0042","pay_cycle":"monthly","status":"finalized","description":"October 2026 payroll","location_id":null,"payment_date":"2026-10-27","from":"2026-10-01","to":"2026-10-31","employees_count":42,"total_due":{"SAR":"0.00"},"totals":{"SAR":{"slips":42,"total_incomes":"441000.00","total_deductions":"39690.00","total_paid":"401310.00","due":"0.00"}}},"payslips":[{"id":5120,"payroll_id":77,"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","total_incomes":"10500.0","total_deductions":"945.0","net":"9555.0","total_paid":"0.0","due":"9555.0","payment_status":"unpaid","currency":"SAR","period":"2026-10","finalized":true}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"One entry per run.","x-description-ar":"مدخل لكل مسيّر.","items":{"type":"object","properties":{"payroll":{"$ref":"#/components/schemas/payroll_run"},"payslips":{"type":"array","items":{"$ref":"#/components/schemas/payslip"},"description":"The run's matching payslips, by id.","x-description-ar":"قسائم المسيّر المطابقة، حسب الرقم."}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/payslips/export":{"get":{"summary":"Export payslips to Excel or CSV","operationId":"payslips.export","tags":["Payslips"],"description":"Builds a file of the payslips, one row per payslip, with the columns you choose (employee, period, currency,\nincomes, deductions, net, paid, due, payment status…) and a totals row per currency. It takes the same\nfilters as `payslips.list`, so the file matches what the list shows.\n\n**When to use:** to hand payroll figures to finance or the bank, or to archive a month. To read figures,\n`payslips.list` is lighter.\n\n**Prerequisites:** column keys from `payslips.export_columns`; `payroll_id` from `payroll_runs.list`. You need\n\"Export payroll data\" as well as \"View payslips\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير قسائم الرواتب إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بالقسائم، صفاً لكل قسيمة، بالأعمدة التي تختارها (الموظف والفترة والعملة والاستحقاقات\nوالاستقطاعات والصافي والمصروف والمتبقي وحالة الصرف…) مع صف إجماليات لكل عملة. يقبل مرشحات\n`payslips.list` نفسها، فيطابق الملف ما تعرضه القائمة.\n\n**متى تستخدمه:** لتسليم أرقام الرواتب إلى المالية أو البنك، أو لأرشفة شهر. لقراءة الأرقام فقط\n`payslips.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `payslips.export_columns`، و`payroll_id` من `payroll_runs.list`. تحتاج\n«تصدير بيانات الرواتب» إضافة إلى «عرض قسائم الرواتب» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payslip/view","label":"View payslips and earnings","x-label-ar":"عرض كشوف الرواتب والمستحقات"}]},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]},{"name":"payroll_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this payroll run, from `payroll_runs.list`.","x-description-ar":"هذا المسيّر فقط، من `payroll_runs.list`.","example":77},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["unpaid","partial","paid","not_required"]},"description":"Only payslips with this payment status.","x-description-ar":"القسائم بحالة الصرف هذه فقط.","example":"unpaid"}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/payroll/payslips/export/columns":{"get":{"summary":"List the columns a payslips export can have","operationId":"payslips.export_columns","tags":["Payslips"],"description":"Returns the columns of the payslips export that your role may see, in screen order, with their header in\nthe requested language and whether QHR ticks them by default.\n\n**When to use:** before `payslips.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"View payslips\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير قسائم الرواتب","x-description-ar":"يعرض أعمدة تصدير القسائم التي يحق لدورك رؤيتها بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب وهل يحدده QHR\nافتراضياً.\n\n**متى تستخدمه:** قبل `payslips.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «عرض قسائم الرواتب».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"payslip/view","label":"View payslips and earnings","x-label-ar":"عرض كشوف الرواتب والمستحقات"}]},"x-feature":"payslip","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"employee_no","label":"Employee ID","default":true,"type":"string"},{"key":"employee_name","label":"Employee Name","default":true,"type":"string"},{"key":"net","label":"Net","default":true,"type":"money"},{"key":"payment_status","label":"Payment Status","default":true,"type":"enum"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/payroll/payslips/{id}":{"get":{"summary":"Get a payslip with its lines","operationId":"payslips.show","tags":["Payslips"],"description":"Returns one payslip with every line on it: basic salary, allowances, overtime and absence, bonuses,\ndeductions, loan and custody installments, and the employee's and employer's insurance shares. Lines that\nare switched off (`applies: false`) are listed but do not count in the totals.\n\n**When to use:** to explain how a net figure was reached, or before editing a line with\n`payslips.update_line` / `payslips.toggle_line`.\n\n**Prerequisites:** the payslip `id` from `payslips.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض قسيمة راتب مع بنودها","x-description-ar":"يعرض قسيمة واحدة بكل بنودها: الراتب الأساسي والبدلات والعمل الإضافي والغياب والمكافآت والاستقطاعات وأقساط\nالسلف والعهد وحصتي الموظف والمنشأة من التأمينات. تظهر البنود المعطّلة (`applies: false`) لكنها لا تدخل في\nالإجماليات.\n\n**متى تستخدمه:** لشرح كيف حُسب الصافي، أو قبل تعديل بند عبر `payslips.update_line` أو\n`payslips.toggle_line`.\n\n**المتطلبات:** رقم `id` القسيمة من `payslips.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payslip/view","label":"View payslips and earnings","x-label-ar":"عرض كشوف الرواتب والمستحقات"},"x-feature":"payslip","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payslip_id"}],"responses":{"200":{"description":"The payslip.","x-description-ar":"القسيمة.","content":{"application/json":{"example":{"payslip":{"id":5120,"payroll_id":77,"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","total_incomes":"10500.0","total_deductions":"945.0","net":"9555.0","total_paid":"0.0","due":"9555.0","payment_status":"unpaid","currency":"SAR","period":"2026-10","finalized":true,"earnings":[{"id":90411,"earnable_type":"Salary","earnable_id":310,"kind":"income","amount":"9000.0","applies":true,"flag":false,"description_en":"Basic salary","description_ar":"الراتب الأساسي","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90412,"earnable_type":"Benefit","earnable_id":311,"kind":"income","amount":"1500.0","applies":true,"flag":false,"description_en":"Housing allowance","description_ar":"بدل السكن","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90413,"earnable_type":"InsuranceDeduction","earnable_id":52,"kind":"deduction","amount":"945.0","applies":true,"flag":true,"description_en":"GOSI (employee share)","description_ar":"التأمينات الاجتماعية (حصة الموظف)","auto_deferred":false,"applies_overridden":false,"currency":"SAR"}]}},"schema":{"type":"object","properties":{"payslip":{"$ref":"#/components/schemas/payslip_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/payslips/{id}/pdf":{"get":{"summary":"Download a payslip as PDF","operationId":"payslips.pdf","tags":["Payslips"],"description":"Returns the payslip as a bilingual (Arabic and English) PDF, as the employee receives it: company, employee,\nperiod, every applied line and the net.\n\n**When to use:** to send or archive a payslip. Only payslips of finalised runs have a PDF.\n\n**Prerequisites:** the payslip `id` from `payslips.list`.\n\n**Side effects:** none. Returns a file (`application/pdf`), not JSON, so it is not offered to Claude.","x-summary-ar":"تنزيل قسيمة راتب بصيغة PDF","x-description-ar":"يعيد القسيمة ملف PDF ثنائي اللغة (عربي وإنجليزي) كما يستلمها الموظف: الشركة والموظف والفترة وكل البنود\nالمفعّلة والصافي.\n\n**متى تستخدمه:** لإرسال القسيمة أو أرشفتها. لا يوجد PDF إلا لقسائم المسيّرات المعتمدة نهائياً.\n\n**المتطلبات:** رقم `id` القسيمة من `payslips.list`.\n\n**الآثار الجانبية:** لا شيء. يعيد ملفاً (`application/pdf`) لا JSON، لذلك لا يُعرض على Claude.","x-access":"read","x-permission":{"key":"payslip/view","label":"View payslips and earnings","x-label-ar":"عرض كشوف الرواتب والمستحقات"},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payslip_id"}],"responses":{"200":{"description":"The PDF file.","x-description-ar":"ملف PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The payslip has no PDF yet.","x-description-ar":"لا يوجد ملف PDF للقسيمة بعد.","x-codes":[{"code":"validation_failed","meaning":"The payroll run is not finalised yet, so the payslip has no PDF.","x-meaning-ar":"لم يُعتمد المسيّر نهائياً بعد، فلا يوجد ملف PDF للقسيمة.","x-fix":"Wait until the run is finalised (`payroll_runs.show`, `status: finalized`).","x-fix-ar":"انتظر حتى يُعتمد المسيّر نهائياً (`payroll_runs.show`، `status: finalized`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A payslip PDF is only available once the payroll run is finalized.","code":"validation_failed"}}}}}}},"/payroll/payslips/{id}/recalculate":{"post":{"summary":"Recalculate a payslip","operationId":"payslips.recalculate","tags":["Payslips"],"description":"Rebuilds one payslip from the current data — salary, allowances, timesheet, approved bonuses and deductions,\nloan installments and insurance — replacing its calculated lines and totals.\n\n**When to use:** after correcting an employee's salary, timesheet, bonus or deduction while the run is\nverifying earnings or payments, so the payslip reflects the change without recalculating the whole run.\n\n**Prerequisites:** the payslip `id` from `payslips.list`. The run must be at `verify_earnings` or\n`verify_payments` (`payroll_runs.show`), and no payment may be allocated to the payslip yet.\n\n**Side effects:** lines edited by hand are rebuilt; the run's totals change. Recorded in the audit log.\nNot offered to Claude, because it changes what the employee is paid.","x-summary-ar":"إعادة احتساب قسيمة راتب","x-description-ar":"يعيد بناء قسيمة واحدة من البيانات الحالية — الراتب والبدلات وسجل الوقت والمكافآت والاستقطاعات المعتمدة\nوأقساط السلف والتأمينات — فتُستبدل بنودها المحتسبة وإجمالياتها.\n\n**متى تستخدمه:** بعد تصحيح راتب موظف أو سجل وقته أو مكافأة أو استقطاع أثناء مراجعة الاستحقاقات أو الصرف،\nلتعكس القسيمة التغيير دون إعادة احتساب المسيّر كله.\n\n**المتطلبات:** رقم `id` القسيمة من `payslips.list`. يجب أن يكون المسيّر في `verify_earnings` أو\n`verify_payments` (`payroll_runs.show`)، وألا يكون على القسيمة أي صرف مخصص بعد.\n\n**الآثار الجانبية:** يُعاد بناء البنود المعدّلة يدوياً وتتغير إجماليات المسيّر. يُسجَّل في سجل التدقيق. لا\nيُعرض على Claude لأنه يغيّر ما يُصرف للموظف.","x-access":"write","x-permission":{"key":"payslip/edit","label":"Edit, delete and toggle payslip earnings","x-label-ar":"تعديل وحذف وتبديل مستحقات كشف الراتب"},"x-feature":"payslip","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/payslip_id"}],"responses":{"200":{"description":"The recalculated payslip with its lines.","x-description-ar":"القسيمة بعد إعادة الاحتساب مع بنودها.","content":{"application/json":{"example":{"payslip":{"id":5120,"payroll_id":77,"employee_id":1203,"employee_no":"E-0042","name":"Sara Ahmed","total_incomes":"10500.0","total_deductions":"945.0","net":"9555.0","total_paid":"0.0","due":"9555.0","payment_status":"unpaid","currency":"SAR","period":"2026-10","finalized":false,"earnings":[{"id":90411,"earnable_type":"Salary","earnable_id":310,"kind":"income","amount":"9000.0","applies":true,"flag":false,"description_en":"Basic salary","description_ar":"الراتب الأساسي","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90412,"earnable_type":"Benefit","earnable_id":311,"kind":"income","amount":"1500.0","applies":true,"flag":false,"description_en":"Housing allowance","description_ar":"بدل السكن","auto_deferred":false,"applies_overridden":false,"currency":"SAR"},{"id":90413,"earnable_type":"InsuranceDeduction","earnable_id":52,"kind":"deduction","amount":"945.0","applies":true,"flag":true,"description_en":"GOSI (employee share)","description_ar":"التأمينات الاجتماعية (حصة الموظف)","auto_deferred":false,"applies_overridden":false,"currency":"SAR"}]}},"schema":{"type":"object","properties":{"payslip":{"$ref":"#/components/schemas/payslip_detail"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The payslip cannot be recalculated now.","x-description-ar":"لا يمكن إعادة احتساب القسيمة الآن.","x-codes":[{"code":"validation_failed","meaning":"The run is not verifying earnings or payments, or the payslip already has payments allocated to it.","x-meaning-ar":"المسيّر ليس في مراجعة الاستحقاقات أو الصرف، أو على القسيمة صرف مخصص.","x-fix":"Move the run back with `payroll_runs.revert`, or remove the allocations first.","x-fix-ar":"أرجع المسيّر عبر `payroll_runs.revert`، أو احذف التخصيصات أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Payslips can only be recalculated while the run is verifying earnings or payments.","code":"validation_failed"}}}}}}},"/payroll/salaries":{"get":{"summary":"List an employee's salary history","operationId":"salaries.list","tags":["Salaries"],"description":"Returns every salary an employee has had, newest first, each with its allowances, fixed deductions and\ninsurance enrolments, its status and the dates it applied.\n\n**When to use:** to answer \"when did Sara's salary change and by how much?\". For the salary payroll uses\ntoday, `salaries.active` is lighter.\n\n**Prerequisites:** `employee_id` from `employees.list` or `employees.search`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض سجل رواتب موظف","x-description-ar":"يعرض كل الرواتب التي حصل عليها الموظف، الأحدث أولاً، مع البدلات والاستقطاعات الثابتة واشتراكات التأمين\nوالحالة والفترة التي سرى فيها كل راتب.\n\n**متى تستخدمه:** للإجابة عن «متى تغيّر راتب سارة وبكم؟». للراتب الذي يعتمده المسيّر اليوم استخدم\n`salaries.active` فهو أخف.\n\n**المتطلبات:** `employee_id` من `employees.list` أو `employees.search`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"salary/view","label":"View compensation","x-label-ar":"عرض الرواتب"},"x-feature":"salary","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/salary_employee_id"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of salaries.","x-description-ar":"صفحة من الرواتب.","content":{"application/json":{"example":{"records":[{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","input_time_type":"employed_time","start_date":"2026-01-01","end_date":null,"currency":"SAR","benefits":[{"id":311,"kind":"housing","calculation_type":"percent_of_basic","amount":"25.0","description":"Housing","currency":null},{"id":312,"kind":"transportation","calculation_type":"fixed_monthly","amount":"500.0","description":"Transport","currency":"SAR"}],"salary_deductions":[],"insurance_deductions":[{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/salary"},"description":"The salaries, newest first.","x-description-ar":"الرواتب، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Add a salary for an employee","operationId":"salaries.create","tags":["Salaries"],"description":"Adds a salary to an employee: basic amount, pay frequency, start date, allowances and fixed deductions. An\nemployee's first salary becomes active. A later one created as `active` replaces the current salary from\nits start date: the current one ends the day before and becomes inactive, and its insurance enrolments\nmove to the new salary.\n\n**When to use:** for a raise, a promotion or a new contract. Create it as `inactive` to prepare it in\nadvance, then activate it with `salaries.set_status`.\n\n**Prerequisites:** `employee_id` from `employees.list`. Read the current salary with `salaries.active`.\n\n**Side effects:** the next payroll run calculates with the new salary. Recorded in the audit log. Not offered\nto Claude, because it changes what the employee is paid.","x-summary-ar":"إضافة راتب لموظف","x-description-ar":"يضيف راتباً للموظف: المبلغ الأساسي ودورية الصرف وتاريخ البدء والبدلات والاستقطاعات الثابتة. يصبح أول راتب\nللموظف نشطاً. والراتب اللاحق المُنشأ بحالة `active` يحل محل الراتب الحالي من تاريخ بدئه: ينتهي الحالي في\nاليوم السابق ويصبح غير نشط، وتنتقل اشتراكات تأمينه إلى الراتب الجديد.\n\n**متى تستخدمه:** عند زيادة أو ترقية أو عقد جديد. أنشئه بحالة `inactive` لتجهيزه مسبقاً ثم فعّله عبر\n`salaries.set_status`.\n\n**المتطلبات:** `employee_id` من `employees.list`. اقرأ الراتب الحالي عبر `salaries.active`.\n\n**الآثار الجانبية:** يحتسب المسيّر التالي بالراتب الجديد. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيغيّر ما يُصرف للموظف.","x-access":"write","x-permission":{"key":"salary/create","label":"Set compensation","x-label-ar":"تحديد الراتب"},"x-feature":"salary","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new salary.","x-description-ar":"الراتب الجديد.","content":{"application/json":{"example":{"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","input_time_type":"employed_time","start_date":"2026-01-01","end_date":null,"currency":"SAR","benefits":[{"id":311,"kind":"housing","calculation_type":"percent_of_basic","amount":"25.0","description":"Housing","currency":null},{"id":312,"kind":"transportation","calculation_type":"fixed_monthly","amount":"500.0","description":"Transport","currency":"SAR"}],"salary_deductions":[],"insurance_deductions":[{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}]}},"schema":{"type":"object","properties":{"salary":{"$ref":"#/components/schemas/salary"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The salary cannot be added.","x-description-ar":"لا يمكن إضافة الراتب.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"A new active salary must start after the current active salary's start date.","x-meaning-ar":"يجب أن يبدأ الراتب النشط الجديد بعد تاريخ بدء الراتب النشط الحالي.","x-fix":"Use a later `start_date`, or create it as `inactive`.","x-fix-ar":"استخدم `start_date` أحدث، أو أنشئه بحالة `inactive`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Start date must be after the current active salary's start date.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["salary"],"properties":{"salary":{"allOf":[{"$ref":"#/components/schemas/salary_input"}],"type":"object","required":["employee_id","start_date"],"description":"The salary, for `employee_id`.","x-description-ar":"الراتب، للموظف `employee_id`.","properties":{"employee_id":{"type":"integer","description":"The employee, from `employees.list`.","x-description-ar":"الموظف، من `employees.list`."},"status":{"type":"string","description":"`active` or `inactive`. An employee's first salary is active by default.","x-description-ar":"`active` أو `inactive`. أول راتب للموظف نشط افتراضياً.","enum":["active","inactive"]}}}}},"example":{"salary":{"employee_id":1203,"basic_salary_amount":"10000.00","basic_salary_kind":"fixed","pay_frequency":"monthly","start_date":"2026-12-01","status":"active","benefits_attributes":[{"kind":"housing","calculation_type":"percent_of_basic","amount":"25"}]}}}},"required":true,"description":"The new salary."}}},"/payroll/salaries/active":{"get":{"summary":"Get an employee's active salary","operationId":"salaries.active","tags":["Salaries"],"description":"Returns the salary payroll uses for an employee today: basic amount, pay frequency, allowances, fixed\ndeductions and insurance enrolments.\n\n**When to use:** to answer \"what is Sara's salary?\" or before `salaries.update`. For earlier salaries use\n`salaries.list`.\n\n**Prerequisites:** `employee_id` from `employees.list`. An employee with no active salary answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض الراتب النشط لموظف","x-description-ar":"يعرض الراتب الذي يعتمده المسيّر للموظف اليوم: المبلغ الأساسي ودورية الصرف والبدلات والاستقطاعات الثابتة\nواشتراكات التأمين.\n\n**متى تستخدمه:** للإجابة عن «كم راتب سارة؟» أو قبل `salaries.update`. للرواتب السابقة استخدم\n`salaries.list`.\n\n**المتطلبات:** `employee_id` من `employees.list`. الموظف الذي ليس له راتب نشط يُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"salary/view","label":"View compensation","x-label-ar":"عرض الرواتب"},"x-feature":"salary","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/salary_employee_id"}],"responses":{"200":{"description":"The active salary.","x-description-ar":"الراتب النشط.","content":{"application/json":{"example":{"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","input_time_type":"employed_time","start_date":"2026-01-01","end_date":null,"currency":"SAR","benefits":[{"id":311,"kind":"housing","calculation_type":"percent_of_basic","amount":"25.0","description":"Housing","currency":null},{"id":312,"kind":"transportation","calculation_type":"fixed_monthly","amount":"500.0","description":"Transport","currency":"SAR"}],"salary_deductions":[],"insurance_deductions":[{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}]}},"schema":{"type":"object","properties":{"salary":{"$ref":"#/components/schemas/salary"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/salaries/{id}":{"patch":{"summary":"Change a salary","operationId":"salaries.update","tags":["Salaries"],"description":"Changes the fields you send on a salary, and adds, changes or removes its allowances and fixed deductions\n(`benefits_attributes`, `salary_deductions_attributes`; send `id` to change a line, `id` with\n`_destroy: true` to remove it). To activate or deactivate a salary, use `salaries.set_status`.\n\n**When to use:** to correct a salary, or to adjust allowances. For a raise from a date, add a new salary\nwith `salaries.create` so the history keeps the old figure.\n\n**Prerequisites:** the salary `id` from `salaries.active` or `salaries.list`.\n\n**Side effects:** payslips calculated from now on use the new figures; finalised runs do not change.\nRecorded in the audit log. Not offered to Claude, because it changes what the employee is paid.","x-summary-ar":"تعديل راتب","x-description-ar":"يعدّل الحقول التي ترسلها في الراتب، ويضيف البدلات والاستقطاعات الثابتة أو يعدّلها أو يحذفها\n(`benefits_attributes` و`salary_deductions_attributes`؛ أرسل `id` لتعديل بند، و`id` مع `_destroy: true`\nلحذفه). لتفعيل الراتب أو إيقافه استخدم `salaries.set_status`.\n\n**متى تستخدمه:** لتصحيح راتب أو تعديل البدلات. للزيادة من تاريخ معيّن أضف راتباً جديداً عبر\n`salaries.create` ليحتفظ السجل بالمبلغ السابق.\n\n**المتطلبات:** رقم `id` الراتب من `salaries.active` أو `salaries.list`.\n\n**الآثار الجانبية:** تستخدم القسائم المحتسبة من الآن الأرقام الجديدة، ولا تتغير المسيّرات المعتمدة. يُسجَّل في\nسجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف للموظف.","x-access":"write","x-permission":{"key":"salary/edit","label":"Update compensation","x-label-ar":"تعديل الراتب"},"x-feature":"salary","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/salary_id"}],"responses":{"200":{"description":"The salary after the change.","x-description-ar":"الراتب بعد التعديل.","content":{"application/json":{"example":{"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","input_time_type":"employed_time","start_date":"2026-01-01","end_date":null,"currency":"SAR","benefits":[{"id":311,"kind":"housing","calculation_type":"percent_of_basic","amount":"25.0","description":"Housing","currency":null},{"id":312,"kind":"transportation","calculation_type":"fixed_monthly","amount":"500.0","description":"Transport","currency":"SAR"}],"salary_deductions":[],"insurance_deductions":[{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}]}},"schema":{"type":"object","properties":{"salary":{"$ref":"#/components/schemas/salary"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"A new active salary must start after the current active salary's start date.","x-meaning-ar":"يجب أن يبدأ الراتب النشط الجديد بعد تاريخ بدء الراتب النشط الحالي.","x-fix":"Use a later `start_date`, or create it as `inactive`.","x-fix-ar":"استخدم `start_date` أحدث، أو أنشئه بحالة `inactive`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Basic salary amount must be greater than or equal to 0","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["salary"],"properties":{"salary":{"$ref":"#/components/schemas/salary_input"}}},"example":{"salary":{"benefits_attributes":[{"kind":"transportation","calculation_type":"fixed_monthly","amount":"500"}]}}}},"required":true,"description":"The fields to change."}}},"/payroll/salaries/{id}/set_status":{"patch":{"summary":"Activate or deactivate a salary","operationId":"salaries.set_status","tags":["Salaries"],"description":"Makes a salary `active` or `inactive`. Activating one replaces the employee's current active salary: that\none ends the day before the new start date, and its insurance enrolments move across. Deactivating leaves\nthe employee with no active salary, so payroll stops paying them.\n\n**When to use:** to switch to a salary prepared in advance once its start date has come, or to stop pay.\n\n**Prerequisites:** the salary `id` from `salaries.list`. A salary cannot be activated before its start date.\n\n**Side effects:** decides whether and how much the employee is paid in the next run. Recorded in the audit\nlog. Not offered to Claude.","x-summary-ar":"تفعيل راتب أو إيقافه","x-description-ar":"يجعل الراتب `active` نشطاً أو `inactive` غير نشط. تفعيل راتب يحل محل الراتب النشط الحالي للموظف: ينتهي\nالحالي في اليوم السابق لتاريخ البدء الجديد وتنتقل اشتراكات تأمينه. أما الإيقاف فيترك الموظف بلا راتب نشط\nفيتوقف المسيّر عن صرف راتبه.\n\n**متى تستخدمه:** للانتقال إلى راتب مُعدّ مسبقاً عند حلول تاريخ بدئه، أو لإيقاف الصرف.\n\n**المتطلبات:** رقم `id` الراتب من `salaries.list`. لا يمكن تفعيل راتب قبل تاريخ بدئه.\n\n**الآثار الجانبية:** يحدد هل يُصرف للموظف في المسيّر التالي وكم يُصرف. يُسجَّل في سجل التدقيق. لا يُعرض على\nClaude.","x-access":"write","x-permission":{"key":"salary/edit","label":"Update compensation","x-label-ar":"تعديل الراتب"},"x-feature":"salary","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/salary_id"}],"responses":{"200":{"description":"The salary with its new status.","x-description-ar":"الراتب بحالته الجديدة.","content":{"application/json":{"example":{"salary":{"id":310,"status":"active","basic_salary_amount":"9000.0","pay_frequency":"monthly","basic_salary_kind":"fixed","input_time_type":"employed_time","start_date":"2026-01-01","end_date":null,"currency":"SAR","benefits":[{"id":311,"kind":"housing","calculation_type":"percent_of_basic","amount":"25.0","description":"Housing","currency":null},{"id":312,"kind":"transportation","calculation_type":"fixed_monthly","amount":"500.0","description":"Transport","currency":"SAR"}],"salary_deductions":[],"insurance_deductions":[{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}]}},"schema":{"type":"object","properties":{"salary":{"$ref":"#/components/schemas/salary"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The status cannot be set.","x-description-ar":"لا يمكن تعيين الحالة.","x-codes":[{"code":"validation_failed","meaning":"The status is not `active` or `inactive`, the salary starts in the future, or it does not start after the current active salary.","x-meaning-ar":"الحالة ليست `active` أو `inactive`، أو يبدأ الراتب في المستقبل، أو لا يبدأ بعد الراتب النشط الحالي.","x-fix":"Send a valid status, wait for the start date, or change `start_date` with `salaries.update`.","x-fix-ar":"أرسل حالة صحيحة، أو انتظر تاريخ البدء، أو غيّر `start_date` عبر `salaries.update`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A salary cannot be activated before its start date.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["salary"],"properties":{"salary":{"type":"object","required":["status"],"description":"The status.","x-description-ar":"الحالة.","properties":{"status":{"type":"string","description":"`active` or `inactive`.","x-description-ar":"`active` نشط أو `inactive` غير نشط.","enum":["active","inactive"]}}}}},"example":{"salary":{"status":"active"}}}},"required":true,"description":"The new status."}}},"/payroll/salaries/{salary_id}/insurance_deductions":{"post":{"summary":"Enrol a salary in an insurance","operationId":"salaries.enrol_insurance","tags":["Salaries"],"description":"Enrols an employee's salary in an insurance plan (GOSI, medical…). From the next run, payroll deducts the\nemployee's share and records the employer's share on each payslip, calculated on the basic salary or on\nbasic plus housing.\n\n**When to use:** when an employee joins an insurance scheme. Each plan can be on a salary once.\n\n**Prerequisites:** `salary_id` from `salaries.active`; `insurance_id` from `insurances.list`.\n\n**Side effects:** changes the employee's net pay from the next run. Recorded in the audit log. Not offered to\nClaude, because it changes what the employee is paid.","x-summary-ar":"إضافة اشتراك تأمين على راتب","x-description-ar":"يشترك راتب الموظف في خطة تأمين (التأمينات الاجتماعية، الطبي…). من المسيّر التالي يستقطع المسيّر حصة الموظف\nويسجل حصة المنشأة في كل قسيمة، محسوبة على الراتب الأساسي أو على الأساسي والسكن.\n\n**متى تستخدمه:** عند انضمام الموظف إلى نظام تأمين. يمكن إضافة كل خطة على الراتب مرة واحدة.\n\n**المتطلبات:** `salary_id` من `salaries.active`، و`insurance_id` من `insurances.list`.\n\n**الآثار الجانبية:** يتغير صافي راتب الموظف من المسيّر التالي. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيغيّر ما يُصرف للموظف.","x-access":"write","x-permission":{"key":"insurance/create","label":"Add an insurance plan","x-label-ar":"إضافة خطة تأمين"},"x-feature":"insurance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"salary_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Salary id, from `salaries.active`.","x-description-ar":"رقم الراتب، من `salaries.active`.","example":310}],"responses":{"201":{"description":"The enrolment.","x-description-ar":"الاشتراك.","content":{"application/json":{"example":{"insurance_deduction":{"id":52,"salary_id":310,"insurance_id":1,"calculation_base":"basic_and_housing","reference":"GOSI-458812"}},"schema":{"type":"object","properties":{"insurance_deduction":{"$ref":"#/components/schemas/insurance_enrolment"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The enrolment was refused.","x-description-ar":"رُفض الاشتراك.","x-codes":[{"code":"validation_failed","meaning":"The salary is already enrolled in this plan, or a field is missing.","x-meaning-ar":"الراتب مشترك في هذه الخطة مسبقاً، أو حقل ناقص.","x-fix":"Pick another plan, or remove the existing enrolment first.","x-fix-ar":"اختر خطة أخرى، أو احذف الاشتراك الحالي أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Insurance has already been taken","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["insurance_deduction"],"properties":{"insurance_deduction":{"type":"object","required":["insurance_id","calculation_base"],"description":"The plan and its base.","x-description-ar":"الخطة وأساس الحساب.","properties":{"insurance_id":{"type":"integer","description":"Insurance plan, from `insurances.list`.","x-description-ar":"خطة التأمين، من `insurances.list`."},"calculation_base":{"type":"string","description":"`basic` or `basic_and_housing`.","x-description-ar":"`basic` الأساسي أو `basic_and_housing` الأساسي والسكن.","enum":["basic","basic_and_housing"]}}}}},"example":{"insurance_deduction":{"insurance_id":1,"calculation_base":"basic_and_housing"}}}},"required":true,"description":"The enrolment."}}},"/payroll/salaries/{salary_id}/insurance_deductions/{id}":{"delete":{"summary":"Remove an insurance from a salary","operationId":"salaries.remove_insurance","tags":["Salaries"],"description":"Removes an insurance enrolment from a salary. From the next run neither share is calculated for the employee.\n\n**When to use:** when an employee leaves an insurance scheme, or an enrolment was added by mistake.\n\n**Prerequisites:** `salary_id` from `salaries.active` and the enrolment `id` from its\n`insurance_deductions[].id`.\n\n**Side effects:** changes the employee's net pay from the next run; finalised payslips keep their insurance\nlines. Recorded in the audit log. Not offered to Claude.","x-summary-ar":"حذف اشتراك تأمين من راتب","x-description-ar":"يحذف اشتراك تأمين من الراتب. من المسيّر التالي لا تُحتسب أي من الحصتين للموظف.\n\n**متى تستخدمه:** عند خروج الموظف من نظام تأمين، أو إذا أُضيف الاشتراك خطأً.\n\n**المتطلبات:** `salary_id` من `salaries.active` ورقم `id` الاشتراك من `insurance_deductions[].id` فيه.\n\n**الآثار الجانبية:** يتغير صافي راتب الموظف من المسيّر التالي، وتحتفظ القسائم المعتمدة ببنود التأمين. يُسجَّل\nفي سجل التدقيق. لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"insurance/delete","label":"Remove an insurance plan","x-label-ar":"حذف خطة تأمين"},"x-feature":"insurance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"salary_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Salary id, from `salaries.active`.","x-description-ar":"رقم الراتب، من `salaries.active`.","example":310},{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Enrolment id, from the salary's `insurance_deductions[].id`.","x-description-ar":"رقم الاشتراك، من `insurance_deductions[].id` في الراتب.","example":52}],"responses":{"204":{"description":"Removed.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"}}}},"/payroll/settings":{"get":{"summary":"Get the payroll settings","operationId":"payroll_settings.show","tags":["Payroll settings"],"description":"Returns the company's payroll rules: the overtime rate (as a multiple of the hourly rate), the lateness and\nundertime deduction rates, and the pay day (last day of the month, or a fixed day 1–28).\n\n**When to use:** to explain how overtime or a lateness deduction on a payslip was priced, or when the\ncompany pays salaries.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض إعدادات الرواتب","x-description-ar":"يعرض قواعد الرواتب في الشركة: معدل العمل الإضافي (مضاعفاً لأجر الساعة)، ومعدلَي استقطاع التأخير والنقص، ويوم\nالصرف (آخر يوم في الشهر، أو يوم ثابت من ١ إلى ٢٨).\n\n**متى تستخدمه:** لتفسير طريقة تسعير العمل الإضافي أو استقطاع التأخير في القسيمة، أو لمعرفة موعد صرف الرواتب.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"payroll_setting/view","label":"View payroll settings","x-label-ar":"عرض إعدادات الرواتب"},"x-feature":"payroll_setting","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings.","x-description-ar":"الإعدادات.","content":{"application/json":{"example":{"setting":{"overtime_multiplier":"1.5","late_multiplier":"1.0","undertime_multiplier":"1.0","payment_date_rule":"specific_day","payment_day_of_month":27}},"schema":{"type":"object","properties":{"setting":{"$ref":"#/components/schemas/payroll_setting"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"patch":{"summary":"Change the payroll settings","operationId":"payroll_settings.update","tags":["Payroll settings"],"description":"Changes the company's payroll rules: the overtime, lateness and undertime multipliers (zero or more) and the\npay day (`last_day_of_month`, or `specific_day` with `payment_day_of_month` 1–28).\n\n**When to use:** when the company changes its overtime policy or its pay day.\n\n**Prerequisites:** read the current values with `payroll_settings.show`.\n\n**Side effects:** every payslip calculated from now on, for every employee, uses the new rates; finalised runs\ndo not change. Recorded in the audit log. Company-wide and changes what everyone is paid, so not offered to\nClaude.","x-summary-ar":"تعديل إعدادات الرواتب","x-description-ar":"يعدّل قواعد الرواتب في الشركة: مضاعفات العمل الإضافي والتأخير والنقص (صفر أو أكثر) ويوم الصرف\n(`last_day_of_month`، أو `specific_day` مع `payment_day_of_month` من ١ إلى ٢٨).\n\n**متى تستخدمه:** عندما تغيّر الشركة سياسة العمل الإضافي أو يوم صرف الرواتب.\n\n**المتطلبات:** اقرأ القيم الحالية عبر `payroll_settings.show`.\n\n**الآثار الجانبية:** تستخدم كل قسيمة تُحتسب من الآن، لكل الموظفين، المعدلات الجديدة؛ ولا تتغير المسيّرات المعتمدة.\nيُسجَّل في سجل التدقيق. يشمل الشركة كلها ويغيّر ما يُصرف للجميع، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"payroll_setting/manage","label":"Configure payroll settings","x-label-ar":"تهيئة إعدادات الرواتب"},"x-feature":"payroll_setting","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The settings after the change.","x-description-ar":"الإعدادات بعد التعديل.","content":{"application/json":{"example":{"setting":{"overtime_multiplier":"1.5","late_multiplier":"1.0","undertime_multiplier":"1.0","payment_date_rule":"specific_day","payment_day_of_month":27}},"schema":{"type":"object","properties":{"setting":{"$ref":"#/components/schemas/payroll_setting"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"$ref":"#/components/responses/validation_failed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["setting"],"properties":{"setting":{"type":"object","description":"Only the fields to change.","x-description-ar":"الحقول المراد تعديلها فقط.","properties":{"overtime_multiplier":{"type":"string","description":"Overtime multiple of the hourly rate, decimal string.","x-description-ar":"مضاعف أجر الساعة للعمل الإضافي، نص عشري."},"late_multiplier":{"type":"string","description":"Lateness deduction multiple, decimal string.","x-description-ar":"مضاعف استقطاع التأخير، نص عشري."},"undertime_multiplier":{"type":"string","description":"Undertime deduction multiple, decimal string.","x-description-ar":"مضاعف استقطاع النقص، نص عشري."},"payment_date_rule":{"type":"string","description":"`last_day_of_month` or `specific_day`.","x-description-ar":"`last_day_of_month` أو `specific_day`.","enum":["last_day_of_month","specific_day"]},"payment_day_of_month":{"type":"integer","description":"Pay day 1–28, with `specific_day`.","x-description-ar":"يوم الصرف ١–٢٨ مع `specific_day`.","minimum":1,"maximum":28}}}}},"example":{"setting":{"overtime_multiplier":"1.5","payment_date_rule":"specific_day","payment_day_of_month":27}}}},"required":true,"description":"The rules to change."}}},"/people_on_leave":{"get":{"summary":"List who is on leave today or in a date window","operationId":"people_on_leave.list","tags":["Dashboard"],"description":"Lists who is on approved leave today, or across a window of up to 90 days with `from` and `to` (the Team\nCalendar). Each row is one approved leave request that overlaps the window: who, first and last day, and the day they are\nback. Leave of people who have left the company is not shown, and nothing says why someone is away (no leave type,\nreason or balance). Ordered by start date.\n\nWho you see depends on the token owner's role: a **manager-type role** sees their direct reports only (and,\nwith a window, their own leave too); **any other role** sees everyone in the company. Without `from` / `to` the\nanswer is for today and leaves out the token owner's own leave; with them it includes it.\n\n**When to use:** for \"who is off today?\", \"who is away next week?\" or to check cover before approving\nleave. Prefer this over `dashboard.people_on_leave`, which returns the same rows and is kept only for\nolder clients.\n\n**Prerequisites:** none. Anyone in the company may call it.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض من في إجازة اليوم أو خلال فترة","x-description-ar":"يعرض من هم في إجازة معتمدة اليوم، أو خلال فترة تصل إلى ٩٠ يوماً باستخدام `from` و`to` (تقويم الفريق).\nكل صف طلب إجازة معتمد يتقاطع مع الفترة: من، وأول يوم وآخر يوم، ويوم العودة. لا تظهر إجازات من غادروا الشركة، ولا\nيُذكر سبب الغياب (لا نوع إجازة ولا سبب ولا رصيد). مرتبة حسب تاريخ البداية.\n\nيعتمد من تراهم على دور صاحب الرمز: **الدور من نوع مدير** يرى مرؤوسيه المباشرين فقط (ومع تحديد فترة يرى إجازته هو\nأيضاً)، و**أي دور آخر** يرى كل من في الشركة. بدون `from` / `to` تكون الإجابة عن اليوم ولا تشمل إجازة صاحب الرمز\nنفسه، ومعهما تشملها.\n\n**متى تستخدمه:** للإجابة عن \"من الغائب اليوم؟\" أو \"من سيغيب الأسبوع القادم؟\" أو للتحقق من التغطية قبل\nاعتماد إجازة. فضّله على `dashboard.people_on_leave` الذي يعيد الصفوف نفسها ويبقى للعملاء القدامى فقط.\n\n**المتطلبات:** لا شيء. يستطيع أي عضو في الشركة استدعاءه.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/dashboard_from"},{"$ref":"#/components/parameters/dashboard_to"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of people on leave.","x-description-ar":"صفحة ممن هم في إجازة.","content":{"application/json":{"example":{"records":[{"id":812,"employee_id":41,"employee_name":"Sara Ahmed","employee_image":null,"start_date":"2026-11-23","end_date":"2026-11-27","back_on":"2026-11-28"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/dashboard_people_on_leave_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The date window is not valid.","x-description-ar":"الفترة الزمنية غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"The date window is not valid: only one of `from` / `to` was sent, `to` is before `from`, or the window is longer than 90 days.","x-meaning-ar":"الفترة غير صحيحة: أُرسل أحد `from` / `to` دون الآخر، أو `to` قبل `from`، أو الفترة أطول من ٩٠ يوماً.","x-fix":"Send both dates, `to` on or after `from`, at most 90 days apart (inclusive); split a longer period into several calls.","x-fix-ar":"أرسل التاريخين، و`to` في يوم `from` أو بعده، بفترة لا تزيد عن ٩٠ يوماً شاملةً؛ وقسّم الفترة الأطول على عدة استدعاءات."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The date range cannot be longer than 90 days","code":"validation_failed"}}}}}}},"/permission_requests":{"get":{"summary":"List my permission requests (hourly leave)","operationId":"permission_requests.list","tags":["Permission requests"],"description":"Returns the token owner's own permission requests whose date falls in the period, newest first. A\npermission is an hourly leave of absence on a working day (arrive late, leave early, step out for a few\nhours), not an access right. Each row has its status, who must decide now (`current_approver_name`), the\ndecisions taken so far and `actions`, what the owner may still do with it.\n\n**When to use:** to answer \"what permissions did I ask for this month?\" or to find the `id` to edit or\ncancel. For counts only, `permission_requests.stat_cards` is lighter.\n\n**Prerequisites:** a token created by a user who is linked to an employee record. Without `from` / `to` the\nperiod is the current calendar month.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الاستئذان الخاصة بي","x-description-ar":"يعرض طلبات الاستئذان الخاصة بصاحب الرمز التي يقع تاريخها في الفترة، الأحدث أولاً. الاستئذان هنا غياب\nبالساعات في يوم عمل (تأخير في الحضور، أو انصراف مبكر، أو خروج بضع ساعات أثناء الدوام)، وليس صلاحية\nدخول. يتضمن كل سطر حالة الطلب، ومن عليه القرار الآن (`current_approver_name`)، والقرارات المتخذة حتى\nالآن، و`actions` أي ما يستطيع صاحب الرمز فعله به.\n\n**متى تستخدمه:** للإجابة عن \"ما طلبات الاستئذان التي قدمتها هذا الشهر؟\" أو لمعرفة رقم `id` الطلب لتعديله\nأو إلغائه. للأعداد فقط، `permission_requests.stat_cards` أخف.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي. بدون `from` و`to` تكون الفترة هي الشهر الحالي.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"$ref":"#/components/parameters/permission_request_from"},{"$ref":"#/components/parameters/permission_request_to"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","approved","rejected","cancelled","revoked"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"approved"},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["late_arrival","early_leave","mid_shift","flexible"]},"description":"Only this kind.","x-description-ar":"نوع محدد فقط.","example":"early_leave"}],"responses":{"200":{"description":"A page of the owner's permission requests.","x-description-ar":"صفحة من طلبات الاستئذان لصاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"pending_manager","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":"Omar Ali","actions":{"can_edit":true,"can_cancel":true,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/permission_request_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Request a permission (hourly leave of absence)","operationId":"permission_requests.create","tags":["Permission requests"],"description":"Asks, in advance, for the token owner to be away for a few hours of one working day: arrive late, leave\nearly or step out during the shift. This is an hourly leave of absence, not an access right; for a whole\nday, request a leave instead. QHR places the window on the owner's shift and works out its `kind`:\nstarting at the shift start is a `late_arrival`, ending at the shift end an `early_leave`, anything else\ninside the shift `mid_shift`; on a flexible day it is `flexible` and must be shorter than the required\nhours.\n\n**Rules:** the attendance profile must allow permission requests; the date must be a working day; the\nwindow must lie inside the shift and not cover all of it; it may not overlap the owner's other pending or\napproved requests; payroll for the date must still be open. Deadlines: a late arrival before the shift\nstarts, an early leave or mid-shift absence before the shift ends, a flexible day before the day ends.\nAfter that, justify the attendance incident instead. There is no monthly limit on the number or hours.\n\n**Approval chain:** set by the attendance profile and fixed for this request (`approval_route`):\n`manager` (the direct manager decides), `hr` (HR decides), or `manager_and_hr` (the manager recommends,\nthen HR decides). The request starts with the manager, or with HR when the route is `hr` or the owner has no\nmanager who can approve attendance.\n\n**Effect on pay:** once approved, the covered time excuses the matching late arrival, early leave or short\nhours on that day, so it is not deducted; a late check-in inside an approved late arrival reads Present.\n\n**When to use:** when the owner says \"I need to leave at 3 on Monday\" or \"I'll be two hours late tomorrow\".\nCheck the day first with `permission_requests.day_context`.\n\n**Prerequisites:** a token created by a user who is linked to an employee record.\n\n**Side effects:** the manager (or every HR approver) gets an in-app notification and an email asking for a\ndecision. Recorded in the audit log. Attachments can only be added in the QHR app.","x-summary-ar":"تقديم طلب استئذان (غياب بالساعات)","x-description-ar":"يطلب مسبقاً أن يغيب صاحب الرمز بضع ساعات من يوم عمل واحد: تأخير في الحضور، أو انصراف مبكر، أو خروج أثناء\nالدوام. هذا استئذان بالساعات وليس صلاحية دخول؛ ولغياب يوم كامل قدّم طلب إجازة. يضع QHR الفترة على دوام\nصاحب الرمز ويحدد نوعها `kind`: ما يبدأ مع بداية الدوام `late_arrival`، وما ينتهي مع نهايته `early_leave`،\nوما سوى ذلك داخل الدوام `mid_shift`؛ وفي اليوم المرن يكون `flexible` ويجب أن يقل عن الساعات المطلوبة.\n\n**القواعد:** أن يسمح ملف الحضور بالاستئذان، وأن يكون التاريخ يوم عمل، وأن تقع الفترة داخل الدوام دون أن\nتغطيه كله، وألا تتداخل مع طلبات صاحب الرمز المعلّقة أو المقبولة، وأن تكون رواتب ذلك التاريخ مفتوحة.\nالمواعيد: التأخير قبل بداية الدوام، والانصراف المبكر أو الخروج أثناء الدوام قبل نهايته، واليوم المرن قبل\nانتهاء اليوم. بعد ذلك برّر حادثة الحضور بدلاً منه. لا يوجد حد شهري لعدد الاستئذانات أو ساعاتها.\n\n**مسار الموافقة:** يحدده ملف الحضور ويُثبَّت لهذا الطلب (`approval_route`): `manager` يقرر المدير\nالمباشر، أو `hr` تقرر الموارد البشرية، أو `manager_and_hr` يوصي المدير ثم تقرر الموارد البشرية. يبدأ\nالطلب عند المدير، أو عند الموارد البشرية إن كان المسار `hr` أو لم يكن لصاحب الرمز مدير يملك اعتماد الحضور.\n\n**الأثر على الراتب:** بعد القبول يُعفى الوقت المغطى من التأخير أو الانصراف المبكر أو نقص الساعات في ذلك\nاليوم، فلا يُخصم؛ والحضور المتأخر داخل استئذان تأخير مقبول يُحتسب «حاضر».\n\n**متى تستخدمه:** عندما يقول صاحب الرمز \"أحتاج أن أنصرف الساعة ٣ يوم الاثنين\" أو \"سأتأخر ساعتين غداً\".\nافحص اليوم أولاً عبر `permission_requests.day_context`.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** يصل المدير (أو كل من يعتمد للموارد البشرية) إشعار داخل التطبيق وبريد يطلب القرار.\nيُسجَّل في سجل التدقيق. لا يمكن إضافة المرفقات إلا من تطبيق QHR.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request, waiting for a decision.","x-description-ar":"الطلب الجديد بانتظار القرار.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"pending_manager","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":"Omar Ali","actions":{"can_edit":true,"can_cancel":true,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The window cannot be requested.","x-description-ar":"لا يمكن طلب هذه الفترة.","x-codes":[{"code":"disabled_on_shift","meaning":"The attendance profile does not allow permission requests.","x-meaning-ar":"ملف الحضور لا يسمح بطلبات الاستئذان.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"not_working_day","meaning":"The date is not a working day.","x-meaning-ar":"التاريخ ليس يوم عمل.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"no_shift","meaning":"The day has no start and end time.","x-meaning-ar":"لا وقت بداية ونهاية لليوم.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"outside_shift","meaning":"The window is outside the shift.","x-meaning-ar":"الفترة خارج الدوام.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"whole_shift","meaning":"The window covers the whole shift: request a leave instead.","x-meaning-ar":"الفترة تغطي الدوام كله: قدّم طلب إجازة بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"covers_required","meaning":"The window covers all the required hours: request a leave instead.","x-meaning-ar":"الفترة تغطي كل الساعات المطلوبة: قدّم طلب إجازة بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"invalid_duration","meaning":"The end is not after the start.","x-meaning-ar":"النهاية ليست بعد البداية.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"shift_started","meaning":"A late arrival asked for after the shift began.","x-meaning-ar":"طلب تأخير بعد بداية الدوام.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"shift_ended","meaning":"Too late: the shift has ended; justify the attendance incident instead.","x-meaning-ar":"فات الوقت: انتهى الدوام؛ برّر حادثة الحضور بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"day_ended","meaning":"Too late: the day has ended; justify the attendance incident instead.","x-meaning-ar":"فات الوقت: انتهى اليوم؛ برّر حادثة الحضور بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"overlapping","meaning":"Another pending or approved request covers part of the window.","x-meaning-ar":"طلب آخر معلّق أو مقبول يغطي جزءاً من الفترة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"payroll_locked","meaning":"Payroll for the date is closed.","x-meaning-ar":"رواتب ذلك التاريخ مغلقة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"not_editable","meaning":"Edit only: someone already approved it.","x-meaning-ar":"عند التعديل فقط: سبقت الموافقة عليه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"attachment_invalid","meaning":"The attachment is not valid.","x-meaning-ar":"المرفق غير صحيح.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"invalid","meaning":"A field is not valid, e.g. the note is too long.","x-meaning-ar":"حقل غير صحيح، مثل ملاحظة طويلة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","error_code":"outside_shift","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_input"},"example":{"permission_request":{"date":"2026-11-30","start_time":"15:00","end_time":"17:00","note":"Doctor's appointment"}}}},"required":true,"description":"The window to request."}}},"/permission_requests/bulk_approve":{"patch":{"summary":"Approve many permission requests at once","operationId":"permission_requests.bulk_approve","tags":["Permission requests"],"description":"Approves up to 100 permission requests (hourly leaves of absence) one by one, each exactly as\n`permission_requests.approve` would, so every rule applies per request. Some may succeed and others fail:\nthe answer lists `succeeded` ids and `failed` ids with their `error_code`. Ids beyond the first 100 are\nignored.\n\n**When to use:** to clear a manager's or HR's queue in one go from an integration.\n\n**Prerequisites:** ids from `permission_requests.team_pending` or `permission_requests.hr_list`.\n\n**Side effects:** as `permission_requests.approve` for each approved request: notifications, attendance\nrecalculated and audit log. Not offered to Claude because it decides many people's time off in one call.","x-summary-ar":"الموافقة على عدة طلبات استئذان دفعة واحدة","x-description-ar":"يوافق على ما يصل إلى ١٠٠ طلب استئذان (غياب بالساعات) واحداً تلو الآخر، كلٌّ كما يفعل\n`permission_requests.approve`، فتُطبَّق كل القواعد على كل طلب. قد ينجح بعضها ويفشل بعضها: يعيد الرد الأرقام\nالناجحة في `succeeded` والفاشلة في `failed` مع `error_code`. يُتجاهل ما زاد على أول ١٠٠ رقم.\n\n**متى تستخدمه:** لإنهاء قائمة المدير أو الموارد البشرية دفعة واحدة من نظام متكامل.\n\n**المتطلبات:** الأرقام من `permission_requests.team_pending` أو `permission_requests.hr_list`.\n\n**الآثار الجانبية:** كما في `permission_requests.approve` لكل طلب يُقبل: إشعارات، وإعادة حساب الحضور، وسجل\nالتدقيق. لا يُعرض على Claude لأنه يبت في استئذانات عدة أشخاص في استدعاء واحد.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were approved and which were not.","x-description-ar":"الطلبات التي قُبلت والتي لم تُقبل.","content":{"application/json":{"example":{"succeeded":[4812],"failed":[{"id":4815,"error":"You are not allowed to act on this request.","error_code":"not_authorized"}]},"schema":{"$ref":"#/components/schemas/permission_request_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_bulk_input"},"example":{"ids":[4812,4815],"note":"Approved"}}},"required":true,"description":"The requests and an optional note."}}},"/permission_requests/bulk_reject":{"patch":{"summary":"Reject many permission requests at once","operationId":"permission_requests.bulk_reject","tags":["Permission requests"],"description":"Rejects up to 100 permission requests (hourly leaves of absence) one by one, each exactly as\n`permission_requests.reject` would. The same `note` is saved on every request rejected. The answer lists\n`succeeded` ids and `failed` ids with their `error_code`. Ids beyond the first 100 are ignored.\n\n**When to use:** to clear a queue in one go from an integration.\n\n**Prerequisites:** ids from `permission_requests.team_pending` or `permission_requests.hr_list`.\n\n**Side effects:** each employee whose request is rejected is notified (in-app and email); recorded in the\naudit log. Not offered to Claude because it decides many people's time off in one call.","x-summary-ar":"رفض عدة طلبات استئذان دفعة واحدة","x-description-ar":"يرفض ما يصل إلى ١٠٠ طلب استئذان (غياب بالساعات) واحداً تلو الآخر، كلٌّ كما يفعل\n`permission_requests.reject`. تُحفظ `note` نفسها على كل طلب يُرفض. يعيد الرد الأرقام الناجحة في `succeeded`\nوالفاشلة في `failed` مع `error_code`. يُتجاهل ما زاد على أول ١٠٠ رقم.\n\n**متى تستخدمه:** لإنهاء قائمة دفعة واحدة من نظام متكامل.\n\n**المتطلبات:** الأرقام من `permission_requests.team_pending` أو `permission_requests.hr_list`.\n\n**الآثار الجانبية:** يصل كل موظف رُفض طلبه إشعار داخل التطبيق وبريد، ويُسجَّل في سجل التدقيق. لا يُعرض على\nClaude لأنه يبت في استئذانات عدة أشخاص في استدعاء واحد.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which requests were rejected and which were not.","x-description-ar":"الطلبات التي رُفضت والتي لم تُرفض.","content":{"application/json":{"example":{"succeeded":[4812],"failed":[{"id":4799,"error":"Record not found","error_code":"not_found"}]},"schema":{"$ref":"#/components/schemas/permission_request_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_bulk_input"},"example":{"ids":[4812,4815],"note":"Quarter-end close; please pick another day."}}},"required":true,"description":"The requests and an optional note."}}},"/permission_requests/day_context":{"get":{"summary":"Check a day before asking for a permission","operationId":"permission_requests.day_context","tags":["Permission requests"],"description":"Describes one date for the token owner before they ask for an hourly leave of absence on it: whether their\nattendance profile allows permission requests (`enabled`), whether it is a working day, the shift\n(`shift_start` / `shift_end` in the profile's timezone, and the same as UTC instants), the required minutes,\nthe grace period, the approval route a new request would follow (`manager`, `hr` or `manager_and_hr`), and\nthe owner's pending or approved requests already on that day (`existing`).\n\n**When to use:** before `permission_requests.create`, to choose a window inside the shift that does not\noverlap `existing`. A window that starts at the shift start is a late arrival, one that ends at the shift\nend is an early leave. Display only: create checks every rule again.\n\n**Prerequisites:** a token created by a user who is linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"معرفة تفاصيل يوم قبل طلب الاستئذان","x-description-ar":"يصف تاريخاً واحداً لصاحب الرمز قبل أن يطلب فيه استئذاناً بالساعات: هل يسمح ملف الحضور بالاستئذان\n(`enabled`)، وهل هو يوم عمل، والدوام (`shift_start` و`shift_end` بتوقيت ملف الحضور، ونفسهما بتوقيت UTC)،\nوالدقائق المطلوبة، وفترة السماح، ومسار الموافقة الذي سيتبعه الطلب الجديد (`manager` أو `hr` أو\n`manager_and_hr`)، وطلباته المعلّقة أو المقبولة الموجودة في ذلك اليوم (`existing`).\n\n**متى تستخدمه:** قبل `permission_requests.create` لاختيار فترة داخل الدوام لا تتداخل مع `existing`. الفترة\nالتي تبدأ مع بداية الدوام تأخير في الحضور، والتي تنتهي مع نهايته انصراف مبكر. للعرض فقط: يعيد الإنشاء\nالتحقق من كل القواعد.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"The date to describe, `YYYY-MM-DD`.","x-description-ar":"التاريخ المطلوب بالشكل `YYYY-MM-DD`.","example":"2026-11-30"}],"responses":{"200":{"description":"The day, as the request form needs it.","x-description-ar":"اليوم كما يحتاجه نموذج الطلب.","content":{"application/json":{"example":{"date":"2026-11-30","enabled":true,"working_day":true,"day_type":"working_day","flexible":false,"shift_start":"09:00","shift_end":"17:00","shift_starts_at":"2026-11-30T06:00:00Z","shift_ends_at":"2026-11-30T14:00:00Z","required_minutes":480,"grace_period_minutes":15,"approval_route":"manager","profile_name":"Standard","existing":[{"id":4812,"kind":"early_leave","status":"pending_manager","start_time":"15:00","end_time":"17:00"}]},"schema":{"type":"object","properties":{"date":{"type":"string","description":"The date.","x-description-ar":"التاريخ.","format":"date"},"enabled":{"type":"boolean","description":"The profile allows permission requests on that date.","x-description-ar":"ملف الحضور يسمح بالاستئذان في ذلك التاريخ."},"working_day":{"type":"boolean","description":"It is a working day for the owner.","x-description-ar":"يوم عمل لصاحب الرمز."},"day_type":{"type":"string","description":"`working_day`, `weekend`, `holiday`, `leave`…","x-description-ar":"`working_day` يوم عمل، `weekend` عطلة أسبوعية، `holiday` إجازة رسمية، `leave` إجازة…"},"flexible":{"type":"boolean","description":"A flexible day: no fixed hours, only required minutes.","x-description-ar":"يوم مرن: لا ساعات ثابتة، بل دقائق مطلوبة فقط."},"shift_start":{"type":"string","description":"Shift start, `HH:MM`.","x-description-ar":"بداية الدوام `HH:MM`.","nullable":true},"shift_end":{"type":"string","description":"Shift end, `HH:MM`.","x-description-ar":"نهاية الدوام `HH:MM`.","nullable":true},"shift_starts_at":{"type":"string","description":"Shift start, in UTC.","x-description-ar":"بداية الدوام بتوقيت UTC.","nullable":true},"shift_ends_at":{"type":"string","description":"Shift end, in UTC.","x-description-ar":"نهاية الدوام بتوقيت UTC.","nullable":true},"required_minutes":{"type":"integer","description":"Minutes the owner must work that day.","x-description-ar":"الدقائق المطلوب عملها ذلك اليوم.","nullable":true},"grace_period_minutes":{"type":"integer","description":"Grace minutes before a late arrival counts; 0 when off.","x-description-ar":"دقائق السماح قبل احتساب التأخير؛ 0 إن كانت معطلة."},"approval_route":{"type":"string","description":"Who would approve a new request: `manager`, `hr` or `manager_and_hr`.","x-description-ar":"من سيوافق على طلب جديد: `manager` أو `hr` أو `manager_and_hr`."},"profile_name":{"type":"string","description":"Attendance profile name.","x-description-ar":"اسم ملف الحضور."},"existing":{"type":"array","description":"The owner's pending and approved requests that day.","x-description-ar":"طلبات صاحب الرمز المعلّقة والمقبولة في ذلك اليوم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"kind":{"type":"string","description":"Kind.","x-description-ar":"النوع."},"status":{"type":"string","description":"Status.","x-description-ar":"الحالة."},"start_time":{"type":"string","description":"Start, `HH:MM`.","x-description-ar":"البداية `HH:MM`."},"end_time":{"type":"string","description":"End, `HH:MM`.","x-description-ar":"النهاية `HH:MM`."}}}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The date cannot be read, or the owner has no employee record.","x-description-ar":"التاريخ غير مقروء، أو صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"invalid_date","meaning":"`date` is not a real date.","x-meaning-ar":"`date` ليس تاريخاً صحيحاً.","x-fix":"Send the date as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخ بالشكل `YYYY-MM-DD`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The end time must be after the start time, on the same day.","error_code":"invalid_date","code":"invalid_date"}}}}}}},"/permission_requests/stat_cards":{"get":{"summary":"Count my permission requests for a period","operationId":"permission_requests.stat_cards","tags":["Permission requests"],"description":"Counts the token owner's permission requests (hourly leaves of absence) dated in the period: how many are\npending, approved and rejected, and the approved hours. `enabled` says whether the owner's attendance\nprofile allows permission requests today; when it is false, `permission_requests.create` answers\n`disabled_on_shift`. There is no monthly cap on the number or hours of permissions; these figures are for\ninformation.\n\n**When to use:** to answer \"how many hours of permission did I take this month?\" or to check that the\nowner may ask for one at all.\n\n**Prerequisites:** a token created by a user who is linked to an employee record. Without `from` / `to` the\nperiod is the current calendar month.\n\n**Side effects:** none.","x-summary-ar":"إحصاءات طلبات الاستئذان الخاصة بي","x-description-ar":"يحسب طلبات الاستئذان (الغياب بالساعات) لصاحب الرمز التي يقع تاريخها في الفترة: عدد المعلّقة والمقبولة\nوالمرفوضة، وعدد الساعات المقبولة. ويوضح `enabled` هل يسمح ملف حضور صاحب الرمز بالاستئذان اليوم؛ فإن كان\nfalse يرفض `permission_requests.create` الطلب بالرمز `disabled_on_shift`. لا يوجد حد شهري لعدد\nالاستئذانات أو ساعاتها، وهذه الأرقام للاطلاع فقط.\n\n**متى تستخدمه:** للإجابة عن \"كم ساعة استئذان أخذت هذا الشهر؟\" أو للتأكد من أن صاحب الرمز يستطيع طلب\nالاستئذان أصلاً.\n\n**المتطلبات:** رمز أنشأه مستخدم مرتبط بسجل وظيفي. بدون `from` و`to` تكون الفترة هي الشهر الحالي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_from"},{"$ref":"#/components/parameters/permission_request_to"}],"responses":{"200":{"description":"The owner's counts for the period.","x-description-ar":"أعداد صاحب الرمز للفترة.","content":{"application/json":{"example":{"enabled":true,"pending":1,"approved":3,"rejected":0,"approved_hours":5.5,"period":{"from":"2026-11-01","to":"2026-11-30"}},"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"True when the owner's attendance profile allows permission requests.","x-description-ar":"صحيح إن كان ملف حضور صاحب الرمز يسمح بالاستئذان."},"pending":{"type":"integer","description":"Waiting for the manager or HR.","x-description-ar":"بانتظار المدير أو الموارد البشرية."},"approved":{"type":"integer","description":"Approved.","x-description-ar":"المقبولة."},"rejected":{"type":"integer","description":"Rejected.","x-description-ar":"المرفوضة."},"approved_hours":{"type":"number","description":"Hours of the approved ones.","x-description-ar":"ساعات الطلبات المقبولة."},"period":{"type":"object","description":"The period counted: `from` and `to`.","x-description-ar":"الفترة المحسوبة: `from` و`to`."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/permission_requests/{id}":{"get":{"summary":"Get one permission request","operationId":"permission_requests.show","tags":["Permission requests"],"description":"Returns one permission request (an hourly leave of absence) with its window, status, the manager's and\nHR's decisions, any withdrawal or revocation, and the employee's shift that day (`attendance_profile`).\n`actions` says what the token owner may do with it now.\n\n**When to use:** to see where a request stands and who must decide next, or before approving it.\n\n**Prerequisites:** the request `id`, from `permission_requests.list` (own requests),\n`permission_requests.team_pending` / `permission_requests.team_decided` (a manager's direct reports) or\n`permission_requests.hr_list`. The owner sees their own requests, those of their current direct reports,\nand, with \"View attendance reports\", everyone's; anything else answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض طلب استئذان","x-description-ar":"يعرض طلب استئذان واحداً (غياب بالساعات) بفترته وحالته وقرار المدير وقرار الموارد البشرية وأي تراجع أو سحب\nللموافقة، ودوام الموظف في ذلك اليوم (`attendance_profile`). ويوضح `actions` ما يستطيع صاحب الرمز فعله به\nالآن.\n\n**متى تستخدمه:** لمعرفة وضع الطلب ومن عليه القرار التالي، أو قبل الموافقة عليه.\n\n**المتطلبات:** رقم `id` الطلب من `permission_requests.list` (طلباتك) أو `permission_requests.team_pending`\n/ `permission_requests.team_decided` (مرؤوسو المدير المباشرون) أو `permission_requests.hr_list`. يرى صاحب\nالرمز طلباته وطلبات مرؤوسيه المباشرين الحاليين، ومع «عرض تقارير الحضور» طلبات الجميع؛ وما عدا ذلك يُرجع\n404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The request.","x-description-ar":"الطلب.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"pending_manager","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":"Omar Ali","actions":{"can_edit":true,"can_cancel":true,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z","attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0}}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"patch":{"summary":"Edit my permission request","operationId":"permission_requests.update","tags":["Permission requests"],"description":"Changes the date, times or note of one of the token owner's own permission requests (hourly leave of\nabsence) while nobody has approved it yet. Send the whole window again; every rule of\n`permission_requests.create` is checked again, except that the attendance profile may have switched\npermission requests off since. The approval route and the current approver do not change.\n\n**When to use:** to correct a request before it is approved. Once the manager or HR has approved it, cancel\nit with `permission_requests.cancel` and file a new one.\n\n**Prerequisites:** the request `id` from `permission_requests.list` where `actions.can_edit` is true.\n\n**Side effects:** recorded in the audit log. The approver is not notified again.","x-summary-ar":"تعديل طلب الاستئذان الخاص بي","x-description-ar":"يغيّر تاريخ أو أوقات أو ملاحظة طلب استئذان (غياب بالساعات) خاص بصاحب الرمز ما دام لم يوافق عليه أحد بعد.\nأرسل الفترة كاملة من جديد؛ تُطبَّق كل قواعد `permission_requests.create` مرة أخرى، عدا أن ملف الحضور قد\nيكون أوقف الاستئذان بعد تقديم الطلب. لا يتغير مسار الموافقة ولا صاحب القرار الحالي.\n\n**متى تستخدمه:** لتصحيح الطلب قبل الموافقة عليه. بعد موافقة المدير أو الموارد البشرية، ألغه عبر\n`permission_requests.cancel` وقدّم طلباً جديداً.\n\n**المتطلبات:** رقم `id` الطلب من `permission_requests.list` حيث `actions.can_edit` صحيح.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُرسل إشعار جديد لصاحب القرار.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The request after the change.","x-description-ar":"الطلب بعد التعديل.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":180,"kind":"early_leave","note":"Doctor's appointment","status":"pending_manager","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"14:00","end_time":"17:00","starts_at":"2026-11-30T11:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":3.0,"revoke_type":null,"attachment":null,"current_approver_name":"Omar Ali","actions":{"can_edit":true,"can_cancel":true,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be changed.","x-description-ar":"لا يمكن تعديل الطلب.","x-codes":[{"code":"disabled_on_shift","meaning":"The attendance profile does not allow permission requests.","x-meaning-ar":"ملف الحضور لا يسمح بطلبات الاستئذان.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"not_working_day","meaning":"The date is not a working day.","x-meaning-ar":"التاريخ ليس يوم عمل.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"no_shift","meaning":"The day has no start and end time.","x-meaning-ar":"لا وقت بداية ونهاية لليوم.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"outside_shift","meaning":"The window is outside the shift.","x-meaning-ar":"الفترة خارج الدوام.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"whole_shift","meaning":"The window covers the whole shift: request a leave instead.","x-meaning-ar":"الفترة تغطي الدوام كله: قدّم طلب إجازة بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"covers_required","meaning":"The window covers all the required hours: request a leave instead.","x-meaning-ar":"الفترة تغطي كل الساعات المطلوبة: قدّم طلب إجازة بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"invalid_duration","meaning":"The end is not after the start.","x-meaning-ar":"النهاية ليست بعد البداية.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"shift_started","meaning":"A late arrival asked for after the shift began.","x-meaning-ar":"طلب تأخير بعد بداية الدوام.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"shift_ended","meaning":"Too late: the shift has ended; justify the attendance incident instead.","x-meaning-ar":"فات الوقت: انتهى الدوام؛ برّر حادثة الحضور بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"day_ended","meaning":"Too late: the day has ended; justify the attendance incident instead.","x-meaning-ar":"فات الوقت: انتهى اليوم؛ برّر حادثة الحضور بدلاً منه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"overlapping","meaning":"Another pending or approved request covers part of the window.","x-meaning-ar":"طلب آخر معلّق أو مقبول يغطي جزءاً من الفترة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"payroll_locked","meaning":"Payroll for the date is closed.","x-meaning-ar":"رواتب ذلك التاريخ مغلقة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"not_editable","meaning":"Edit only: someone already approved it.","x-meaning-ar":"عند التعديل فقط: سبقت الموافقة عليه.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"attachment_invalid","meaning":"The attachment is not valid.","x-meaning-ar":"المرفق غير صحيح.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"invalid","meaning":"A field is not valid, e.g. the note is too long.","x-meaning-ar":"حقل غير صحيح، مثل ملاحظة طويلة.","x-fix":"Read `error` and change the date or times.","x-fix-ar":"اقرأ `error` وغيّر التاريخ أو الأوقات."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request can no longer be edited.","error_code":"not_editable","code":"not_editable"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_input"},"example":{"permission_request":{"date":"2026-11-30","start_time":"14:00","end_time":"17:00","note":"Doctor's appointment moved earlier"}}}},"required":true,"description":"The new window."}}},"/permission_requests/{id}/approve":{"patch":{"summary":"Approve a permission request (hourly leave)","operationId":"permission_requests.approve","tags":["Permission requests"],"description":"Approves an employee's permission request (hourly leave of absence) at the stage it waits at. At the\nmanager stage only the employee's current manager may act: on the `manager` route the request becomes\n`approved`; on `manager_and_hr` the manager's approval is a recommendation and the request moves to\n`pending_hr`. At the HR stage any HR approver (\"View attendance reports\") may act, and the request becomes\n`approved`. Nobody may decide their own request.\n\n**Effect on pay:** once `approved`, the covered time excuses the late arrival, early leave or short hours it\noverlaps on that day, so they are not deducted; if the day already has attendance, it is recalculated at\nonce (a late check-in inside the window reads Present). Approval is refused when payroll for the date is\nclosed, or when the day's late / early / short-hours incident has already been deducted or ignored\n(`actions.blocked_reason`); rejecting stays possible.\n\n**When to use:** when the manager or HR says \"approve Sara's permission for Monday\". Find the request in\n`permission_requests.team_pending` (manager) or `permission_requests.hr_list` (HR).\n\n**Prerequisites:** the request `id` where `actions.can_approve` is true; a token created by a user linked to\nan employee record.\n\n**Side effects:** the employee is notified (in-app and email) when it is approved; on `manager_and_hr`\nevery HR approver is notified instead that it waits for them. Recorded in the audit log. Not offered to Claude: a final\napproval removes the day's pending late or early-leave deductions, which changes pay.","x-summary-ar":"الموافقة على طلب استئذان","x-description-ar":"يوافق على طلب استئذان (غياب بالساعات) لموظف في المرحلة التي ينتظر فيها. في مرحلة المدير لا يتصرف إلا المدير\nالحالي للموظف: في مسار `manager` يصبح الطلب `approved`، وفي مسار `manager_and_hr` تكون موافقة المدير توصية\nوينتقل الطلب إلى `pending_hr`. وفي مرحلة الموارد البشرية يتصرف أي معتمد لديه «عرض تقارير الحضور» فيصبح الطلب\n`approved`. لا يبت أحد في طلبه الشخصي.\n\n**الأثر على الراتب:** بعد أن يصبح `approved` يُعفى الوقت المغطى من التأخير أو الانصراف المبكر أو نقص\nالساعات في ذلك اليوم فلا يُخصم، وإن كان لليوم حضور مسجل يُعاد حسابه فوراً (الحضور المتأخر داخل الفترة يُحتسب\n«حاضر»). تُرفض الموافقة إذا أُغلقت رواتب ذلك التاريخ، أو إذا سبق خصم حادثة التأخير أو الانصراف المبكر أو نقص\nالساعات لذلك اليوم أو تجاهلها (`actions.blocked_reason`)؛ ويبقى الرفض ممكناً.\n\n**متى تستخدمه:** عندما يقول المدير أو الموارد البشرية \"وافق على استئذان سارة يوم الاثنين\". اعثر على الطلب في\n`permission_requests.team_pending` (للمدير) أو `permission_requests.hr_list` (للموارد البشرية).\n\n**المتطلبات:** رقم `id` الطلب حيث `actions.can_approve` صحيح، ورمز أنشأه مستخدم مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** يصل الموظفَ إشعار داخل التطبيق وبريد عند القبول؛ وفي مسار `manager_and_hr` يصل بدلاً\nمن ذلك إشعار لكل معتمدي الموارد البشرية بأن الطلب ينتظرهم. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأن\nالاعتماد النهائي يزيل خصومات التأخير أو الخروج المبكر المعلّقة لذلك اليوم، فيتغير الأجر.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The request after the decision.","x-description-ar":"الطلب بعد القرار.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"approved","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":true,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":"Approved, get well soon"},"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be approved.","x-description-ar":"لا يمكن الموافقة على الطلب.","x-codes":[{"code":"not_actionable","meaning":"The request is not in a state this action accepts (already decided, or not approved).","x-meaning-ar":"الطلب ليس في حالة يقبلها هذا الإجراء (سبق البت فيه، أو ليس مقبولاً).","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"own_request","meaning":"Nobody decides their own request.","x-meaning-ar":"لا يبت أحد في طلبه الشخصي.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"not_authorized","meaning":"The token owner is not the approver at this stage.","x-meaning-ar":"صاحب الرمز ليس معتمِد هذه المرحلة.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"payroll_locked","meaning":"Payroll for the date is closed.","x-meaning-ar":"رواتب ذلك التاريخ مغلقة.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"incident_decided","meaning":"The day's incident was already deducted or ignored; reject instead.","x-meaning-ar":"سبق خصم حادثة اليوم أو تجاهلها؛ ارفضه بدلاً من ذلك.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request has already been decided.","error_code":"not_actionable","code":"not_actionable"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_note_input"},"example":{"note":"Approved, get well soon"}}},"required":true,"description":"An optional note for the employee."}}},"/permission_requests/{id}/cancel":{"patch":{"summary":"Cancel my permission request","operationId":"permission_requests.cancel","tags":["Permission requests"],"description":"Cancels one of the token owner's own permission requests (hourly leave of absence). A pending request can\nalways be cancelled. An approved one can be cancelled until its window starts, as long as payroll for the\ndate is still open; the time then counts as usual again, so a late arrival or early leave on that day may be\ndeducted. Rejected, cancelled and revoked requests cannot be cancelled.\n\n**When to use:** when the owner no longer needs the time off, or to replace an approved request with a\ndifferent window.\n\n**Prerequisites:** the request `id` from `permission_requests.list` where `actions.can_cancel` is true.\n\n**Side effects:** for an approved request, the day's attendance and its late / early-leave incidents are\nrecalculated. Nobody is notified. Recorded in the audit log.","x-summary-ar":"إلغاء طلب الاستئذان الخاص بي","x-description-ar":"يلغي طلب استئذان (غياب بالساعات) خاصاً بصاحب الرمز. الطلب المعلّق يمكن إلغاؤه دائماً. والمقبول يمكن إلغاؤه\nقبل بدء فترته ما دامت رواتب ذلك التاريخ مفتوحة؛ وعندها يُحتسب الوقت كالمعتاد، فقد يُخصم التأخير أو الانصراف\nالمبكر في ذلك اليوم. لا يمكن إلغاء الطلب المرفوض أو الملغى أو المسحوب.\n\n**متى تستخدمه:** عندما لا يعود صاحب الرمز بحاجة إلى الوقت، أو لاستبدال طلب مقبول بفترة أخرى.\n\n**المتطلبات:** رقم `id` الطلب من `permission_requests.list` حيث `actions.can_cancel` صحيح.\n\n**الآثار الجانبية:** للطلب المقبول يُعاد حساب حضور اليوم وحوادث التأخير والانصراف المبكر. لا يُرسل إشعار\nلأحد. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The cancelled request.","x-description-ar":"الطلب الملغى.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"cancelled","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":"2026-11-27T08:40:00Z","created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be cancelled.","x-description-ar":"لا يمكن إلغاء الطلب.","x-codes":[{"code":"not_cancellable","meaning":"The request was rejected, cancelled or revoked.","x-meaning-ar":"الطلب مرفوض أو ملغى أو مسحوب.","x-fix":"Nothing to do for a decided request; for a started or locked one ask HR.","x-fix-ar":"لا إجراء للطلب المحسوم؛ وللطلب الذي بدأ أو أُغلقت رواتبه راجع الموارد البشرية."},{"code":"already_started","meaning":"An approved permission whose window has begun.","x-meaning-ar":"استئذان مقبول بدأت فترته.","x-fix":"Nothing to do for a decided request; for a started or locked one ask HR.","x-fix-ar":"لا إجراء للطلب المحسوم؛ وللطلب الذي بدأ أو أُغلقت رواتبه راجع الموارد البشرية."},{"code":"payroll_locked","meaning":"An approved permission on a date whose payroll is closed.","x-meaning-ar":"استئذان مقبول في تاريخ أُغلقت رواتبه.","x-fix":"Nothing to do for a decided request; for a started or locked one ask HR.","x-fix-ar":"لا إجراء للطلب المحسوم؛ وللطلب الذي بدأ أو أُغلقت رواتبه راجع الموارد البشرية."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they have no permission requests.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا توجد له طلبات استئذان.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request can no longer be cancelled.","error_code":"not_cancellable","code":"not_cancellable"}}}}}}},"/permission_requests/{id}/reject":{"patch":{"summary":"Reject a permission request (hourly leave)","operationId":"permission_requests.reject","tags":["Permission requests"],"description":"Rejects an employee's pending permission request (hourly leave of absence) at the stage it waits at: the\nemployee's current manager at the manager stage, any HR approver at the HR stage. A rejection is final on\nevery route; a manager's rejection never goes on to HR. Rejecting is allowed even when payroll is closed or\nthe day's incident was already decided, so such a request can always leave the queue.\n\n**When to use:** when the manager or HR declines the time off. Add a `note` so the employee knows why.\n\n**Prerequisites:** the request `id` where `actions.can_reject` is true, from\n`permission_requests.team_pending` or `permission_requests.hr_list`.\n\n**Side effects:** the employee is notified (in-app and email). Attendance is not touched. Recorded in the\naudit log.","x-summary-ar":"رفض طلب استئذان","x-description-ar":"يرفض طلب استئذان (غياب بالساعات) معلّقاً لموظف في المرحلة التي ينتظر فيها: المدير الحالي للموظف في مرحلة\nالمدير، وأي معتمد من الموارد البشرية في مرحلتها. الرفض نهائي في كل المسارات؛ ورفض المدير لا ينتقل إلى\nالموارد البشرية. الرفض مسموح حتى لو أُغلقت الرواتب أو سبق البت في حادثة اليوم، حتى يخرج الطلب من القائمة\nدائماً.\n\n**متى تستخدمه:** عندما يرفض المدير أو الموارد البشرية الاستئذان. أضف `note` ليعرف الموظف السبب.\n\n**المتطلبات:** رقم `id` الطلب حيث `actions.can_reject` صحيح، من `permission_requests.team_pending` أو\n`permission_requests.hr_list`.\n\n**الآثار الجانبية:** يصل الموظفَ إشعار داخل التطبيق وبريد. لا يتغير الحضور. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The rejected request.","x-description-ar":"الطلب المرفوض.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"rejected","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":"Quarter-end close; please pick another day."},"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request cannot be rejected.","x-description-ar":"لا يمكن رفض الطلب.","x-codes":[{"code":"not_actionable","meaning":"The request is not in a state this action accepts (already decided, or not approved).","x-meaning-ar":"الطلب ليس في حالة يقبلها هذا الإجراء (سبق البت فيه، أو ليس مقبولاً).","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"own_request","meaning":"Nobody decides their own request.","x-meaning-ar":"لا يبت أحد في طلبه الشخصي.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"not_authorized","meaning":"The token owner is not the approver at this stage.","x-meaning-ar":"صاحب الرمز ليس معتمِد هذه المرحلة.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request has already been decided.","error_code":"not_actionable","code":"not_actionable"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/permission_request_note_input"},"example":{"note":"Quarter-end close; please pick another day."}}},"required":true,"description":"An optional note for the employee."}}},"/permission_requests/{id}/revoke":{"patch":{"summary":"Revoke an approved permission before it starts","operationId":"permission_requests.revoke","tags":["Permission requests"],"description":"Takes back a final approval of a permission request (hourly leave of absence) before its window starts. Only\nthe first approver in the route may revoke, alone: the employee's current manager when they approved it\n(on `manager` or `manager_and_hr`), otherwise HR (route `hr`, a request that never had a manager step, or a\nmanager who can no longer approve). A `note` is required. The request ends as `revoked`.\n\n**Effect on pay:** the time is no longer excused. If the day already has attendance it is recalculated at\nonce, so a late arrival or early leave in that window counts, and may be deducted, again. Refused once the\nwindow has started or payroll for the date is closed.\n\n**When to use:** when the business needs the employee after all, before the permission begins.\n\n**Prerequisites:** the request `id` from `permission_requests.team_decided` (or `permission_requests.hr_list`\nfor HR) where `actions.can_revoke` is true.\n\n**Side effects:** the employee is notified (in-app and email). Recorded in the audit log. Not offered to\nClaude: it removes time off already granted and can lead to a pay deduction.","x-summary-ar":"سحب الموافقة على استئذان قبل بدايته","x-description-ar":"يسحب الموافقة النهائية على طلب استئذان (غياب بالساعات) قبل بدء فترته. لا يسحبها إلا المعتمد الأول في المسار\nوحده: المدير الحالي للموظف إن كان قد وافق (في `manager` أو `manager_and_hr`)، وإلا فالموارد البشرية (مسار\n`hr`، أو طلب بلا خطوة مدير، أو مدير لم يعد يملك الاعتماد). `note` مطلوبة. ينتهي الطلب بالحالة `revoked`.\n\n**الأثر على الراتب:** لا يعود الوقت معفى. وإن كان لليوم حضور مسجل يُعاد حسابه فوراً، فيُحتسب التأخير أو\nالانصراف المبكر في تلك الفترة من جديد وقد يُخصم. يُرفض بعد بدء الفترة أو إذا أُغلقت رواتب ذلك التاريخ.\n\n**متى تستخدمه:** عندما يحتاج العمل إلى الموظف قبل بدء الاستئذان.\n\n**المتطلبات:** رقم `id` الطلب من `permission_requests.team_decided` (أو `permission_requests.hr_list` للموارد\nالبشرية) حيث `actions.can_revoke` صحيح.\n\n**الآثار الجانبية:** يصل الموظفَ إشعار داخل التطبيق وبريد. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيلغي وقتاً سبق منحه وقد يؤدي إلى خصم من الراتب.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The revoked request.","x-description-ar":"الطلب بعد سحب الموافقة.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"revoked","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":"revoked","attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":"Approved, get well soon"},"hr":null,"revoked":{"id":88,"name":"Omar Ali","acted_at":"2026-11-27T08:10:00Z","note":"The audit was moved to Monday afternoon; we need you in the office."},"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The approval cannot be revoked.","x-description-ar":"لا يمكن سحب الموافقة.","x-codes":[{"code":"not_actionable","meaning":"The request is not in a state this action accepts (already decided, or not approved).","x-meaning-ar":"الطلب ليس في حالة يقبلها هذا الإجراء (سبق البت فيه، أو ليس مقبولاً).","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"own_request","meaning":"Nobody decides their own request.","x-meaning-ar":"لا يبت أحد في طلبه الشخصي.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"not_authorized","meaning":"The token owner is not the approver at this stage.","x-meaning-ar":"صاحب الرمز ليس معتمِد هذه المرحلة.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"already_started","meaning":"The permission's window has already begun.","x-meaning-ar":"بدأت فترة الاستئذان.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"note_required","meaning":"A note is required for this action.","x-meaning-ar":"الملاحظة مطلوبة لهذا الإجراء.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"payroll_locked","meaning":"Payroll for the date is closed.","x-meaning-ar":"رواتب ذلك التاريخ مغلقة.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Add a note so the employee knows why.","error_code":"note_required","code":"note_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":"string","description":"Why, up to 500 characters. Required.","x-description-ar":"السبب، حتى ٥٠٠ حرف. مطلوب."}}},"example":{"note":"The audit was moved to Monday afternoon; we need you in the office."}}},"required":true,"description":"The reason, shown to the employee. Required."}}},"/permission_requests/{id}/withdraw":{"patch":{"summary":"Withdraw my approval of a permission waiting for HR","operationId":"permission_requests.withdraw","tags":["Permission requests"],"description":"Lets the manager take back their approval of a permission request (hourly leave of absence) on the\n`manager_and_hr` route while it still waits for HR (`pending_hr`). The request ends as `revoked` with\n`revoke_type: withdrawn`, leaves HR's queue and stays in HR's history; the employee may file a new one. A\n`note` is required. Only the employee's current manager who approved it may withdraw.\n\n**When to use:** when the manager changed their mind before HR decided. For a request already finally\napproved, use `permission_requests.revoke`.\n\n**Prerequisites:** the request `id` from `permission_requests.team_decided` where `actions.can_withdraw` is\ntrue.\n\n**Side effects:** the employee is notified (in-app and email). Attendance is not touched, since the request\nwas never approved, so a closed payroll does not block it. Recorded in the audit log.","x-summary-ar":"التراجع عن موافقتي على استئذان بانتظار الموارد البشرية","x-description-ar":"يتيح للمدير التراجع عن موافقته على طلب استئذان (غياب بالساعات) في مسار `manager_and_hr` ما دام ينتظر\nالموارد البشرية (`pending_hr`). ينتهي الطلب بالحالة `revoked` مع `revoke_type: withdrawn`، ويخرج من قائمة\nالموارد البشرية ويبقى في سجلها، ويستطيع الموظف تقديم طلب جديد. `note` مطلوبة. لا يتراجع إلا المدير الحالي\nللموظف الذي وافق.\n\n**متى تستخدمه:** عندما يغيّر المدير رأيه قبل قرار الموارد البشرية. للطلب المقبول نهائياً استخدم\n`permission_requests.revoke`.\n\n**المتطلبات:** رقم `id` الطلب من `permission_requests.team_decided` حيث `actions.can_withdraw` صحيح.\n\n**الآثار الجانبية:** يصل الموظفَ إشعار داخل التطبيق وبريد. لا يتغير الحضور لأن الطلب لم يُقبل أصلاً، لذا لا\nيمنعه إغلاق الرواتب. يُسجَّل في سجل التدقيق.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/permission_request_id"}],"responses":{"200":{"description":"The withdrawn request.","x-description-ar":"الطلب بعد التراجع.","content":{"application/json":{"example":{"record":{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"revoked","approval_route":"manager_and_hr","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":"withdrawn","attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":null},"hr":null,"revoked":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T11:30:00Z","note":"The audit was moved to Monday afternoon; we need you in the office."},"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}},"schema":{"$ref":"#/components/schemas/permission_request_record"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The approval cannot be withdrawn.","x-description-ar":"لا يمكن التراجع عن الموافقة.","x-codes":[{"code":"note_required","meaning":"A note is required for this action.","x-meaning-ar":"الملاحظة مطلوبة لهذا الإجراء.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"own_request","meaning":"Nobody decides their own request.","x-meaning-ar":"لا يبت أحد في طلبه الشخصي.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"not_withdrawable","meaning":"Only the manager who approved it can withdraw, while it waits for HR on the `manager_and_hr` route.","x-meaning-ar":"لا يتراجع إلا المدير الذي وافق، وما دام الطلب ينتظر الموارد البشرية في مسار `manager_and_hr`.","x-fix":"Read `error`. Reload the request with `permission_requests.show` and act only where `actions` allows it.","x-fix-ar":"اقرأ `error`. أعد قراءة الطلب عبر `permission_requests.show` ولا تتصرف إلا حيث تسمح `actions`."},{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Add a note so the employee knows why.","error_code":"note_required","code":"note_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":"string","description":"Why, up to 500 characters. Required.","x-description-ar":"السبب، حتى ٥٠٠ حرف. مطلوب."}}},"example":{"note":"The audit was moved to Monday afternoon; we need you in the office."}}},"required":true,"description":"The reason, shown to the employee. Required."}}},"/permissions":{"get":{"summary":"Show my role and everything it allows","operationId":"permissions.show","tags":["Roles \u0026 permissions"],"description":"Returns the token owner's own role (its id, names and type) and the role's full permission matrix: for\neach module (`employee`, `leave_request`, `payroll`…) every action with `true` or `false`. Also says\nwhether the owner owns the company and which employee record they have.\n\nWhen the owner has no employee record, the permissions that only make sense for an employee (my leave,\nmy attendance…) are turned to `false` in `permissions` and listed in `employee_only_permissions`: the\nrole allows them, but there is no employee for them to act on.\n\n**When to use:** to explain why something is allowed or refused (\"why can't I approve leave?\"), or to see\nthe actions the owner may *not* take. `me.show` answers the lighter question: it lists only the keys\nthat are granted, as `module/action`, the same keys as an operation's `x-permission.key`. Another\nperson's role is read with `roles.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Any member of the company may call it.","x-summary-ar":"عرض دوري وكل ما يسمح به","x-description-ar":"يعرض دور صاحب الرمز نفسه (رقمه واسميه ونوعه) ومصفوفة صلاحيات الدور كاملة: لكل وحدة (`employee`\nو`leave_request` و`payroll`…) كل إجراء بقيمة `true` أو `false`. ويبيّن أيضاً هل صاحب الرمز مالك للشركة،\nوما سجله الوظيفي.\n\nإن لم يكن لصاحب الرمز سجل وظيفي، تصبح الصلاحيات التي لا معنى لها إلا لموظف (إجازاتي، حضوري…) `false` في\n`permissions` وتُذكر في `employee_only_permissions`: فالدور يسمح بها، لكن لا يوجد موظف تُطبَّق عليه.\n\n**متى تستخدمه:** لتفسير سبب السماح بشيء أو رفضه (\"لماذا لا أستطيع اعتماد الإجازات؟\")، أو لمعرفة الإجراءات\nالتي لا يحق لصاحب الرمز القيام بها. أما `me.show` فيجيب عن السؤال الأخف: يذكر المفاتيح الممنوحة فقط بالشكل\n`module/action`، وهي المفاتيح نفسها في `x-permission.key` لكل عملية. ولقراءة دور شخص آخر استخدم `roles.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. يستطيع أي عضو في الشركة استدعاءها.","x-access":"read","x-permission":{"key":"public","label":"Any member of the company — no specific permission needed","x-label-ar":"أي عضو في الشركة — لا تحتاج صلاحية محددة"},"x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"My role and permissions.","x-description-ar":"دوري وصلاحياتي.","content":{"application/json":{"example":{"data":{"is_owner":false,"employee_id":1203,"role":{"id":4,"name_en":"HR Officer","name_ar":"موظف موارد بشرية","role_type":"admin"},"permissions":{"employee":{"view":true,"view_employee":true,"create":true,"edit":true},"leave_request":{"view":true,"create":true,"cancel":true},"user":{"view":true,"create":false,"edit":false,"deactivate":false,"activate":false,"change_role":false}},"employee_only_permissions":[]}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The token owner's access.","x-description-ar":"صلاحيات صاحب الرمز.","required":["is_owner","employee_id","role","permissions","employee_only_permissions"],"properties":{"is_owner":{"type":"boolean","description":"Whether the owner owns the company account.","x-description-ar":"هل صاحب الرمز مالك حساب الشركة."},"employee_id":{"type":"integer","nullable":true,"description":"The owner's own employee id; null when they have no employee record.","x-description-ar":"رقم الموظف الخاص بصاحب الرمز؛ null إن لم يكن له سجل وظيفي."},"role":{"type":"object","nullable":true,"description":"The owner's role; null if they have none.","x-description-ar":"دور صاحب الرمز؛ null إن لم يكن له دور.","properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"role_type":{"type":"string","enum":["employee","manager","admin"],"description":"The kind of role: `employee`, `manager` or `admin`.","x-description-ar":"نوع الدور: `employee` (موظف) أو `manager` (مدير) أو `admin` (مسؤول نظام)."}}},"permissions":{"type":"object","description":"Module → action → `true`/`false`. A granted pair is the key `module/action`.","x-description-ar":"الوحدة ← الإجراء ← `true`/`false`. كل زوج ممنوح هو المفتاح `module/action`.","additionalProperties":{"type":"object","additionalProperties":{"type":"boolean"}}},"employee_only_permissions":{"type":"array","items":{"type":"string"},"description":"Keys the role grants but that are off because the owner has no employee record.","x-description-ar":"مفاتيح يمنحها الدور لكنها معطّلة لأن صاحب الرمز ليس له سجل وظيفي."}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/roles":{"get":{"summary":"List roles","operationId":"roles.list","tags":["Roles \u0026 permissions"],"description":"Returns every role in the company, oldest first, with its type, whether it is built in or active, and how\nmany active users hold it. A role is a named set of permissions; each user of QHR holds exactly one, and it\ndecides what they can see and do.\n\nBuilt-in roles (`is_default: true`) are created with every company: **Admin** and **HR Officer** (type\n`admin`), **Manager** (type `manager`) and **Employee** (type `employee`). They cannot be renamed,\ndeactivated, retyped or deleted, and the Admin role's permissions are fixed. New companies also get two\nready-made custom roles, **Team Leader** and **Labor**. Every other role is custom: an admin creates it and\ncan edit or delete it.\n\n**When to use:** to answer \"which roles do we have?\" or \"how many people are admins?\", or to find a role's\n`id` for `roles.show`, the role changes, or `tenant_role_id` when inviting a user. Not paginated: the list is\nshort.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض قائمة الأدوار","x-description-ar":"يعرض كل أدوار الشركة، الأقدم أولاً، مع فئة كل دور وهل هو أساسي أو مفعّل، وعدد المستخدمين النشطين الذين\nيحملونه. الدور مجموعة مسمّاة من الصلاحيات؛ يحمل كل مستخدم في QHR دوراً واحداً يحدد ما يستطيع رؤيته وفعله.\n\nالأدوار الأساسية (`is_default: true`) تُنشأ مع كل شركة: **مدير النظام** و**موظف موارد بشرية** (فئة\n`admin`)، و**مدير** (فئة `manager`)، و**موظف** (فئة `employee`). لا يمكن تغيير أسمائها أو تعطيلها أو تغيير\nفئتها أو حذفها، وصلاحيات دور مدير النظام ثابتة. تحصل الشركات الجديدة أيضاً على دورين مخصصين جاهزين هما\n**قائد فريق** و**عامل**. أي دور آخر دور مخصص ينشئه المسؤول ويمكنه تعديله أو حذفه.\n\n**متى تستخدمه:** للإجابة عن \"ما الأدوار لدينا؟\" أو \"كم مسؤولاً لدينا؟\"، أو لمعرفة رقم `id` الدور المطلوب في\n`roles.show` وعمليات تعديل الأدوار، أو في `tenant_role_id` عند دعوة مستخدم. القائمة قصيرة فلا تُقسَّم إلى صفحات.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"role/view","label":"View roles","x-label-ar":"عرض الأدوار"},"x-feature":"role","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Every role.","x-description-ar":"كل الأدوار.","content":{"application/json":{"example":{"roles":[{"id":1,"name":"Admin","is_active":true,"is_default":true,"role_type":"admin","users_count":2},{"id":3,"name":"Manager","is_active":true,"is_default":true,"role_type":"manager","users_count":6},{"id":7,"name":"Field Technician","is_active":true,"is_default":false,"role_type":"employee","users_count":14}]},"schema":{"type":"object","required":["roles"],"properties":{"roles":{"type":"array","items":{"$ref":"#/components/schemas/role_row"},"description":"The roles, oldest first.","x-description-ar":"الأدوار، الأقدم أولاً."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create a custom role","operationId":"roles.create","tags":["Roles \u0026 permissions"],"description":"Creates a custom role with an English and an Arabic name (each unique in the company), a `role_type` and its\npermissions. The role is active unless `is_active` is `false`.\n\n`permissions` must list **every** permission of **every** group available to the role type, each `true` or\n`false`; a missing or unknown key is refused with 422. Take the full list from `roles.meta_data` for that\ntype and switch on what the role should allow. The type caps what the role can ever hold: an `employee`\nrole only has self-service groups, a `manager` role adds team groups, an `admin` role adds company-wide\nadministration.\n\n**When to use:** when none of the existing roles fits a group of people, e.g. a payroll clerk who may see\nsalaries but not edit employees.\n\n**Prerequisites:** the permission keys, from `roles.meta_data`. Check `roles.list` first to avoid a name that\nalready exists.\n\n**Side effects:** recorded in the audit log. Nobody holds the new role until it is given to a user (when\ninviting them or changing their role). Not offered to Claude: a role defines access to the company's data,\nwhich an admin should set deliberately.","x-summary-ar":"إنشاء دور مخصص","x-description-ar":"ينشئ دوراً مخصصاً باسم بالإنجليزية وآخر بالعربية (كلٌّ منهما فريد في الشركة) وفئة `role_type` وصلاحياته.\nيكون الدور مفعّلاً ما لم ترسل `is_active` بقيمة `false`.\n\nيجب أن تتضمن `permissions` **كل** صلاحية في **كل** مجموعة متاحة لفئة الدور، بقيمة `true` أو `false`؛ ويُرفض\nالمفتاح الناقص أو غير المعروف برمز 422. خذ القائمة الكاملة من `roles.meta_data` لتلك الفئة وفعّل ما يجب أن\nيسمح به الدور. الفئة تحدد سقف ما يمكن أن يحمله الدور: دور `employee` له مجموعات الخدمة الذاتية فقط، ودور\n`manager` يضيف مجموعات الفريق، ودور `admin` يضيف إدارة الشركة.\n\n**متى تستخدمه:** عندما لا يناسب أيٌّ من الأدوار الحالية فئةً من الأشخاص، مثل محاسب رواتب يرى الرواتب ولا\nيعدّل بيانات الموظفين.\n\n**المتطلبات:** مفاتيح الصلاحيات من `roles.meta_data`. راجع `roles.list` أولاً لتجنب اسم موجود.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يحمل أحدٌ الدور الجديد حتى يُمنح لمستخدم (عند دعوته أو\nتغيير دوره). لا يُعرض على Claude لأن الدور يحدد الوصول إلى بيانات الشركة، وهذا يضبطه المسؤول عن قصد.","x-access":"write","x-permission":{"key":"role/create","label":"Create roles","x-label-ar":"إنشاء الأدوار"},"x-feature":"role","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new role.","x-description-ar":"الدور الجديد.","content":{"application/json":{"example":{"role":{"id":7,"name_en":"Field Technician","name_ar":"فني ميداني","name":"Field Technician","is_active":true,"is_default":false,"role_type":"employee","users_count":0,"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]}},"schema":{"$ref":"#/components/schemas/role_envelope"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The role cannot be created.","x-description-ar":"لا يمكن إنشاء الدور.","x-codes":[{"code":"validation_failed","meaning":"A permission is missing or unknown for the role type, or a name is missing or already used by another role. `error` names the first problem (all permission problems at once).","x-meaning-ar":"صلاحية ناقصة أو غير معروفة لفئة الدور، أو اسم ناقص أو يحمله دور آخر. يذكر `error` أول مشكلة (ومشكلات الصلاحيات كلها معاً).","x-fix":"Send every permission key from `roles.meta_data` for that `role_type`, and two names no other role uses.","x-fix-ar":"أرسل كل مفاتيح الصلاحيات من `roles.meta_data` لتلك الفئة `role_type`، واسمين لا يستخدمهما دور آخر."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Missing action 'view' for resource 'employee', Missing action 'edit' for resource 'employee'","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/role_input"},"example":{"role":{"name_en":"Site Inspector","name_ar":"مفتش موقع","role_type":"employee","permissions":{"employee":{"view":true,"edit":false},"leave_request":{"view":true,"create":true,"cancel":true},"document":{"view":true,"create":false},"attendance_setting":{"view":true},"attendance":{"view_own":true},"payslip":{"view_own":true},"gosi":{"validate_own":false},"loan":{"view":false,"create":false,"edit":false,"cancel":false},"exports":{"hr_data":false,"payroll_data":false},"ticket":{"request":true},"custody":{"view":true},"ai_assistant":{"use":true},"open_api":{"use":true}}}}}},"required":true,"description":"The new role."}}},"/roles/meta_data":{"get":{"summary":"Get the permission template for a role type","operationId":"roles.meta_data","tags":["Roles \u0026 permissions"],"description":"Returns every permission group and permission a role of the given type can hold, with its name and\nwhether a new role starts with it on, plus the three role types. A new role starts with everything off\nexcept QHR Assistant (`ai_assistant/use`) and the user's own API tokens (`open_api/use`), and for an\n`admin` role also the HR and payroll exports.\n\n**When to use:** to explain what a role type can allow, or to build the full `permissions` body that\n`roles.create` requires (and the group keys `roles.update_permission_groups` accepts). To see what one\nexisting role allows, use `roles.show`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض قالب الصلاحيات لفئة دور","x-description-ar":"يعرض كل مجموعات الصلاحيات والصلاحيات التي يمكن أن يحملها دور من الفئة المطلوبة، مع اسم كل صلاحية وهل\nيبدأ بها الدور الجديد مفعّلة، إضافةً إلى فئات الأدوار الثلاث. يبدأ الدور الجديد وكل صلاحياته معطّلة عدا\nمساعد QHR (`ai_assistant/use`) ورموز الواجهة البرمجية الخاصة بالمستخدم (`open_api/use`)، ويضاف إليها في\nدور `admin` تصدير بيانات الموارد البشرية والرواتب.\n\n**متى تستخدمه:** لشرح ما يمكن أن تسمح به فئة دور، أو لبناء جسم `permissions` الكامل الذي تتطلبه\n`roles.create` (ومفاتيح المجموعات التي تقبلها `roles.update_permission_groups`). لمعرفة ما يسمح به دور\nموجود، استخدم `roles.show`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"role/view","label":"View roles","x-label-ar":"عرض الأدوار"},"x-feature":"role","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_type"}],"responses":{"200":{"description":"The template.","x-description-ar":"القالب.","content":{"application/json":{"example":{"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]},"schema":{"$ref":"#/components/schemas/role_template"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/roles/new":{"get":{"summary":"Get the permission template (deprecated)","operationId":"roles.new","tags":["Roles \u0026 permissions"],"description":"**Deprecated:** use `roles.meta_data`, which returns exactly the same template. This older path stays only\nfor existing integrations and will be removed; unlike `roles.meta_data` it needs the permission to create\nroles, not just to view them.\n\n**When to use:** never in new work.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Not offered to Claude, which uses `roles.meta_data`.","x-summary-ar":"عرض قالب الصلاحيات (متوقف)","x-description-ar":"**متوقف:** استخدم `roles.meta_data` التي تعيد القالب نفسه تماماً. يبقى هذا المسار القديم للتكاملات القائمة\nفقط وسيُزال، وهو يتطلب صلاحية إنشاء الأدوار لا مجرد عرضها، بخلاف `roles.meta_data`.\n\n**متى تستخدمه:** لا تستخدمه في أي عمل جديد.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. لا يُعرض على Claude الذي يستخدم `roles.meta_data`.","x-access":"read","x-permission":{"key":"role/create","label":"Create roles","x-label-ar":"إنشاء الأدوار"},"x-feature":"role","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_type"}],"deprecated":true,"responses":{"200":{"description":"The template.","x-description-ar":"القالب.","content":{"application/json":{"example":{"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]},"schema":{"$ref":"#/components/schemas/role_template"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/roles/{id}":{"get":{"summary":"Get a role and its permissions","operationId":"roles.show","tags":["Roles \u0026 permissions"],"description":"Returns one role with both names, its type, whether it is built in or active, how many active users hold\nit, and every permission its type allows, each marked `enabled` or not.\n\n**When to use:** to answer \"what can an HR Officer do?\" or \"can managers approve loans?\", or before\nchanging a role.\n\n**Prerequisites:** the role's `id`, from `roles.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض دور وصلاحياته","x-description-ar":"يعرض دوراً واحداً باسميه وفئته وهل هو أساسي أو مفعّل وعدد المستخدمين النشطين الذين يحملونه، وكل صلاحية\nتتيحها فئته مع بيان هل هي مفعّلة `enabled`.\n\n**متى تستخدمه:** للإجابة عن \"ماذا يستطيع موظف الموارد البشرية أن يفعل؟\" أو \"هل يوافق المديرون على\nالقروض؟\"، أو قبل تعديل دور.\n\n**المتطلبات:** رقم `id` الدور من `roles.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"role/view","label":"View roles","x-label-ar":"عرض الأدوار"},"x-feature":"role","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_id"}],"responses":{"200":{"description":"The role.","x-description-ar":"الدور.","content":{"application/json":{"example":{"role":{"id":7,"name_en":"Field Technician","name_ar":"فني ميداني","name":"Field Technician","is_active":true,"is_default":false,"role_type":"employee","users_count":14,"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]}},"schema":{"$ref":"#/components/schemas/role_envelope"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Update a role","operationId":"roles.update","tags":["Roles \u0026 permissions"],"description":"Changes a role's names, type, active flag or permissions; anything you leave out stays as it is. In\n`permissions` send only the switches to change: they are merged into what the role already has.\n\nChanging a custom role's `role_type` **without** `permissions` rebuilds its permissions for the new type:\ngroups the new type does not have are dropped, and the new type's starting permissions are switched on.\nChanging it **with** `permissions` in the same request does not rebuild: the keys you send are checked\nagainst the new type and merged into what the role already holds, with no starting permissions added and\nnothing from the old type dropped. To retype cleanly, change the type first, then the permissions.\nSetting `is_active: false`\nstops the role from being given to anyone new; people who already hold it keep its permissions.\n\nBuilt-in roles (`is_default: true`) can have their permissions changed, but not their names, type or active\nflag, and the Admin role cannot be changed at all; such a request is refused with 422.\n\n**When to use:** to give or take away a permission for everyone in a role, rename a custom role, or retire\nit. To switch a whole group on or off, `roles.update_permission_groups` is simpler.\n\n**Prerequisites:** the role's `id`, from `roles.list`; permission keys from `roles.show` or\n`roles.meta_data`.\n\n**Side effects:** takes effect at once for every user who holds the role, and is recorded in the audit\nlog. Not offered to Claude: it changes access for many people at once.","x-summary-ar":"تعديل دور","x-description-ar":"يغيّر اسمي الدور أو فئته أو حالة تفعيله أو صلاحياته؛ وما لا ترسله يبقى كما هو. أرسل في `permissions` ما تريد\nتغييره فقط، إذ يُدمج مع ما يملكه الدور حالياً.\n\nتغيير فئة `role_type` لدور مخصص **دون** إرسال `permissions` يعيد بناء صلاحياته للفئة الجديدة: تُحذف\nالمجموعات غير الموجودة في الفئة الجديدة، وتُفعَّل صلاحياتها الابتدائية. أما تغييرها **مع** `permissions` في\nالطلب نفسه فلا يعيد البناء: تُتحقق المفاتيح المرسلة وفق الفئة الجديدة ثم تُدمج مع ما يملكه الدور، دون إضافة\nالصلاحيات الابتدائية ودون حذف شيء من الفئة القديمة. لتغيير الفئة بشكل سليم، غيّر الفئة أولاً ثم الصلاحيات.\nوضبط `is_active: false` يمنع منح الدور لأي شخص جديد، أما من\nيحملونه فيحتفظون بصلاحياته.\n\nالأدوار الأساسية (`is_default: true`) يمكن تعديل صلاحياتها، لا أسمائها ولا فئتها ولا حالة تفعيلها، ودور\nمدير النظام لا يُعدَّل إطلاقاً؛ ويُرفض هذا الطلب برمز 422.\n\n**متى تستخدمه:** لمنح صلاحية أو سحبها من كل من يحمل الدور، أو تغيير اسم دور مخصص، أو إيقافه. لتفعيل\nمجموعة كاملة أو تعطيلها، `roles.update_permission_groups` أبسط.\n\n**المتطلبات:** رقم `id` الدور من `roles.list`، ومفاتيح الصلاحيات من `roles.show` أو `roles.meta_data`.\n\n**الآثار الجانبية:** يسري فوراً على كل مستخدم يحمل الدور، ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيغيّر صلاحيات عدد من الأشخاص دفعة واحدة.","x-access":"write","x-permission":{"key":"role/edit","label":"Edit roles","x-label-ar":"تعديل الأدوار"},"x-feature":"role","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_id"}],"responses":{"200":{"description":"The role after the change.","x-description-ar":"الدور بعد التعديل.","content":{"application/json":{"example":{"role":{"id":7,"name_en":"Senior Field Technician","name_ar":"فني ميداني","name":"Senior Field Technician","is_active":true,"is_default":false,"role_type":"employee","users_count":14,"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]}},"schema":{"$ref":"#/components/schemas/role_envelope"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The role cannot be changed.","x-description-ar":"لا يمكن تعديل الدور.","x-codes":[{"code":"validation_failed","meaning":"A built-in role was renamed, retyped or deactivated, the Admin role's permissions were changed, a permission key is unknown for the role type, or a name is already used.","x-meaning-ar":"طُلب تغيير اسم دور أساسي أو فئته أو تعطيله، أو تعديل صلاحيات دور مدير النظام، أو أُرسل مفتاح صلاحية غير معروف لفئة الدور، أو اسم يحمله دور آخر.","x-fix":"On a built-in role change only permissions (never the Admin role's). Use keys from `roles.show` and a name no other role uses.","x-fix-ar":"في الدور الأساسي عدّل الصلاحيات فقط (وليس صلاحيات مدير النظام). استخدم مفاتيح `roles.show` واسماً لا يستخدمه دور آخر."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Default role names cannot be changed.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/role_input"},"example":{"role":{"name_en":"Senior Field Technician","permissions":{"loan":{"view":true,"create":true}}}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a custom role","operationId":"roles.delete","tags":["Roles \u0026 permissions"],"description":"Deletes a custom role for good. Built-in roles cannot be deleted, and neither can a role that any user\nstill holds, active or deactivated: both are refused with 422. So nobody is ever left without a role; move\nits users to another role first.\n\n**When to use:** to remove a role the company no longer uses. To stop giving it out while people still hold\nit, set `is_active: false` with `roles.update` instead.\n\n**Prerequisites:** the role's `id`, from `roles.list` (where `is_default` is `false`).\n\n**Side effects:** the role disappears from every list of roles, and the deletion is recorded in the audit\nlog. It cannot be undone, so it is not offered to Claude.","x-summary-ar":"حذف دور مخصص","x-description-ar":"يحذف دوراً مخصصاً نهائياً. لا تُحذف الأدوار الأساسية، ولا الدور الذي ما زال يحمله أي مستخدم، نشطاً كان أو\nمعطّلاً: يُرفض كلاهما برمز 422. وبذلك لا يبقى أحد بلا دور؛ انقل مستخدميه إلى دور آخر أولاً.\n\n**متى تستخدمه:** لإزالة دور لم تعد الشركة تستخدمه. لإيقاف منحه مع بقاء من يحملونه، اضبط `is_active: false`\nعبر `roles.update` بدلاً من ذلك.\n\n**المتطلبات:** رقم `id` الدور من `roles.list` (حيث `is_default` قيمته `false`).\n\n**الآثار الجانبية:** يختفي الدور من كل قوائم الأدوار، ويُسجَّل الحذف في سجل التدقيق. لا يمكن التراجع عنه،\nلذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"role/delete","label":"Delete roles","x-label-ar":"حذف الأدوار"},"x-feature":"role","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_id"}],"responses":{"204":{"description":"Deleted. No body.","x-description-ar":"حُذف. لا يوجد محتوى."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The role cannot be deleted.","x-description-ar":"لا يمكن حذف الدور.","x-codes":[{"code":"validation_failed","meaning":"The role is built in, or at least one user (active or deactivated) still holds it.","x-meaning-ar":"الدور أساسي، أو ما زال يحمله مستخدم واحد على الأقل (نشط أو معطّل).","x-fix":"Built-in roles stay. Otherwise give its users another role, then try again.","x-fix-ar":"الأدوار الأساسية تبقى. وإلا فامنح مستخدميه دوراً آخر ثم أعد المحاولة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Default roles cannot be deleted.","code":"validation_failed"}}}}}}},"/roles/{id}/permission_groups":{"patch":{"summary":"Switch whole permission groups on or off for a role","operationId":"roles.update_permission_groups","tags":["Roles \u0026 permissions"],"description":"Turns every permission in each named group on or off for the role, in one change, e.g. \"give this role all\nof Loans\". Groups you do not name stay as they are. `enabled` must be exactly `true` or `false`.\n\nThe same rules as `roles.update` apply: the Admin role cannot be changed, and a group the role's type does\nnot have is refused with 422.\n\n**When to use:** to grant or remove a whole module for a role. To change single permissions, use\n`roles.update`.\n\n**Prerequisites:** the role's `id`, from `roles.list`; group keys from `roles.show` (`permission_groups`).\n\n**Side effects:** takes effect at once for every user who holds the role, and is recorded in the audit\nlog. Not offered to Claude: it changes access for many people at once.","x-summary-ar":"تفعيل مجموعات صلاحيات كاملة أو تعطيلها لدور","x-description-ar":"يفعّل كل صلاحية في كل مجموعة مذكورة أو يعطّلها للدور، في تغيير واحد، مثل \"امنح هذا الدور كل صلاحيات\nالقروض\". المجموعات غير المذكورة تبقى كما هي. يجب أن تكون قيمة `enabled` إما `true` أو `false` بالضبط.\n\nتنطبق قواعد `roles.update` نفسها: دور مدير النظام لا يُعدَّل، والمجموعة غير الموجودة في فئة الدور تُرفض\nبرمز 422.\n\n**متى تستخدمه:** لمنح وحدة كاملة لدور أو سحبها منه. لتغيير صلاحيات منفردة، استخدم `roles.update`.\n\n**المتطلبات:** رقم `id` الدور من `roles.list`، ومفاتيح المجموعات من `roles.show` (`permission_groups`).\n\n**الآثار الجانبية:** يسري فوراً على كل مستخدم يحمل الدور، ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه\nيغيّر صلاحيات عدد من الأشخاص دفعة واحدة.","x-access":"write","x-permission":{"key":"role/edit","label":"Edit roles","x-label-ar":"تعديل الأدوار"},"x-feature":"role","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/role_id"}],"responses":{"200":{"description":"The role after the change.","x-description-ar":"الدور بعد التعديل.","content":{"application/json":{"example":{"role":{"id":7,"name_en":"Field Technician","name_ar":"فني ميداني","name":"Field Technician","is_active":true,"is_default":false,"role_type":"employee","users_count":14,"permission_groups":[{"key":"leave_request","name":"Leave Requests","permissions":[{"key":"view","name":"View own leave history","hint":null,"enabled":true},{"key":"create","name":"Submit leave requests","hint":null,"enabled":true},{"key":"cancel","name":"Cancel leave requests","hint":null,"enabled":false}]},{"key":"loan","name":"Loans","permissions":[{"key":"view","name":"View own loans","hint":null,"enabled":false},{"key":"create","name":"Request a loan","hint":null,"enabled":false}]}],"role_types":[{"value":"employee","label":"Employee"},{"value":"manager","label":"Manager"},{"value":"admin","label":"Admin"}]}},"schema":{"$ref":"#/components/schemas/role_envelope"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The groups cannot be switched.","x-description-ar":"لا يمكن تغيير المجموعات.","x-codes":[{"code":"validation_failed","meaning":"`permission_groups` is missing or empty, an entry has no `key` or no true/false `enabled`, a group is not available to the role's type, or the role is the Admin role.","x-meaning-ar":"`permission_groups` ناقص أو فارغ، أو عنصر بلا `key` أو بلا `enabled` بقيمة true/false، أو مجموعة غير متاحة لفئة الدور، أو الدور هو دور مدير النظام.","x-fix":"Send at least one `{ key, enabled }` with a group key from `roles.show` for this role.","x-fix-ar":"أرسل عنصراً واحداً على الأقل `{ key, enabled }` بمفتاح مجموعة من `roles.show` لهذا الدور."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Unknown permission group 'payroll_run' for a employee role.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["permission_groups"],"properties":{"permission_groups":{"type":"array","minItems":1,"description":"One entry per group to switch.","x-description-ar":"عنصر لكل مجموعة يُراد تغييرها.","items":{"type":"object","required":["key","enabled"],"properties":{"key":{"type":"string","description":"Group key, from `roles.show`.","x-description-ar":"مفتاح المجموعة من `roles.show`."},"enabled":{"type":"boolean","description":"`true` turns every permission in the group on, `false` off.","x-description-ar":"`true` يفعّل كل صلاحيات المجموعة، و`false` يعطّلها."}}}}}},"example":{"permission_groups":[{"key":"loan","enabled":true},{"key":"exports","enabled":false}]}}},"required":true,"description":"The groups to switch."}}},"/support_requests":{"get":{"summary":"List my support requests","operationId":"support_requests.list","tags":["Support"],"description":"Returns the support requests the token owner raised with QHR support in this company — most recent activity\nfirst — with their reference, type, status and a preview of the latest message. Other people's requests are\nnever included.\n\n**When to use:** for \"what did I ask support?\", \"has support answered?\" (status `waiting_for_customer` means\nsupport is waiting for you), or to find a request `id`. Filter by `status`, `request_type`, or text in the\ntitle or reference with `q`.\n\n**Prerequisites:** none. Needs \"View support\" (admin roles).\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات الدعم الخاصة بي","x-description-ar":"يعرض طلبات الدعم التي رفعها صاحب الرمز إلى دعم QHR في هذه الشركة — الأحدث نشاطاً أولاً — مع المرجع والنوع\nوالحالة ومعاينة لآخر رسالة. لا تظهر طلبات غيره أبداً.\n\n**متى تستخدمه:** لأسئلة مثل \"ماذا سألت الدعم؟\" أو \"هل ردّ الدعم؟\" (الحالة `waiting_for_customer` تعني أن الدعم\nينتظر ردك)، أو لمعرفة رقم `id` الطلب. صفِّ بـ `status` أو `request_type` أو بنص من العنوان أو المرجع عبر `q`.\n\n**المتطلبات:** لا شيء. تحتاج «عرض الدعم الفني» (أدوار المسؤولين).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"support/view","label":"Open Support and read own requests","x-label-ar":"فتح الدعم وقراءة الطلبات الخاصة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["new","in_progress","waiting_for_customer","resolved"]},"description":"Only this status; another value answers 400.","x-description-ar":"حالة محددة فقط؛ أي قيمة أخرى تُرجع 400.","example":"waiting_for_customer"},{"name":"request_type","in":"query","required":false,"schema":{"type":"string","enum":["problem","feature_request","question","other"]},"description":"Only this type; another value answers 400.","x-description-ar":"نوع محدد فقط؛ أي قيمة أخرى تُرجع 400.","example":"problem"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Title or reference contains.","x-description-ar":"العنوان أو المرجع يحتوي على.","example":"overtime"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of the owner's support requests.","x-description-ar":"صفحة من طلبات دعم صاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":57,"reference":"SUP-1057","request_type":"problem","title":"Overtime total looks wrong","status":"waiting_for_customer","created_at":"2026-11-20T09:15:00Z","last_activity_at":"2026-11-20T10:02:00Z","resolved_at":null,"last_message":{"kind":"support","preview":"Thanks — we have fixed the overtime total.","event_type":null,"created_at":"2026-11-20T10:02:00Z"}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/support_request_page"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Raise a support request with QHR","operationId":"support_requests.create","tags":["Support"],"description":"Opens a conversation with the QHR support team: a type (problem, feature request, question, other), a title\nand a description, which becomes the first message. The request starts as `new` with a reference\n(`SUP-1057`) and lands in QHR's own support queue — it is not emailed and not sent to an outside help desk.\nSupport answers inside the conversation; read it with `support_requests.messages`.\n\n**When to use:** when something in QHR does not work, to ask how to do something, or to suggest a feature.\nSend a `submission_key` (any unique string) so that retrying after a network error returns the same request\n(200) instead of opening a second one (201). Files can only be attached from QHR's Support page.\n\n**Prerequisites:** none. Needs \"Manage support\" (admin roles).\n\n**Side effects:** the request, its first message and a \"request received\" event are saved; QHR support sees\nit in their queue. No email is sent to you at this point.","x-summary-ar":"رفع طلب دعم إلى QHR","x-description-ar":"يفتح محادثة مع فريق دعم QHR: نوع (مشكلة، اقتراح ميزة، سؤال، أخرى) وعنوان ووصف يصبح أول رسالة. يبدأ الطلب بحالة\n`new` ومرجع (`SUP-1057`) ويصل إلى قائمة طلبات دعم QHR نفسها — لا يُرسل بالبريد ولا إلى نظام دعم خارجي. يردّ\nالدعم داخل المحادثة؛ اقرأها عبر `support_requests.messages`.\n\n**متى تستخدمه:** عندما لا يعمل شيء في QHR، أو للسؤال عن طريقة فعل شيء، أو لاقتراح ميزة. أرسل `submission_key`\n(أي نص فريد) كي تعيد المحاولة بعد خطأ في الشبكة فتحصل على الطلب نفسه (200) بدلاً من فتح طلب ثانٍ (201). لا\nتُرفق الملفات إلا من صفحة الدعم في QHR.\n\n**المتطلبات:** لا شيء. تحتاج «إدارة الدعم الفني» (أدوار المسؤولين).\n\n**الآثار الجانبية:** يُحفظ الطلب وأول رسالة وحدث «تم استلام الطلب»، ويظهر لدعم QHR في قائمتهم. لا يُرسل إليك\nبريد في هذه المرحلة.","x-access":"write","x-permission":{"key":"support/manage","label":"Create support requests, reply and mark them resolved","x-label-ar":"إنشاء طلبات الدعم والرد عليها وتحديدها كمحلولة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"A retry with a `submission_key` already used: the request it created, unchanged.","x-description-ar":"إعادة محاولة بمفتاح `submission_key` مستخدم من قبل: الطلب الذي أنشأه دون تغيير.","content":{"application/json":{"example":{"id":57,"reference":"SUP-1057","request_type":"problem","title":"Overtime total looks wrong","status":"new","created_at":"2026-11-20T09:15:00Z","last_activity_at":"2026-11-20T09:15:00Z","resolved_at":null,"requester":{"id":51,"name":"Sara Ahmed"},"company":{"id":9,"name":"Acme Trading"},"origin_path":null,"messages":[{"id":410,"kind":"customer","body":"The November overtime total for Finance looks wrong.","event_type":null,"event_data":{},"author":{"name":"Sara Ahmed"},"attachments":[],"created_at":"2026-11-20T09:15:00Z"},{"id":411,"kind":"system","body":null,"event_type":"request_received","event_data":{},"author":null,"attachments":[],"created_at":"2026-11-20T09:15:00Z"}]},"schema":{"$ref":"#/components/schemas/support_request"}}}},"201":{"description":"The new request with its conversation.","x-description-ar":"الطلب الجديد مع محادثته.","content":{"application/json":{"example":{"id":57,"reference":"SUP-1057","request_type":"problem","title":"Overtime total looks wrong","status":"new","created_at":"2026-11-20T09:15:00Z","last_activity_at":"2026-11-20T09:15:00Z","resolved_at":null,"requester":{"id":51,"name":"Sara Ahmed"},"company":{"id":9,"name":"Acme Trading"},"origin_path":null,"messages":[{"id":410,"kind":"customer","body":"The November overtime total for Finance looks wrong.","event_type":null,"event_data":{},"author":{"name":"Sara Ahmed"},"attachments":[],"created_at":"2026-11-20T09:15:00Z"},{"id":411,"kind":"system","body":null,"event_type":"request_received","event_data":{},"author":null,"attachments":[],"created_at":"2026-11-20T09:15:00Z"}]},"schema":{"$ref":"#/components/schemas/support_request"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The request cannot be raised.","x-description-ar":"لا يمكن رفع الطلب.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Unknown request type.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["support_request"],"properties":{"support_request":{"type":"object","required":["request_type","title","description"],"description":"The request.","x-description-ar":"الطلب.","properties":{"request_type":{"type":"string","description":"`problem`, `feature_request`, `question` or `other`.","x-description-ar":"`problem` مشكلة، `feature_request` اقتراح ميزة، `question` سؤال، `other` أخرى.","enum":["problem","feature_request","question","other"]},"title":{"type":"string","description":"Short title, up to 160 characters.","x-description-ar":"عنوان قصير حتى ١٦٠ حرفاً.","maxLength":160},"description":{"type":"string","description":"What happened or what you need; the first message.","x-description-ar":"ما حدث أو ما تحتاجه؛ وهو أول رسالة."},"submission_key":{"type":"string","description":"Any unique string; a retry with the same key returns the same request.","x-description-ar":"أي نص فريد؛ إعادة المحاولة بالمفتاح نفسه تُرجع الطلب نفسه."},"origin_path":{"type":"string","description":"QHR page the problem is on, a path such as `/payroll/runs`.","x-description-ar":"صفحة QHR التي فيها المشكلة، مسار مثل `/payroll/runs`."}}}}},"example":{"support_request":{"request_type":"problem","title":"Overtime total looks wrong","description":"The November overtime total for Finance looks wrong.","submission_key":"b6f1c2e0-5d3a-4c8e-9f21-7a0d3e4b5c61"}}}},"required":true,"description":"The new request."}}},"/support_requests/{id}":{"get":{"summary":"Get one support request with its conversation","operationId":"support_requests.show","tags":["Support"],"description":"Returns one of the token owner's support requests with the whole conversation, oldest first: their\nmessages, QHR support's replies, and events such as status changes. Support's internal notes are never\nincluded. Attachment links are temporary (`url_expires_at`).\n\n**When to use:** to read what support said. To check only for new messages, `support_requests.messages`\nwith `after_id` is lighter.\n\n**Prerequisites:** the request `id` from `support_requests.list`. Someone else's request answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض طلب دعم مع محادثته","x-description-ar":"يعرض طلب دعم واحداً لصاحب الرمز مع المحادثة كاملة، الأقدم أولاً: رسائله وردود دعم QHR والأحداث مثل تغيّر\nالحالة. لا تظهر الملاحظات الداخلية لفريق الدعم أبداً. روابط المرفقات مؤقتة (`url_expires_at`).\n\n**متى تستخدمه:** لقراءة ما قاله الدعم. وللتحقق من الرسائل الجديدة فقط، `support_requests.messages` مع\n`after_id` أخف.\n\n**المتطلبات:** رقم `id` الطلب من `support_requests.list`. وطلب شخص آخر يُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"support/view","label":"Open Support and read own requests","x-label-ar":"فتح الدعم وقراءة الطلبات الخاصة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/support_request_id"}],"responses":{"200":{"description":"The request with its conversation.","x-description-ar":"الطلب مع محادثته.","content":{"application/json":{"example":{"id":57,"reference":"SUP-1057","request_type":"problem","title":"Overtime total looks wrong","status":"new","created_at":"2026-11-20T09:15:00Z","last_activity_at":"2026-11-20T09:15:00Z","resolved_at":null,"requester":{"id":51,"name":"Sara Ahmed"},"company":{"id":9,"name":"Acme Trading"},"origin_path":null,"messages":[{"id":410,"kind":"customer","body":"The November overtime total for Finance looks wrong.","event_type":null,"event_data":{},"author":{"name":"Sara Ahmed"},"attachments":[],"created_at":"2026-11-20T09:15:00Z"},{"id":411,"kind":"system","body":null,"event_type":"request_received","event_data":{},"author":null,"attachments":[],"created_at":"2026-11-20T09:15:00Z"}]},"schema":{"$ref":"#/components/schemas/support_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/support_requests/{id}/messages":{"get":{"summary":"Check a support conversation for new messages","operationId":"support_requests.messages","tags":["Support"],"description":"Returns the messages of one of the token owner's support requests, oldest first, up to 200 — only those after\n`after_id` when given — with the request's current status and the server time.\n\n**When to use:** to check whether support has replied since you last looked: pass the last message `id` you\nhave as `after_id`. For the whole request, use `support_requests.show`.\n\n**Prerequisites:** the request `id` from `support_requests.list`.\n\n**Side effects:** none.","x-summary-ar":"التحقق من رسائل جديدة في محادثة دعم","x-description-ar":"يعرض رسائل طلب دعم واحد لصاحب الرمز، الأقدم أولاً وحتى ٢٠٠ رسالة — وما بعد `after_id` فقط إن أُرسل — مع\nحالة الطلب الحالية ووقت الخادم.\n\n**متى تستخدمه:** للتحقق مما إذا ردّ الدعم منذ آخر مرة: أرسل رقم `id` آخر رسالة لديك في `after_id`. وللطلب\nكاملاً استخدم `support_requests.show`.\n\n**المتطلبات:** رقم `id` الطلب من `support_requests.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"support/view","label":"Open Support and read own requests","x-label-ar":"فتح الدعم وقراءة الطلبات الخاصة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/support_request_id"},{"name":"after_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only messages after this message id.","x-description-ar":"الرسائل التالية لهذا الرقم فقط.","example":411}],"responses":{"200":{"description":"The messages and the request's state.","x-description-ar":"الرسائل وحالة الطلب.","content":{"application/json":{"example":{"messages":[{"id":412,"kind":"support","body":"Thanks — we have fixed the overtime total. Please check again.","event_type":null,"event_data":{},"author":{"name":"QHR Support"},"attachments":[],"created_at":"2026-11-20T10:02:00Z"}],"request":{"status":"waiting_for_customer","request_type":"problem","last_activity_at":"2026-11-20T10:02:00Z","resolved_at":null},"server_time":"2026-11-20T10:05:00Z"},"schema":{"type":"object","properties":{"request":{"$ref":"#/components/schemas/support_request_summary"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/support_message"},"description":"The messages, oldest first.","x-description-ar":"الرسائل، الأقدم أولاً."},"server_time":{"type":"string","description":"Server time of this answer.","x-description-ar":"وقت الخادم لهذه الإجابة.","format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"post":{"summary":"Reply in a support conversation","operationId":"support_requests.reply","tags":["Support"],"description":"Adds the token owner's message to one of their support requests. If the request was `waiting_for_customer`\nor `resolved`, it moves back to `in_progress` for support to pick up again.\n\n**When to use:** to answer a question support asked, or to add detail. Send a `submission_key` so that a\nretry returns the same message (200) instead of posting it twice (201). Files can only be attached from\nQHR's Support page.\n\n**Prerequisites:** the request `id` from `support_requests.list`. Needs \"Manage support\".\n\n**Side effects:** the message is saved and support sees the request as active again; a reopened request also\nrecords a status-change event. No email is sent.","x-summary-ar":"الرد في محادثة دعم","x-description-ar":"يضيف رسالة صاحب الرمز إلى أحد طلبات الدعم الخاصة به. وإن كان الطلب بحالة `waiting_for_customer` أو `resolved`\nيعود إلى `in_progress` ليتابعه الدعم من جديد.\n\n**متى تستخدمه:** للإجابة عن سؤال طرحه الدعم أو لإضافة تفاصيل. أرسل `submission_key` كي تُرجع إعادة المحاولة\nالرسالة نفسها (200) بدلاً من نشرها مرتين (201). لا تُرفق الملفات إلا من صفحة الدعم في QHR.\n\n**المتطلبات:** رقم `id` الطلب من `support_requests.list`. تحتاج «إدارة الدعم الفني».\n\n**الآثار الجانبية:** تُحفظ الرسالة ويرى الدعم الطلب نشطاً من جديد؛ وإعادة فتح الطلب تسجّل أيضاً حدث تغيّر\nالحالة. لا يُرسل بريد.","x-access":"write","x-permission":{"key":"support/manage","label":"Create support requests, reply and mark them resolved","x-label-ar":"إنشاء طلبات الدعم والرد عليها وتحديدها كمحلولة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/support_request_id"}],"responses":{"200":{"description":"A retry with a `submission_key` already used: the message it created, unchanged.","x-description-ar":"إعادة محاولة بمفتاح `submission_key` مستخدم من قبل: الرسالة التي أنشأها دون تغيير.","content":{"application/json":{"example":{"message":{"id":412,"kind":"customer","body":"Thanks, the total is right now.","event_type":null,"event_data":{},"author":{"name":"Sara Ahmed"},"attachments":[],"created_at":"2026-11-20T10:02:00Z"},"request":{"status":"in_progress","request_type":"problem","last_activity_at":"2026-11-20T10:30:00Z","resolved_at":null}},"schema":{"type":"object","properties":{"request":{"$ref":"#/components/schemas/support_request_summary"},"message":{"$ref":"#/components/schemas/support_message"}}}}}},"201":{"description":"The new message and the request's state.","x-description-ar":"الرسالة الجديدة وحالة الطلب.","content":{"application/json":{"example":{"message":{"id":412,"kind":"customer","body":"Thanks, the total is right now.","event_type":null,"event_data":{},"author":{"name":"Sara Ahmed"},"attachments":[],"created_at":"2026-11-20T10:02:00Z"},"request":{"status":"in_progress","request_type":"problem","last_activity_at":"2026-11-20T10:30:00Z","resolved_at":null}},"schema":{"type":"object","properties":{"request":{"$ref":"#/components/schemas/support_request_summary"},"message":{"$ref":"#/components/schemas/support_message"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The reply cannot be posted.","x-description-ar":"لا يمكن نشر الرد.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Write a message or attach a file.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"object","required":["body"],"description":"The message.","x-description-ar":"الرسالة.","properties":{"body":{"type":"string","description":"Text of the reply.","x-description-ar":"نص الرد."},"submission_key":{"type":"string","description":"Any unique string; a retry with the same key returns the same message.","x-description-ar":"أي نص فريد؛ إعادة المحاولة بالمفتاح نفسه تُرجع الرسالة نفسها."}}}}},"example":{"message":{"body":"Thanks, the total is right now.","submission_key":"4e2a9c1b-7f3d-4b6a-8e5c-2d1f0a9b8c7e"}}}},"required":true,"description":"The reply."}}},"/support_requests/{id}/resolve":{"post":{"summary":"Mark my support request resolved","operationId":"support_requests.resolve","tags":["Support"],"description":"Closes one of the token owner's support requests as resolved by the customer. Replying later with\n`support_requests.reply` reopens it.\n\n**When to use:** when the problem is solved or the question answered and nothing more is needed from support.\n\n**Prerequisites:** the request `id` from `support_requests.list`, not already `resolved`. Needs \"Manage\nsupport\".\n\n**Side effects:** the status becomes `resolved` and a status-change event is added to the conversation. QHR\nemails the token owner a confirmation that the request was resolved, with a link to it.","x-summary-ar":"تحديد طلب الدعم الخاص بي كمحلول","x-description-ar":"يغلق أحد طلبات الدعم الخاصة بصاحب الرمز على أنه حُلّ من جهة العميل. والرد لاحقاً عبر `support_requests.reply`\nيعيد فتحه.\n\n**متى تستخدمه:** عند حل المشكلة أو الإجابة عن السؤال وعدم الحاجة إلى شيء آخر من الدعم.\n\n**المتطلبات:** رقم `id` الطلب من `support_requests.list`، وألا يكون `resolved` مسبقاً. تحتاج «إدارة الدعم الفني».\n\n**الآثار الجانبية:** تصبح الحالة `resolved` ويُضاف حدث تغيّر الحالة إلى المحادثة. ويرسل QHR إلى صاحب الرمز بريداً\nيؤكد حل الطلب مع رابط إليه.","x-access":"write","x-permission":{"key":"support/manage","label":"Create support requests, reply and mark them resolved","x-label-ar":"إنشاء طلبات الدعم والرد عليها وتحديدها كمحلولة"},"x-feature":"support","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/support_request_id"}],"responses":{"200":{"description":"The request's new state and the status-change event.","x-description-ar":"حالة الطلب الجديدة وحدث تغيّر الحالة.","content":{"application/json":{"example":{"request":{"status":"resolved","request_type":"problem","last_activity_at":"2026-11-21T08:00:00Z","resolved_at":"2026-11-21T08:00:00Z"},"message":{"id":415,"kind":"system","body":null,"event_type":"status_changed","event_data":{"from":"waiting_for_customer","to":"resolved","actor":"customer"},"author":null,"attachments":[],"created_at":"2026-11-21T08:00:00Z"}},"schema":{"type":"object","properties":{"request":{"$ref":"#/components/schemas/support_request_summary"},"message":{"$ref":"#/components/schemas/support_message"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request is already resolved.","x-description-ar":"الطلب محلول مسبقاً.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request is already resolved.","code":"validation_failed"}}}}}}},"/team_attendance_reports/employees":{"get":{"summary":"List my team's attendance totals for a period","operationId":"team_attendance_reports.employees","tags":["Attendance reports"],"description":"Returns the token owner's active direct reports with their totals over the period: days attended,\ndays absent, days late and hours late, approved overtime and permission hours, and the commitment\n(attendance) rate. Alphabetical by name unless `sort` says otherwise. Same numbers, same rules as\n`attendance_reports.employees`.\n\nHow the numbers count: a day is *attended* when it has a check-in (on time, late, or without a\ncheck-out), including on a weekend or holiday. A day is *absent* only when it was a working day for the\nemployee with no check-in and no approved leave; absences are recorded each night for the previous\nday, so today is never an absence here. Weekends, public holidays and leave days count neither way.\n*Late* counts the late arrivals pending with the manager or HR and those deducted, never one HR\nexcused. `commitment_percentage` = attended ÷ (attended + absent) × 100.\n\n**When to use:** a manager's \"who in my team was late this week?\" — read `delay_days` and\n`delay_hours`. For one report's exact dates, `team_attendance_reports.employee`.\n\n**Prerequisites:** none — the manager is the token's owner, who must have an employee profile.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مجاميع حضور فريقي خلال فترة","x-description-ar":"يعيد المرؤوسين المباشرين النشطين لصاحب الرمز مع مجاميعهم في الفترة: أيام الحضور، وأيام الغياب، وأيام\nالتأخير وساعاته، وساعات العمل الإضافي والاستئذانات المعتمدة، ونسبة الالتزام (الحضور). مرتبون أبجدياً\nبالاسم ما لم يحدد `sort` غير ذلك. الأرقام والقواعد نفسها في `attendance_reports.employees`.\n\nطريقة العدّ: يُعدّ اليوم *حضوراً* إن كان فيه تسجيل دخول (في الموعد أو متأخراً أو دون تسجيل خروج)، ولو في\nعطلة نهاية الأسبوع أو عطلة رسمية. ويُعدّ *غياباً* فقط إن كان يوم عمل للموظف دون تسجيل دخول ودون إجازة\nمعتمدة؛ ويُسجَّل الغياب كل ليلة عن اليوم السابق، فلا يكون اليوم الحالي غياباً هنا أبداً. عطل نهاية\nالأسبوع والعطل الرسمية وأيام الإجازة لا تُحتسب في أي منهما. *التأخير* يشمل حالات التأخير المعلقة لدى\nالمدير أو الموارد البشرية والمخصومة، لا التي عذرتها الموارد البشرية. `commitment_percentage` = الحضور ÷\n(الحضور + الغياب) × ١٠٠.\n\n**متى تستخدمه:** سؤال المدير \"من تأخر من فريقي هذا الأسبوع؟\" — اقرأ `delay_days` و`delay_hours`. لتواريخ\nمرؤوس بعينه `team_attendance_reports.employee`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز، ويجب أن يكون له ملف موظف.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_report_sort"},{"$ref":"#/components/parameters/attendance_report_direction"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of the team with their totals.","x-description-ar":"صفحة من الفريق مع مجاميعهم.","content":{"application/json":{"example":{"records":[{"employee_id":1203,"name":"Sara Ahmed","employee_no":"E-0042","department":"Finance","employee_image":null,"attendance_days":20,"absent_days":1,"delay_days":3,"delay_hours":0.75,"overtime_hours":4.0,"permission_hours":1.5,"commitment_percentage":95.2}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/attendance_report_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"A date is not valid, or the owner has no team.","x-description-ar":"تاريخ غير صحيح، أو لا فريق لصاحب الرمز.","x-codes":[{"code":"validation_failed","meaning":"A date is not valid: not in `YYYY-MM-DD`, `from` after `to`, or a period longer than 366 days. `error` says which.","x-meaning-ar":"تاريخ غير صحيح: ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً. توضح `error` أيها.","x-fix":"Fix the date named in `error` and send again.","x-fix-ar":"صحّح التاريخ المذكور في `error` ثم أعد الإرسال."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no team.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فلا فريق له.","x-fix":"Use a token created by a manager whose user is linked to an employee profile.","x-fix-ar":"استخدم رمزاً أنشأه مدير مرتبط مستخدمه بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The start date must be on or before the end date.","code":"validation_failed"}}}}}}},"/team_attendance_reports/employees/{employee_id}":{"get":{"summary":"Get one team member's attendance totals and days","operationId":"team_attendance_reports.employee","tags":["Attendance reports"],"description":"Returns one of the token owner's active direct reports with their totals for the period (the same\nnumbers as their row in `team_attendance_reports.employees`) and the exact days behind them: each\nabsent day (and whether HR excused it), each counted late day with the check-in time (UTC) and minutes\nlate, and each approved overtime. Lists are oldest first.\n\n**When to use:** a manager's \"which days was Sara late?\".\n\n**Prerequisites:** the `employee_id`, from `team_attendance_reports.employees` or `employees.team`.\nAnyone who is not your active direct report answers 404, so the API never confirms they exist.\n\n**Side effects:** none.","x-summary-ar":"عرض مجاميع حضور أحد أعضاء فريقي وأيامه","x-description-ar":"يعيد أحد المرؤوسين المباشرين النشطين لصاحب الرمز مع مجاميعه في الفترة (الأرقام نفسها في صفه ضمن\n`team_attendance_reports.employees`) والأيام التي تقف خلفها بالضبط: كل يوم غياب (وهل عذرته الموارد\nالبشرية)، وكل يوم تأخير محتسب مع وقت تسجيل الدخول (UTC) ودقائق التأخير، وكل عمل إضافي معتمد. القوائم\nالأقدم أولاً.\n\n**متى تستخدمه:** سؤال المدير \"في أي أيام تأخرت سارة؟\".\n\n**المتطلبات:** رقم `employee_id` من `team_attendance_reports.employees` أو `employees.team`. من ليس\nمرؤوساً مباشراً نشطاً لك يعيد ٤٠٤، فلا تؤكد الواجهة وجوده.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_employee_id"},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"}],"responses":{"200":{"description":"The team member's totals and days.","x-description-ar":"مجاميع عضو الفريق وأيامه.","content":{"application/json":{"example":{"employee":{"id":1203,"name":"Sara Ahmed","employee_no":"E-0042","department":"Finance","employee_image":null,"employment_status":"active"},"period":{"from":"2026-07-01","to":"2026-07-31"},"summary":{"attendance_days":20,"absent_days":1,"delay_days":1,"delay_hours":0.25,"overtime_hours":2.0,"permission_hours":0.0,"commitment_percentage":95.2},"absent_days":[{"date":"2026-07-14","excused":false}],"delay_days":[{"date":"2026-07-08","check_in_at":"2026-07-08T06:15:00.000Z","minutes_late":15}],"overtime_days":[{"date":"2026-07-01","start_time":"17:00","end_time":"19:00","hours":2.0}],"total_overtime_hours":2.0},"schema":{"$ref":"#/components/schemas/attendance_report_employee_detail"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"A date is not valid, or the owner has no team.","x-description-ar":"تاريخ غير صحيح، أو لا فريق لصاحب الرمز.","x-codes":[{"code":"validation_failed","meaning":"A date is not valid: not in `YYYY-MM-DD`, `from` after `to`, or a period longer than 366 days. `error` says which.","x-meaning-ar":"تاريخ غير صحيح: ليس بصيغة `YYYY-MM-DD`، أو `from` بعد `to`، أو فترة أطول من ٣٦٦ يوماً. توضح `error` أيها.","x-fix":"Fix the date named in `error` and send again.","x-fix-ar":"صحّح التاريخ المذكور في `error` ثم أعد الإرسال."},{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no team.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فلا فريق له.","x-fix":"Use a token created by a manager whose user is linked to an employee profile.","x-fix-ar":"استخدم رمزاً أنشأه مدير مرتبط مستخدمه بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_attendance_reports/export":{"get":{"summary":"Download my team's attendance report as Excel or CSV","operationId":"team_attendance_reports.export","tags":["Attendance reports"],"description":"Builds a spreadsheet of the rows of `team_attendance_reports.employees` for a period: the same figures as the HR report, for the token owner's direct reports only. Choose the file with `format` (`xlsx` for Excel, `csv`) and the columns with\n`columns[]`, in the order you want them.\n\n**When to use:** when a manager wants a file of their team's month. To answer a question, `team_attendance_reports.employees` is lighter.\n\n**Prerequisites:** at least one column key from `team_attendance_reports.export_columns`. Needs the HR data export permission.\nA token created by a manager linked to an employee record. The period defaults to the current month.\n\n**Side effects:** each attempt is recorded in your exports history and the audit log. Up to 10,000 file rows the\nfile comes straight back; above that the answer is `202`, the file is built in the background and you are\nemailed when it is ready (fetch it with `exports.list` and `exports.download`). Rows are counted in the file, not\nin records: the work schedule has one row per employee per day, so 400 employees over 30 days is 12,000 rows.\nAt most 20,000 rows, and one export of this page at a time per person. Not offered to Claude: it returns a file,\nnot JSON.","x-summary-ar":"تنزيل تقرير حضور فريقي بصيغة Excel أو CSV","x-description-ar":"ينشئ جدولاً بـصفوف `team_attendance_reports.employees` خلال فترة: أرقام تقرير الموارد البشرية نفسها، لمرؤوسي صاحب الرمز المباشرين فقط. اختر نوع الملف بـ `format` (`xlsx` لـ Excel أو `csv`) والأعمدة بـ `columns[]` بالترتيب\nالذي تريده.\n\n**متى تستخدمه:** عندما يريد مدير ملفاً بحضور فريقه في الشهر. للإجابة عن سؤال `team_attendance_reports.employees` أخف.\n\n**المتطلبات:** مفتاح عمود واحد على الأقل من `team_attendance_reports.export_columns`. تحتاج صلاحية تصدير بيانات الموارد البشرية.\nرمز أنشأه مدير مرتبط بسجل وظيفي. الفترة افتراضياً هي الشهر الحالي.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل تصديراتك وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف في الملف يعود الملف مباشرة؛ وما\nزاد على ذلك يعود بالرمز `202` ويُنشأ الملف في الخلفية ويصلك بريد عند جاهزيته (احصل عليه عبر `exports.list`\nو`exports.download`). تُعدّ الصفوف في الملف لا السجلات: جدول العمل فيه صف لكل موظف في كل يوم، فـ ٤٠٠ موظف خلال ٣٠\nيوماً تساوي ١٢٬٠٠٠ صف. الحد الأقصى ٢٠٬٠٠٠ صف، وتصدير واحد لهذه الصفحة في الوقت نفسه لكل شخص. لا يُعرض على Claude\nلأنه يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"}]},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys from `team_attendance_reports.export_columns`, in order. Repeat the parameter for each column.","x-description-ar":"مفاتيح الأعمدة من `team_attendance_reports.export_columns` بالترتيب. كرر المعامل لكل عمود.","example":["employee_no","name","attendance_days","absent_days","delay_days","commitment_percentage"]},{"$ref":"#/components/parameters/attendance_report_from"},{"$ref":"#/components/parameters/attendance_report_to"},{"$ref":"#/components/parameters/attendance_report_search"},{"$ref":"#/components/parameters/attendance_report_sort"},{"$ref":"#/components/parameters/attendance_report_direction"}],"responses":{"200":{"description":"The file (Excel, or CSV with `format=csv`).","x-description-ar":"الملف (Excel، أو CSV مع `format=csv`).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"More than 10,000 file rows: the export is queued and you are emailed when it is ready. Poll `exports.list` until this export's `status` is `ready`, then fetch the file with `exports.download`; its `download_url` (`/open/v1/exports/{id}/download`) is null until then.","x-description-ar":"أكثر من ١٠٬٠٠٠ صف في الملف: أُدرج التصدير في الانتظار ويصلك بريد عند جاهزيته. استعلم `exports.list` حتى تصبح `status` لهذا التصدير `ready`، ثم نزّل الملف عبر `exports.download`؛ ويبقى `download_url` (`/open/v1/exports/{id}/download`) فارغاً (null) حتى ذلك الحين.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/attendance_export_queued"},"example":{"export":{"id":77,"page":"team_attendance_report","format":"xlsx","status":"queued","total_records":12480,"total_rows":null,"processed_rows":0,"filename":"QHR_HR_Acme_2026-11-02.xlsx","error_code":null,"created_at":"2026-11-02T10:00:00+03:00","snapshot_at":"2026-11-02T10:00:00+03:00","finished_at":null,"expires_at":null,"download_url":null}}}}},"400":{"description":"The format, the columns or a filter is not valid.","x-description-ar":"الصيغة أو الأعمدة أو أحد المرشحات غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or not `xlsx` / `csv`.","x-meaning-ar":"`format` مفقود أو ليس `xlsx` / `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` was sent.","x-meaning-ar":"لم يُرسل `columns[]`.","x-fix":"Send at least one column key from the export's columns operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A `columns[]` key is not one you may export (`error` names it).","x-meaning-ar":"أحد مفاتيح `columns[]` ليس مما يمكنك تصديره (يذكره `error`).","x-fix":"Use only keys from the export's columns operation.","x-fix-ar":"استخدم فقط المفاتيح من عملية أعمدة التصدير."},{"code":"bad_filters","meaning":"A filter cannot be read (a bad date, or a period the page refuses).","x-meaning-ar":"تعذّرت قراءة أحد المرشحات (تاريخ غير صحيح، أو فترة لا تقبلها الصفحة).","x-fix":"Fix the filter named in `error` and send again.","x-fix-ar":"صحّح المرشح المذكور في `error` وأعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running for you.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ لك.","x-codes":[{"code":"export_in_progress","meaning":"Your previous export of this page is still being built; `export` describes it.","x-meaning-ar":"تصديرك السابق لهذه الصفحة ما زال قيد الإنشاء، ويصفه `export`.","x-fix":"Wait for it to finish (it is emailed to you), then export again.","x-fix-ar":"انتظر حتى ينتهي (يُرسل إليك بالبريد) ثم أعد التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":77,"status":"processing"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"Nothing matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي سجل.","x-fix":"Widen the filters or the period.","x-fix-ar":"وسّع المرشحات أو الفترة."},{"code":"too_large","meaning":"More than 20,000 rows; `row_count` and `max_rows` give the numbers.","x-meaning-ar":"أكثر من ٢٠٬٠٠٠ صف؛ ويذكر `row_count` و`max_rows` الأعداد.","x-fix":"Narrow the filters or shorten the period.","x-fix-ar":"ضيّق المرشحات أو قصّر الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/team_attendance_reports/export/columns":{"get":{"summary":"List the columns of the team attendance report export","operationId":"team_attendance_reports.export_columns","tags":["Attendance reports"],"description":"Lists the columns you may put in `team_attendance_reports.export`, in their default order: each column's\n`key` (what `columns[]` takes), its label in the request's language, whether it is\nticked by default, and its type. Columns you are not allowed to see are left out.\n\n**When to use:** before `team_attendance_reports.export`, to choose and order the columns.\n\n**Prerequisites:** the HR data export permission.\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير تقرير حضور الفريق","x-description-ar":"يعرض الأعمدة التي يمكنك وضعها في `team_attendance_reports.export` بترتيبها الافتراضي: `key` لكل عمود (ما يقبله\n`columns[]`)، وعنوانه بلغة الطلب، وهل هو محدد افتراضياً، ونوعه. تُستبعد الأعمدة التي لا يحق\nلك رؤيتها.\n\n**متى تستخدمه:** قبل `team_attendance_reports.export` لاختيار الأعمدة وترتيبها.\n\n**المتطلبات:** صلاحية تصدير بيانات الموارد البشرية.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"}]},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The exportable columns.","x-description-ar":"الأعمدة القابلة للتصدير.","content":{"application/json":{"example":{"columns":[{"key":"employee_no","label":"Employee number","default":true,"type":"string"},{"key":"name","label":"Name","default":true,"type":"string"},{"key":"attendance_days","label":"Attendance days","default":true,"type":"integer"},{"key":"absent_days","label":"Absent days","default":true,"type":"integer"},{"key":"delay_days","label":"Delay days","default":true,"type":"integer"},{"key":"commitment_percentage","label":"Commitment %","default":true,"type":"number"}]},"schema":{"$ref":"#/components/schemas/attendance_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/team_attendance_reports/stat_cards":{"get":{"summary":"Get today's attendance headcount for my team","operationId":"team_attendance_reports.stat_cards","tags":["Attendance reports"],"description":"Counts the token owner's active direct reports for TODAY, in the company's timezone: checked in, on\napproved leave, absent, not due yet, on a public holiday, or on a day off. It takes no dates — it is\nalways today, live.\n\n`absent` is worked out live: a report is absent once their own shift start plus the company's\nauto-absent delay has passed with no check-in and no leave; before that they are `not_yet_due`.\nWeekends follow each employee's attendance profile, holidays their country of residence. When nobody\nis due in today, `working_day` is false and every card but `total_employees` is 0. Only direct\nreports count, not their reports in turn.\n\n**When to use:** a manager's \"who from my team is in today?\". For the whole company use\n`attendance_reports.stat_cards`.\n\n**Prerequisites:** none — the manager is the token's owner, who must have an employee profile.\n\n**Side effects:** none.","x-summary-ar":"عرض أعداد الحضور اليوم لفريقي","x-description-ar":"يعدّ المرؤوسين المباشرين النشطين لصاحب الرمز لليوم الحالي بتوقيت الشركة: من سجّل دخوله، ومن في إجازة\nمعتمدة، ومن غائب، ومن لم يحن موعده بعد، ومن في عطلة رسمية، ومن في يوم راحة. لا يقبل تواريخ — فهو لليوم\nدائماً وبشكل مباشر.\n\nيُحتسب `absent` لحظياً: يُعدّ المرؤوس غائباً بعد مرور بداية ورديته مضافاً إليها مهلة الغياب التلقائي\nفي الشركة دون تسجيل دخول ودون إجازة؛ وقبل ذلك يكون ضمن `not_yet_due`. عطلة نهاية الأسبوع حسب ملف حضور\nكل موظف، والعطل الرسمية حسب بلد إقامته. إن لم يُطلب حضور أحد اليوم تكون `working_day` خطأ وكل البطاقات\nصفراً عدا `total_employees`. يُحتسب المرؤوسون المباشرون فقط، لا مرؤوسوهم.\n\n**متى تستخدمه:** سؤال المدير \"من حضر من فريقي اليوم؟\". للشركة كلها استخدم `attendance_reports.stat_cards`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز، ويجب أن يكون له ملف موظف.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/attendance_report_search"}],"responses":{"200":{"description":"Today's headcount for the team.","x-description-ar":"أعداد اليوم للفريق.","content":{"application/json":{"example":{"total_employees":6,"present":4,"on_leave":1,"absent":0,"not_yet_due":1,"on_holiday":0,"on_day_off":0,"working_day":true},"schema":{"$ref":"#/components/schemas/attendance_report_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no team.","x-description-ar":"لا فريق لصاحب الرمز.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile, so has no team.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف، فلا فريق له.","x-fix":"Use a token created by a manager whose user is linked to an employee profile.","x-fix-ar":"استخدم رمزاً أنشأه مدير مرتبط مستخدمه بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_bonuses":{"get":{"summary":"List the bonuses I proposed for my team","operationId":"team_bonuses.list","tags":["Bonuses"],"description":"Returns the bonuses the token's owner proposed as a manager, newest first, with their status: still a\ndraft, approved, paid or rejected (with HR's reason). It keeps the history of people who have since moved\nteam or left.\n\n**When to use:** for a manager's \"did HR approve the bonus I asked for Sara?\". HR's full list is\n`bonuses.list`.\n\n**Prerequisites:** the token's owner must be an employee.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض المكافآت التي اقترحتها لفريقي","x-description-ar":"يعرض المكافآت التي اقترحها صاحب الرمز بصفته مديراً، الأحدث أولاً، مع حالتها: مسودة أو معتمدة أو مصروفة أو\nمرفوضة (مع سبب الموارد البشرية). وتبقى فيها مكافآت من انتقلوا إلى فريق آخر أو غادروا.\n\n**متى تستخدمه:** لسؤال المدير «هل اعتمدت الموارد البشرية المكافأة التي طلبتها لسارة؟». أما القائمة الكاملة\nللموارد البشرية فهي `bonuses.list`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"bonus/create_for_team","label":"Submit bonuses for direct reports","x-label-ar":"تقديم مكافآت للتقارير المباشرة"},"x-feature":"bonus","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of your proposals.","x-description-ar":"صفحة من اقتراحاتك.","content":{"application/json":{"example":{"records":[{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/bonus"},"description":"Your proposals, newest first.","x-description-ar":"اقتراحاتك، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Propose a bonus for a direct report","operationId":"team_bonuses.create","tags":["Bonuses"],"description":"Proposes a bonus for one of the token owner's current direct reports. It joins HR's list as a `draft`\nmarked with who submitted it; HR approves (`bonuses.approve`) or rejects (`bonuses.reject`) it, and only\nthen is it paid by the next payroll run.\n\n**When to use:** when a manager wants to reward someone in their team.\n\n**Prerequisites:** `employee_id` from `employees.team` — someone who reports directly to the owner and has\nnot left; anyone else answers 404.\n\n**Side effects:** everyone who may approve bonuses is emailed; the manager is emailed HR's decision later.\nRecorded in the audit log. Not offered to Claude: it proposes money to be paid.","x-summary-ar":"اقتراح مكافأة لأحد مرؤوسيّ المباشرين","x-description-ar":"يقترح مكافأة لأحد المرؤوسين المباشرين الحاليين لصاحب الرمز. تنضم إلى قائمة الموارد البشرية بحالة `draft`\nمع اسم مقدّمها، فتعتمدها الموارد البشرية (`bonuses.approve`) أو ترفضها (`bonuses.reject`)، ولا يصرفها\nالمسيّر التالي إلا بعد الاعتماد.\n\n**متى تستخدمه:** عندما يريد المدير مكافأة أحد أفراد فريقه.\n\n**المتطلبات:** `employee_id` من `employees.team` — شخص يتبع مباشرة لصاحب الرمز ولم يغادر؛ وأي شخص آخر يُرجع\n404.\n\n**الآثار الجانبية:** يصل بريد إلى كل من يملك اعتماد المكافآت، ويصل المديرَ لاحقاً بريد بقرار الموارد البشرية.\nيُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يقترح مالاً يُصرف.","x-access":"write","x-permission":{"key":"bonus/create_for_team","label":"Submit bonuses for direct reports","x-label-ar":"تقديم مكافآت للتقارير المباشرة"},"x-feature":"bonus","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"Your proposal, as a draft.","x-description-ar":"اقتراحك بحالة مسودة.","content":{"application/json":{"example":{"id":418,"reference":"BNS-0042","kind":"commission","amount":"2500.0","status":"draft","date":"2026-11-15","description":"Q3 sales commission","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/bonus"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The proposal was refused.","x-description-ar":"رُفض الاقتراح.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","bonus"],"properties":{"employee_id":{"type":"integer","description":"The direct report, from `employees.team`.","x-description-ar":"المرؤوس المباشر، من `employees.team`."},"bonus":{"$ref":"#/components/schemas/bonus_input"}}},"example":{"employee_id":1203,"bonus":{"kind":"other","amount":"1500.00","date":"2026-11-15","description":"Closing the Al Noor project"}}}},"required":true,"description":"The direct report and the bonus."}}},"/team_deductions":{"get":{"summary":"List the deductions I proposed for my team","operationId":"team_deductions.list","tags":["Deductions"],"description":"Returns the deductions the token's owner proposed as a manager, newest first, with their status: still a\ndraft, approved, deducted or rejected (with HR's reason). It keeps the history of people who have since\nmoved team or left.\n\n**When to use:** for a manager's \"did HR approve the penalty I raised for Sara?\". HR's full list is\n`deductions.list`.\n\n**Prerequisites:** the token's owner must be an employee.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الاستقطاعات التي اقترحتها على فريقي","x-description-ar":"يعرض الاستقطاعات التي اقترحها صاحب الرمز بصفته مديراً، الأحدث أولاً، مع حالتها: مسودة أو معتمدة أو\nمستقطعة أو مرفوضة (مع سبب الموارد البشرية). وتبقى فيها استقطاعات من انتقلوا إلى فريق آخر أو غادروا.\n\n**متى تستخدمه:** لسؤال المدير «هل اعتمدت الموارد البشرية الجزاء الذي رفعته على سارة؟». أما القائمة الكاملة\nللموارد البشرية فهي `deductions.list`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"deduction/create_for_team","label":"Submit deductions for direct reports","x-label-ar":"تقديم خصومات للتقارير المباشرة"},"x-feature":"deduction","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of your proposals.","x-description-ar":"صفحة من اقتراحاتك.","content":{"application/json":{"example":{"records":[{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/deduction"},"description":"Your proposals, newest first.","x-description-ar":"اقتراحاتك، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Propose a deduction for a direct report","operationId":"team_deductions.create","tags":["Deductions"],"description":"Proposes a deduction — `other` or `policy_violation` only — for one of the token owner's current direct\nreports. It joins HR's list as a `draft` marked with who submitted it; HR approves\n(`deductions.approve`) or rejects (`deductions.reject`) it, and only then does the next payroll run take\nit from the employee's pay.\n\n**When to use:** when a manager raises a penalty for someone in their team. Repayments and reimbursements\nare recorded by HR (`deductions.create`).\n\n**Prerequisites:** `employee_id` from `employees.team` — someone who reports directly to the owner and has\nnot left; anyone else answers 404.\n\n**Side effects:** everyone who may approve deductions is emailed; the manager is emailed HR's decision\nlater. Recorded in the audit log. Not offered to Claude: it proposes money to be taken from pay.","x-summary-ar":"اقتراح استقطاع على أحد مرؤوسيّ المباشرين","x-description-ar":"يقترح استقطاعاً — من نوع `other` أو `policy_violation` فقط — على أحد المرؤوسين المباشرين الحاليين لصاحب\nالرمز. ينضم إلى قائمة الموارد البشرية بحالة `draft` مع اسم مقدّمه، فتعتمده الموارد البشرية\n(`deductions.approve`) أو ترفضه (`deductions.reject`)، ولا يأخذه المسيّر التالي من الراتب إلا بعد\nالاعتماد.\n\n**متى تستخدمه:** عندما يرفع المدير جزاءً على أحد أفراد فريقه. أما السداد والاسترداد فتسجلهما الموارد\nالبشرية (`deductions.create`).\n\n**المتطلبات:** `employee_id` من `employees.team` — شخص يتبع مباشرة لصاحب الرمز ولم يغادر؛ وأي شخص آخر يُرجع\n404.\n\n**الآثار الجانبية:** يصل بريد إلى كل من يملك اعتماد الاستقطاعات، ويصل المديرَ لاحقاً بريد بقرار الموارد\nالبشرية. يُسجَّل في سجل التدقيق. لا يُعرض على Claude: لأنه يقترح مالاً يُستقطع من الراتب.","x-access":"write","x-permission":{"key":"deduction/create_for_team","label":"Submit deductions for direct reports","x-label-ar":"تقديم خصومات للتقارير المباشرة"},"x-feature":"deduction","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"Your proposal, as a draft.","x-description-ar":"اقتراحك بحالة مسودة.","content":{"application/json":{"example":{"id":233,"reference":"DCN-0017","kind":"policy_violation","amount":"300.0","status":"draft","date":"2026-11-12","description":"Repeated late arrival","currency":"SAR","employee_no":"E-0042","employee_name":"Sara Ahmed","submitted_by":{"id":88,"full_name":"Omar Ali"},"rejected_by":null,"rejected_at":null,"rejection_reason":null},"schema":{"$ref":"#/components/schemas/deduction"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The proposal was refused.","x-description-ar":"رُفض الاقتراح.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company; the decision is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، والقرار يُسجَّل باسم الموظف الذي اتخذه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"validation_failed","meaning":"A manager may only propose an `other` or `policy_violation` deduction; repayments and reimbursements are recorded by HR.","x-meaning-ar":"لا يقترح المدير إلا استقطاعاً من نوع `other` أو `policy_violation`؛ أما السداد والاسترداد فتسجلهما الموارد البشرية.","x-fix":"Use `kind: other` or `policy_violation`, or ask HR to add it with `deductions.create`.","x-fix-ar":"استخدم `kind: other` أو `policy_violation`، أو اطلب من الموارد البشرية إضافته عبر `deductions.create`."},{"code":"validation_failed","meaning":"The amount is zero or less, or a field is not valid.","x-meaning-ar":"المبلغ صفر أو أقل، أو أحد الحقول غير صحيح.","x-fix":"Send an amount greater than zero and a valid `kind`.","x-fix-ar":"أرسل مبلغاً أكبر من صفر و`kind` صحيحاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","deduction"],"properties":{"employee_id":{"type":"integer","description":"The direct report, from `employees.team`.","x-description-ar":"المرؤوس المباشر، من `employees.team`."},"deduction":{"$ref":"#/components/schemas/deduction_input"}}},"example":{"employee_id":1203,"deduction":{"kind":"policy_violation","amount":"300.00","date":"2026-11-12","description":"Repeated late arrival"}}}},"required":true,"description":"The direct report and the deduction."}}},"/team_leaves":{"post":{"summary":"File leave for one of my direct reports","operationId":"team_leaves.create","tags":["Team leaves"],"description":"The token owner, as manager, files a leave request on behalf of one of their direct reports (for example\nsomeone off sick who cannot submit it). Filing counts as the manager's approval, so where it lands depends\non the policy:\n\n- `manager` — approved at once.\n- `manager_and_hr` — approved by the manager, now waiting for HR.\n- `hr` — waiting for HR.\n\nThe same rules as `leave_requests.create` apply to the report (balance, approved overlap, working days,\nlast working day, policy assigned and active), and the leave may not start in the past unless the policy\nallows past dates. If the manager-stage approval is refused (for example a day was already paid as an\nabsence), nothing is saved. The request is marked `on_behalf: true`: the employee cannot edit it, and\ncancelling it goes to review.\n\n**When to use:** when a manager asks to record leave for someone in their team. For the manager's own\nleave, use `leave_requests.create`.\n\n**Prerequisites:** `employee_id` from `employees.team`; `leave_policy_id` from `team_leaves.policies`.\nCheck first with `team_leaves.validate`. JSON only: leave whose policy requires a supporting document must\nbe filed in the QHR app.\n\n**Side effects:** the days are reserved (or taken, when approved at once) on the report's balance. When it\nwaits for HR, HR is emailed; when approved at once, the employee is emailed, and the days are marked as\nleave in attendance. Recorded in the request's history and the audit log.","x-summary-ar":"تقديم إجازة نيابةً عن أحد مرؤوسيّ المباشرين","x-description-ar":"يقدّم صاحب الرمز، بصفته مديراً، طلب إجازة نيابةً عن أحد مرؤوسيه المباشرين (مثلاً موظف مريض لا يستطيع\nتقديمه). يُعدّ التقديم موافقةَ المدير، فيتوقف مصير الطلب على السياسة:\n\n- `manager` — يُعتمد فوراً.\n- `manager_and_hr` — وافق عليه المدير، وينتظر الموارد البشرية.\n- `hr` — ينتظر الموارد البشرية.\n\nتنطبق على المرؤوس قواعد `leave_requests.create` نفسها (الرصيد، والتداخل مع إجازة موافق عليها، وأيام العمل،\nوآخر يوم عمل، وإسناد السياسة وتفعيلها)، ولا تبدأ الإجازة في الماضي ما لم تسمح السياسة بذلك. إن رُفضت موافقة\nالمدير (مثلاً دُفع يوم منها كغياب) فلا يُحفظ شيء. يُعلَّم الطلب `on_behalf: true`: لا يستطيع الموظف تعديله،\nوإلغاؤه يمر بالمراجعة.\n\n**متى تستخدمه:** حين يطلب مدير تسجيل إجازة لأحد أفراد فريقه. لإجازة المدير نفسه استخدم\n`leave_requests.create`.\n\n**المتطلبات:** `employee_id` من `employees.team`، و`leave_policy_id` من `team_leaves.policies`. تحقق أولاً\nعبر `team_leaves.validate`. JSON فقط: تُقدَّم الإجازة التي تشترط سياستها مستنداً داعماً من تطبيق QHR.\n\n**الآثار الجانبية:** تُحجز الأيام (أو تُؤخذ إن اعتُمدت فوراً) من رصيد المرؤوس. إن كان الطلب ينتظر الموارد\nالبشرية يصلها بريد، وإن اعتُمد فوراً يصل الموظفَ بريد وتُعلَّم الأيام إجازةً في الحضور. يُسجَّل في سجل الطلب\nوسجل التدقيق.","x-access":"write","x-permission":{"key":"leave_request/create_for_team","label":"File leave for direct reports","x-label-ar":"تقديم إجازات للتقارير المباشرة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The filed request, in the state the policy leads to.","x-description-ar":"الطلب المقدَّم، في الحالة التي تقود إليها السياسة.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"leave_policy_id":7,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","reason":"Medical rest","status":"approved","on_behalf":true,"created_at":"2026-03-02 06:00:00 UTC"}},"schema":{"$ref":"#/components/schemas/leave_request_created"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The leave cannot be filed.","x-description-ar":"لا يمكن تقديم الإجازة.","x-codes":[{"code":"validation_failed","meaning":"The leave breaks a rule for the report: not enough balance, overlaps an approved leave, in the past, no working day, after their last working day, policy not assigned or switched off, or a document is required. `error` says which. Nothing was saved.","x-meaning-ar":"الإجازة تخالف قاعدة للمرؤوس: رصيد غير كافٍ، أو تداخل مع إجازة موافق عليها، أو في الماضي، أو لا يوم عمل، أو بعد آخر يوم عمل له، أو سياسة غير مسندة أو معطّلة، أو مستند مطلوب. يوضح `error` السبب. لم يُحفظ شيء.","x-fix":"Check with `team_leaves.validate`, change the dates or the policy, then send again.","x-fix-ar":"تحقق عبر `team_leaves.validate` وغيّر التواريخ أو السياسة ثم أعد الإرسال."},{"code":"employee_required","meaning":"The token's owner has no employee record, so they manage no one.","x-meaning-ar":"صاحب الرمز بلا سجل وظيفي، فلا يدير أحداً.","x-fix":"Use the token of a user linked to their employee record.","x-fix-ar":"استخدم رمز مستخدم مرتبط بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You do not have enough balance for this request.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","leave_request"],"properties":{"employee_id":{"type":"integer","description":"The direct report, from `employees.team`.","x-description-ar":"المرؤوس المباشر، من `employees.team`."},"leave_request":{"$ref":"#/components/schemas/leave_request_input"}}},"example":{"employee_id":1203,"leave_request":{"leave_policy_id":7,"start_date":"2026-03-09","end_date":"2026-03-11","reason":"Medical rest"}}}},"required":true,"description":"The report and the leave."}}},"/team_leaves/availability":{"get":{"summary":"Show how many of my team are away, day by day","operationId":"team_leaves.availability","tags":["Team leaves"],"description":"For each day from today (in the company's time zone) over the next `days` days, returns how many of the\ntoken owner's direct reports are on approved leave and how many are available, and whether it is a working\nday for anyone in the team. Pending requests are not counted.\n\n**When to use:** before approving leave, to see whether the team can spare someone (\"who is off next\nweek?\"). For today only, `team_leaves.stat_cards` is lighter.\n\n**Prerequisites:** none — the manager is the token's owner.\n\n**Side effects:** none.","x-summary-ar":"عرض عدد الغائبين من فريقي يوماً بيوم","x-description-ar":"لكل يوم بدءاً من اليوم (بتوقيت الشركة) على مدى `days` يوماً، يعيد عدد مرؤوسي صاحب الرمز المباشرين الذين\nفي إجازة موافق عليها وعدد الحاضرين، وهل هو يوم عمل لأحد في الفريق. لا تُحتسب الطلبات المعلّقة.\n\n**متى تستخدمه:** قبل الموافقة على إجازة، لمعرفة إن كان الفريق يحتمل غياب أحد («من الغائب الأسبوع القادم؟»).\nلليوم فقط، `team_leaves.stat_cards` أخف.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":30,"default":7},"description":"How many days, from today: 1 to 30. 7 when omitted.","x-description-ar":"عدد الأيام بدءاً من اليوم: من ١ إلى ٣٠. سبعة إن لم يُرسل.","example":7}],"responses":{"200":{"description":"One entry per day.","x-description-ar":"عنصر لكل يوم.","content":{"application/json":{"example":{"data":[{"date":"2026-03-02","total":6,"on_leave":0,"available":6,"working_day":true},{"date":"2026-03-03","total":6,"on_leave":1,"available":5,"working_day":true}]},"schema":{"$ref":"#/components/schemas/team_leave_availability"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"`days` is out of range.","x-description-ar":"`days` خارج النطاق.","x-codes":[{"code":"validation_failed","meaning":"`days` is not a whole number from 1 to 30.","x-meaning-ar":"`days` ليس عدداً صحيحاً من ١ إلى ٣٠.","x-fix":"Send `days` between 1 and 30.","x-fix-ar":"أرسل `days` بين ١ و٣٠."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"days must be a whole number between 1 and 30","code":"validation_failed"}}}}}}},"/team_leaves/export":{"get":{"summary":"Download my team's waiting leave requests as a spreadsheet","operationId":"team_leaves.export","tags":["Team leaves"],"description":"Builds an Excel (`format=xlsx`) or CSV (`format=csv`) file of the rows `team_leaves.pending_requests`\nreturns for the same `scope` and `sort`, with the columns you choose, headed in the requested language.\n`format` is required: without it the answer is 400 `bad_format`.\n\nUp to 10,000 rows the file comes back at once (200); above that it is built in the background and the\nanswer is 202 with the export record (`export`), to collect from QHR › Exports; above 20,000 rows it is\nrefused (422 `too_large`).\n\n**When to use:** to hand someone a file of the leave waiting on a manager's team. To read the requests,\nuse `team_leaves.pending_requests`.\n\n**Prerequisites:** `columns[]` from `team_leaves.export_columns`.\n\n**Side effects:** each attempt is recorded in the company's export history and the audit log; a background\nexport emails its owner when the file is ready. One export of this page per user runs at a time (409\n`export_in_progress`). Not offered to Claude: it returns a file, not JSON.","x-summary-ar":"تنزيل طلبات إجازة فريقي المنتظرة في جدول بيانات","x-description-ar":"ينشئ ملف Excel (`format=xlsx`) أو CSV (`format=csv`) بالصفوف التي يعيدها `team_leaves.pending_requests`\nلقيمتي `scope` و`sort` نفسيهما، بالأعمدة التي تختارها وبعناوين بلغة الطلب. `format` إلزامي: بدونه يكون\nالرد 400 `bad_format`.\n\nحتى ١٠٬٠٠٠ صف يعود الملف مباشرة (200)، وفوق ذلك يُبنى في الخلفية ويكون الرد 202 مع سجل التصدير (`export`)\nلاستلامه من QHR › التصدير، وفوق ٢٠٬٠٠٠ صف يُرفض (422 `too_large`).\n\n**متى تستخدمه:** لتسليم شخص ملفاً بالإجازات المنتظرة في فريق مدير. لقراءة الطلبات استخدم\n`team_leaves.pending_requests`.\n\n**المتطلبات:** `columns[]` من `team_leaves.export_columns`.\n\n**الآثار الجانبية:** تُسجَّل كل محاولة في سجل التصدير في الشركة وفي سجل التدقيق، ويصل صاحبَ التصدير في الخلفية\nبريد عند جاهزية الملف. يعمل تصدير واحد لهذه الصفحة لكل مستخدم في الوقت نفسه (409 `export_in_progress`). لا\nيُعرض على Claude: يعيد ملفاً لا JSON.","x-access":"write","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"}]},"x-feature":"leave_request","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"The file type: `xlsx` (Excel) or `csv`.","x-description-ar":"نوع الملف: `xlsx` (Excel) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"description":"The columns, in order (`key` from `team_leaves.export_columns`).","x-description-ar":"الأعمدة بالترتيب (`key` من `team_leaves.export_columns`).","example":["employee_name","leave_type_name","start_date","end_date","balance"]},{"name":"scope","in":"query","required":false,"schema":{"type":"string","enum":["all","mine"]},"description":"`all` or `mine`, as in `team_leaves.pending_requests`.","x-description-ar":"`all` أو `mine`، كما في `team_leaves.pending_requests`.","example":"all"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["submission_date_desc","submission_date_asc"]},"description":"Row order, as in `team_leaves.pending_requests`.","x-description-ar":"ترتيب الصفوف، كما في `team_leaves.pending_requests`.","example":"submission_date_desc"}],"responses":{"200":{"description":"The file (Excel or CSV, as asked).","x-description-ar":"الملف (Excel أو CSV حسب الطلب).","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Too many rows to build at once: the export is queued; collect the file from QHR › Exports.","x-description-ar":"صفوف كثيرة لا تُبنى دفعة واحدة: أُدرج التصدير في قائمة الانتظار؛ استلم الملف من QHR › التصدير."},"400":{"description":"The format or the columns are not valid.","x-description-ar":"الصيغة أو الأعمدة غير صحيحة.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No column was sent in `columns[]`.","x-meaning-ar":"لم يُرسل أي عمود في `columns[]`.","x-fix":"Send at least one `key` from the export's columns operation.","x-fix-ar":"أرسل مفتاحاً واحداً على الأقل من عملية أعمدة التصدير."},{"code":"unknown_column","meaning":"A column in `columns[]` does not exist on this export, or you may not see it.","x-meaning-ar":"عمود في `columns[]` غير موجود في هذا التصدير أو لا يحق لك رؤيته.","x-fix":"Send only `key` values from the export's columns operation.","x-fix-ar":"أرسل فقط قيم `key` من عملية أعمدة التصدير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Pick at least one column.","error_code":"no_columns","code":"no_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"يوجد تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"You already have an export of this page running; `export` describes it.","x-meaning-ar":"لديك تصدير لهذه الصفحة قيد التنفيذ؛ يصفه `export`.","x-fix":"Wait for it to finish (QHR › Exports), then export again.","x-fix-ar":"انتظر حتى ينتهي (QHR › التصدير) ثم صدّر من جديد."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","error_code":"export_in_progress","code":"export_in_progress","export":{"id":32,"page":"team_leaves","format":"xlsx","status":"processing"}}}}},"422":{"description":"There is nothing to export, or too much.","x-description-ar":"لا يوجد ما يُصدَّر، أو أنه كثير جداً.","x-codes":[{"code":"no_data","meaning":"No row matches the filters.","x-meaning-ar":"لا يطابق المرشحات أي صف.","x-fix":"Widen the filters.","x-fix-ar":"وسّع المرشحات."},{"code":"too_large","meaning":"More than 20,000 rows would be written; `row_count` and `max_rows` say how many.","x-meaning-ar":"سيُكتب أكثر من ٢٠٬٠٠٠ صف؛ يوضح `row_count` و`max_rows` العدد.","x-fix":"Narrow the filters or the date range.","x-fix-ar":"ضيّق المرشحات أو الفترة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","error_code":"no_data","code":"no_data"}}}}}}},"/team_leaves/export/columns":{"get":{"summary":"List the columns of the team leave export","operationId":"team_leaves.export_columns","tags":["Team leaves"],"description":"Returns the columns `team_leaves.export` can put in the file (employee number and name, leave type, dates,\ndays, status, stage, how it is paid, submitted on), each with its heading in the requested language and\nwhether it is ticked by default.\n\n**When to use:** before `team_leaves.export`, to choose the `columns[]` to send.\n\n**Prerequisites:** none. Needs the export permission as well as \"View others' leave requests\".\n\n**Side effects:** none.","x-summary-ar":"عرض أعمدة تصدير إجازات الفريق","x-description-ar":"يعيد الأعمدة التي يستطيع `team_leaves.export` وضعها في الملف (الرقم الوظيفي والاسم، نوع الإجازة، التواريخ،\nالأيام، الحالة، المرحلة، طريقة احتساب الأجر، تاريخ التقديم)، لكلٍّ عنوانه بلغة الطلب وهل هو محدد افتراضياً.\n\n**متى تستخدمه:** قبل `team_leaves.export` لاختيار `columns[]` التي ترسلها.\n\n**المتطلبات:** لا شيء. يحتاج صلاحية التصدير إضافة إلى «عرض طلبات إجازة الآخرين».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/hr_data","label":"Export Employees, Documents, Leaves and Attendance lists to Excel/CSV","x-label-ar":"تصدير قوائم الموظفين والمستندات والإجازات والحضور إلى Excel/CSV","x-also":[{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"}]},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns.","x-description-ar":"الأعمدة.","content":{"application/json":{"example":{"columns":[{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"start_date","label":"Start date","default":true,"type":"date"},{"key":"compensation_type","label":"Pay","default":false,"type":"enum"}]},"schema":{"$ref":"#/components/schemas/leave_request_export_columns"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/team_leaves/pending_requests":{"get":{"summary":"List the leave requests waiting on my team","operationId":"team_leaves.pending_requests","tags":["Team leaves"],"description":"Returns every leave request waiting for a decision that concerns the token owner as a manager: the pending\nrequests and cancellation requests of their direct reports, plus any request escalated to them because\nthe employee's own manager is on leave today. Newest submitted first. `can_act` says whether the owner can\ndecide it now (false when it waits for HR or another manager). Not paginated: the whole list comes back.\n\n**When to use:** for \"what do I need to approve?\" and to get the `id` for `leave_requests.approve`,\n`leave_requests.reject`, `leave_requests.approve_cancellation` or `leave_requests.withdraw`. `scope=mine`\nkeeps only those the owner can decide. Totals alone come from `team_leaves.stat_cards`.\n\n**Prerequisites:** none — the manager is the token's owner. Empty when they have no team.\n\n**Side effects:** none.","x-summary-ar":"عرض طلبات الإجازة المنتظرة في فريقي","x-description-ar":"يعيد كل طلب إجازة ينتظر قراراً ويخص صاحب الرمز بصفته مديراً: الطلبات المعلّقة وطلبات الإلغاء لمرؤوسيه\nالمباشرين، إضافة إلى أي طلب صُعّد إليه لأن مدير الموظف المباشر في إجازة اليوم. الأحدث تقديماً أولاً. يوضح\n`can_act` إن كان صاحب الرمز يستطيع البت فيه الآن (خطأ إن كان ينتظر الموارد البشرية أو مديراً آخر). بلا\nتقسيم صفحات: تعود القائمة كاملة.\n\n**متى تستخدمه:** لسؤال «ما الذي عليّ الموافقة عليه؟» ولمعرفة رقم `id` لاستخدامه في\n`leave_requests.approve` أو `leave_requests.reject` أو `leave_requests.approve_cancellation` أو\n`leave_requests.withdraw`. يُبقي `scope=mine` ما يستطيع صاحب الرمز البت فيه فقط. أما الأعداد وحدها فمن\n`team_leaves.stat_cards`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز. فارغة إن لم يكن له فريق.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"scope","in":"query","required":false,"schema":{"type":"string","enum":["all","mine"],"default":"all"},"description":"`all` (every waiting request) or `mine` (only those you can decide now).","x-description-ar":"`all` كل الطلبات المنتظرة، أو `mine` ما تستطيع البت فيه الآن فقط.","example":"mine"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["submission_date_desc","submission_date_asc"],"default":"submission_date_desc"},"description":"Newest (`submission_date_desc`) or oldest (`submission_date_asc`) submitted first.","x-description-ar":"الأحدث تقديماً أولاً (`submission_date_desc`) أو الأقدم (`submission_date_asc`).","example":"submission_date_asc"}],"responses":{"200":{"description":"The waiting requests.","x-description-ar":"الطلبات المنتظرة.","content":{"application/json":{"example":{"records":[{"id":5120,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","employee_image":null,"start_date":"2026-03-09","end_date":"2026-03-11","balance":"3.0","leave_type_name":"Annual","compensation_type":"fully_paid","compensation_type_label":"Fully paid","submission_date":"2026-03-02T06:00:00Z","current_stage":"awaiting_manager","can_act":true,"approver_actions":{"can_withdraw":false,"can_revoke":false,"revoke_blocked_reason":null}}]},"schema":{"$ref":"#/components/schemas/team_leave_pending_requests"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/team_leaves/policies":{"get":{"summary":"List the leave types I can file for a report","operationId":"team_leaves.policies","tags":["Team leaves"],"description":"Returns the active leave policies assigned to one of the token owner's direct reports, with the days the\nreport has left this year on each, whether the policy needs a supporting document or allows past dates,\nand where a filed request lands (`approver`).\n\n**When to use:** before `team_leaves.validate` and `team_leaves.create`, to pick the `leave_policy_id` and\ntell the manager the report's balance.\n\n**Prerequisites:** `employee_id` of a direct report who still works here, from `employees.team`. Anyone\nelse answers 404.\n\n**Side effects:** none.","x-summary-ar":"عرض أنواع الإجازات التي أقدّمها لمرؤوس","x-description-ar":"يعيد سياسات الإجازة المفعّلة المسندة إلى أحد مرؤوسي صاحب الرمز المباشرين، مع الأيام المتبقية للمرؤوس هذه\nالسنة في كل منها، وهل تشترط السياسة مستنداً داعماً أو تسمح بتواريخ ماضية، وأين يذهب الطلب بعد تقديمه\n(`approver`).\n\n**متى تستخدمه:** قبل `team_leaves.validate` و`team_leaves.create`، لاختيار `leave_policy_id` وإخبار المدير\nبرصيد المرؤوس.\n\n**المتطلبات:** `employee_id` لمرؤوس مباشر ما زال على رأس العمل، من `employees.team`. أي شخص آخر يُرجع 404.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/create_for_team","label":"File leave for direct reports","x-label-ar":"تقديم إجازات للتقارير المباشرة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/team_leave_employee_id"}],"responses":{"200":{"description":"The report's policies.","x-description-ar":"سياسات المرؤوس.","content":{"application/json":{"example":{"records":[{"id":7,"name":"Annual leave","available_balance":18.0,"requires_document":false,"allow_past_dates":false,"approver":"manager"}]},"schema":{"$ref":"#/components/schemas/team_leave_policies"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}}},"/team_leaves/stat_cards":{"get":{"summary":"Count my team's leave today and the requests waiting","operationId":"team_leaves.stat_cards","tags":["Team leaves"],"description":"Returns the cards above a manager's approvals page, for the token owner's team (their direct reports who\nstill work here, including those in their notice period): how many there are, how many are on approved\nleave today and how many are at work, how many leave requests wait for a decision (the team's, plus any\nescalated to the owner because another manager is on leave), and how many of those the owner can decide\nnow.\n\n**When to use:** for \"how many of my team are off today?\" or \"do I have leave to approve?\". To see the\nwaiting requests, use `team_leaves.pending_requests`; for the days ahead, `team_leaves.availability`.\n\n**Prerequisites:** none — the manager is the token's owner. All zeros when they have no team or no employee\nrecord.\n\n**Side effects:** none.","x-summary-ar":"عدّ إجازات فريقي اليوم والطلبات المنتظرة","x-description-ar":"يعيد البطاقات أعلى صفحة موافقات المدير لفريق صاحب الرمز (مرؤوسوه المباشرون العاملون، ومنهم من في فترة\nالإشعار): عددهم، وكم منهم في إجازة موافق عليها اليوم وكم على رأس العمل، وكم طلب إجازة ينتظر قراراً (طلبات\nالفريق، إضافة إلى ما صُعّد إلى صاحب الرمز لأن مديراً آخر في إجازة)، وكم منها يستطيع صاحب الرمز البت فيه\nالآن.\n\n**متى تستخدمه:** لأسئلة مثل «كم من فريقي غائب اليوم؟» أو «هل لديّ إجازات للموافقة؟». لرؤية الطلبات المنتظرة\nاستخدم `team_leaves.pending_requests`، وللأيام القادمة `team_leaves.availability`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز. كلها أصفار إن لم يكن له فريق أو سجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/view_others","label":"View others' leave requests","x-label-ar":"عرض طلبات إجازة الآخرين"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The cards.","x-description-ar":"البطاقات.","content":{"application/json":{"example":{"data":{"team_members":6,"on_leave_today":1,"available":5,"requests_waiting":2,"requires_my_action":2}},"schema":{"$ref":"#/components/schemas/team_leave_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/team_leaves/validate":{"get":{"summary":"Check a leave for a report before filing it","operationId":"team_leaves.validate","tags":["Team leaves"],"description":"The same check as `leave_requests.validate`, for one of the token owner's direct reports: the working days\nthe dates would charge, the days the report has left on the policy this year and whether that is enough,\nand which of the report's pending or approved requests share a day with them. Saves nothing.\n\n**When to use:** always before `team_leaves.create`.\n\n**Prerequisites:** `employee_id` from `employees.team`; `leave_policy_id` from `team_leaves.policies`.\n\n**Side effects:** none.","x-summary-ar":"التحقق من إجازة لمرؤوس قبل تقديمها","x-description-ar":"التحقق نفسه الذي يجريه `leave_requests.validate`، لأحد مرؤوسي صاحب الرمز المباشرين: أيام العمل التي\nستُخصم، والأيام المتبقية للمرؤوس في السياسة هذه السنة وهل تكفي، وأيّ طلباته المعلّقة أو الموافق عليها\nتشترك معها في يوم. لا يحفظ شيئاً.\n\n**متى تستخدمه:** دائماً قبل `team_leaves.create`.\n\n**المتطلبات:** `employee_id` من `employees.team`، و`leave_policy_id` من `team_leaves.policies`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"leave_request/create_for_team","label":"File leave for direct reports","x-label-ar":"تقديم إجازات للتقارير المباشرة"},"x-feature":"leave_request","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/team_leave_employee_id"},{"name":"leave_policy_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The leave policy, from `team_leaves.policies`.","x-description-ar":"سياسة الإجازة، من `team_leaves.policies`.","example":7},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","example":"2026-03-09"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","example":"2026-03-11"}],"responses":{"200":{"description":"The check.","x-description-ar":"نتيجة التحقق.","content":{"application/json":{"example":{"overlaps":[],"balance":{"available_days":18.0,"requested_days":3.0,"allow_negative_balance":false,"exceeded":false}},"schema":{"$ref":"#/components/schemas/leave_request_validation"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The dates or the policy cannot be checked.","x-description-ar":"تعذّر التحقق من التواريخ أو السياسة.","x-codes":[{"code":"validation_failed","meaning":"The policy is not assigned to the report or is switched off, a date is missing or invalid, the end is before the start, or the leave ends after the report's last working day. `error` says which.","x-meaning-ar":"السياسة غير مسندة إلى المرؤوس أو معطّلة، أو تاريخ ناقص أو غير صحيح، أو النهاية قبل البداية، أو تنتهي الإجازة بعد آخر يوم عمل للمرؤوس. يوضح `error` السبب.","x-fix":"Fix what `error` names, then check again.","x-fix-ar":"صحّح ما يذكره `error` ثم أعد التحقق."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"End date must be on or after start date","code":"validation_failed"}}}}}}},"/team_loans":{"get":{"summary":"List loans I requested for my team","operationId":"team_loans.list","tags":["Loans"],"description":"Returns the loans the token's owner requested for their current direct reports, newest first, with whose\nloan it is, its status and what is still owed.\n\n**When to use:** for a manager following up on requests they made for their team (\"was Sara's loan\napproved?\").\n\n**Prerequisites:** the token's owner must be an employee with direct reports.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض السلف التي طلبتها لفريقي","x-description-ar":"يعرض السلف التي طلبها صاحب الرمز لمرؤوسيه المباشرين الحاليين، الأحدث أولاً، مع صاحب السلفة وحالتها\nوالمتبقي منها.\n\n**متى تستخدمه:** لمتابعة المدير طلباته لفريقه («هل اعتُمدت سلفة سارة؟»).\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً له مرؤوسون مباشرون.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"loan/create_for_team","label":"Request loans for direct reports","x-label-ar":"طلب سلف للتقارير المباشرة"},"x-feature":"loan","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of team loans.","x-description-ar":"صفحة من سلف الفريق.","content":{"application/json":{"example":{"records":[{"id":418,"reference":"LON-0042","status":"pending","channel":null,"installments_count":null,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","installments_remaining":null,"outstanding":"0.00","repayment":null,"editable":true,"cancellable":true,"employee":{"id":1203,"full_name":"Sara Ahmed"},"submitted_by":{"id":88,"full_name":"Omar Ali"}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/team_loan_row"},"description":"The loans, newest first.","x-description-ar":"السلف، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Request a loan for a team member","operationId":"team_loans.create","tags":["Loans"],"description":"Submits a loan request on behalf of one of the token owner's direct reports. It joins HR's queue as\n`pending`, recording the manager as the one who asked; HR approves or rejects it on `hr_loans`.\n\n**When to use:** when a manager asks for an advance for someone in their team. The employee may hold only\none request awaiting a decision.\n\n**Prerequisites:** `employee_id` of a current direct report, from `employees.team`. Anyone else — another\nmanager's report, a leaver, yourself — answers 404.\n\n**Side effects:** everyone who may approve loans, except the manager, is emailed; the manager is emailed\nagain once HR decides. Recorded in the audit log. Not offered to Claude, because it starts a loan for\nsomeone other than the person asking.","x-summary-ar":"طلب سلفة لأحد أعضاء فريقي","x-description-ar":"يقدّم طلب سلفة نيابةً عن أحد المرؤوسين المباشرين لصاحب الرمز. ينضم إلى قائمة الموارد البشرية بحالة\n`pending` مع تسجيل المدير بوصفه مقدّم الطلب، وتعتمده الموارد البشرية أو ترفضه عبر `hr_loans`.\n\n**متى تستخدمه:** عندما يطلب المدير سلفة لأحد أفراد فريقه. لا يُسمح للموظف إلا بطلب واحد بانتظار القرار.\n\n**المتطلبات:** `employee_id` لمرؤوس مباشر حالي، من `employees.team`. أي شخص آخر — مرؤوس مدير آخر أو من\nغادر أو أنت نفسك — يُرجع 404.\n\n**الآثار الجانبية:** يصل بريد إلى كل من يملك صلاحية اعتماد السلف عدا المدير، ويصل المديرَ بريد آخر عند قرار\nالموارد البشرية. يُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يبدأ سلفة لشخص غير طالبها.","x-access":"write","x-permission":{"key":"loan/create_for_team","label":"Request loans for direct reports","x-label-ar":"طلب سلف للتقارير المباشرة"},"x-feature":"loan","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request.","x-description-ar":"الطلب الجديد.","content":{"application/json":{"example":{"record":{"id":418,"reference":"LON-0042","status":"pending","channel":null,"description":"Medical treatment for my father.","installments_count":6,"currency":"SAR","amount":"12500.00","needed_on":"2026-12-10","submitted_at":"2026-11-20T07:15:00Z","disbursement_date":"2026-12-10","installments_start_on":"2027-01-01","installments_end_on":"2027-06-01","installments_paid":0,"installments_remaining":6,"amount_repaid":"0.00","outstanding":"12500.00","repayment":null,"payments":[],"editable":false,"cancellable":false,"decision":null,"installments":[]}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/loan_detail"}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request was refused.","x-description-ar":"رُفض الطلب.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."},{"code":"validation_failed","meaning":"The employee already has a loan request awaiting a decision (named in `error`); only one may wait at a time.","x-meaning-ar":"لدى الموظف طلب سلفة بانتظار القرار (مذكور في `error`)؛ لا يُسمح إلا بطلب واحد معلّق.","x-fix":"Wait for that request to be decided, or cancel it with `loans.cancel`.","x-fix-ar":"انتظر حتى يُبتّ في ذلك الطلب، أو ألغه عبر `loans.cancel`."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Sara Ahmed already has a loan request awaiting a decision (LON-0042).","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","loan"],"properties":{"loan":{"type":"object","required":["amount","description","needed_on"],"description":"The request.","x-description-ar":"الطلب.","properties":{"amount":{"type":"string","description":"Amount wanted, decimal string, more than 0.","x-description-ar":"المبلغ المطلوب، نص عشري أكبر من 0."},"description":{"type":"string","description":"Why it is needed, up to 1000 characters.","x-description-ar":"سبب الحاجة، حتى ١٠٠٠ حرف."},"needed_on":{"type":"string","description":"Date the money is needed.","x-description-ar":"التاريخ المطلوب فيه المبلغ.","format":"date"}}},"employee_id":{"type":"integer","description":"A current direct report, from `employees.team`.","x-description-ar":"مرؤوس مباشر حالي، من `employees.team`."}}},"example":{"loan":{"amount":"12500.00","description":"Medical treatment for my father.","needed_on":"2026-12-10"},"employee_id":1203}}},"required":true,"description":"The team member and the request."}}},"/team_overtimes/pending_requests":{"get":{"summary":"List overtime waiting for my approval","operationId":"team_overtimes.pending_requests","tags":["Overtime"],"description":"Returns the overtime requests of the token owner's direct reports that are waiting for them as manager\n(`pending_manager`), oldest work date first, whatever the date. Each row says whether the token owner may\nact on it (`can_act`) and shows the employee's schedule that day, so the claim can be checked against it.\n\n**When to use:** to answer \"what overtime do I need to approve?\", then decide with\n`overtime_requests.approve` or `overtime_requests.reject`. HR's queue is `hr_overtimes.requests`.\n\n**Prerequisites:** the token owner must be an employee, with \"View team attendance\". Their direct reports are\nthe employees whose manager they are (`employees.team`).\n\n**Side effects:** none. Up to 50 requests per page.","x-summary-ar":"عرض طلبات العمل الإضافي التي تنتظر اعتمادي","x-description-ar":"يعرض طلبات العمل الإضافي لمرؤوسي صاحب الرمز المباشرين التي تنتظر قراره بصفته مديراً (`pending_manager`)،\nالأقدم تاريخ عمل أولاً، أياً كان التاريخ. يوضح كل سطر هل يستطيع صاحب الرمز البت فيه (`can_act`) ويعرض جدول\nدوام الموظف في ذلك اليوم للتحقق من الطلب.\n\n**متى تستخدمه:** للإجابة عن «ما العمل الإضافي الذي عليّ اعتماده؟»، ثم البت عبر `overtime_requests.approve` أو\n`overtime_requests.reject`. قائمة الموارد البشرية هي `hr_overtimes.requests`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضور الفريق». مرؤوسوه المباشرون هم الموظفون الذين\nهو مديرهم (`employees.team`).\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"$ref":"#/components/parameters/overtime_employee_filter"},{"$ref":"#/components/parameters/overtime_date_from_filter"},{"$ref":"#/components/parameters/overtime_date_to_filter"}],"responses":{"200":{"description":"A page of requests waiting for me.","x-description-ar":"صفحة من الطلبات التي تنتظرني.","content":{"application/json":{"example":{"records":[{"id":412,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-23","start_time":"17:00","end_time":"20:00","minutes":180,"hours":3.0,"reason":"Month-end closing","status":"pending_manager","trimmed":false,"original_start_time":null,"original_end_time":null,"current_approver_name":"Omar Ali","can_act":true,"attendance_profile":{"id":1,"name":"Standard","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0},"manager":null,"hr":null,"payroll_id":null,"created_at":"2026-11-23T17:45:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/overtime_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_overtimes/stat_cards":{"get":{"summary":"Get my team's overtime totals","operationId":"team_overtimes.stat_cards","tags":["Overtime"],"description":"Figures for the manager's overtime page, over the token owner's direct reports: how many requests wait for\nthem (any date) and their hours, how many were approved for dates this month and their hours, and the team\nsize.\n\n**When to use:** to answer \"how much team overtime is waiting for me, and how much was approved this\nmonth?\". The requests themselves are in `team_overtimes.pending_requests`.\n\n**Prerequisites:** the token owner must be an employee, with \"View team attendance\".\n\n**Side effects:** none.","x-summary-ar":"عرض إجماليات العمل الإضافي لفريقي","x-description-ar":"أرقام صفحة العمل الإضافي للمدير، لمرؤوسي صاحب الرمز المباشرين: عدد الطلبات التي تنتظره (أياً كان تاريخها)\nوساعاتها، وعدد المعتمد منها لتواريخ هذا الشهر وساعاته، وعدد أفراد الفريق.\n\n**متى تستخدمه:** للإجابة عن «كم من العمل الإضافي لفريقي ينتظرني، وكم اعتُمد هذا الشهر؟». الطلبات نفسها في\n`team_overtimes.pending_requests`.\n\n**المتطلبات:** أن يكون صاحب الرمز موظفاً لديه صلاحية «عرض حضور الفريق».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"My team's overtime totals.","x-description-ar":"إجماليات العمل الإضافي لفريقي.","content":{"application/json":{"example":{"needs_my_action":2,"pending_hours":5.5,"approved_this_month":4,"approved_hours_this_month":11.0,"team_size":6},"schema":{"$ref":"#/components/schemas/overtime_team_stat_cards"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token owner is a system user with no employee record; decisions are taken by employees (the manager, or HR staff).","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا سجل وظيفي؛ والقرارات يتخذها موظفون (المدير أو موظفو الموارد البشرية).","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_permissions/decided_requests":{"get":{"summary":"List team permissions I can still take back","operationId":"permission_requests.team_decided","tags":["Permission requests"],"description":"Returns the token owner's direct reports' permission requests (hourly leaves of absence) that the manager\ncan still take back: those the manager approved on the `manager_and_hr` route that now wait for HR\n(`actions.can_withdraw`), and approved requests whose window has not started yet (`actions.can_revoke`),\nearliest window first.\n\n**When to use:** to answer \"which permissions have I approved that are still coming up?\", or before\n`permission_requests.withdraw` / `permission_requests.revoke`.\n\n**Prerequisites:** a token created by a manager who is linked to an employee record.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض استئذانات الفريق التي يمكنني التراجع عنها","x-description-ar":"يعرض طلبات الاستئذان (الغياب بالساعات) الخاصة بالمرؤوسين المباشرين لصاحب الرمز التي ما زال المدير يستطيع\nالتراجع عنها: ما وافق عليه المدير في مسار `manager_and_hr` وينتظر الآن الموارد البشرية\n(`actions.can_withdraw`)، والطلبات المقبولة التي لم تبدأ فترتها بعد (`actions.can_revoke`)، الأقرب موعداً\nأولاً.\n\n**متى تستخدمه:** للإجابة عن \"ما الاستئذانات التي اعتمدتها ولم يحن موعدها؟\"، أو قبل\n`permission_requests.withdraw` أو `permission_requests.revoke`.\n\n**المتطلبات:** رمز أنشأه مدير مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of requests the manager can still take back.","x-description-ar":"صفحة من الطلبات التي يستطيع المدير التراجع عنها.","content":{"application/json":{"example":{"records":[{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"approved","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":null,"actions":{"can_edit":false,"can_cancel":false,"can_approve":false,"can_reject":false,"can_withdraw":false,"can_revoke":true,"blocked_reason":null},"manager":{"id":88,"name":"Omar Ali","acted_at":"2026-11-26T09:02:00Z","note":"Approved, get well soon"},"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/permission_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_permissions/pending_requests":{"get":{"summary":"List team permission requests waiting for me","operationId":"permission_requests.team_pending","tags":["Permission requests"],"description":"Returns the permission requests (hourly leaves of absence) of the token owner's current direct reports that\nwait for the manager's decision (`pending_manager`), earliest window first. Requests move with the\nemployee: if someone changes manager, their pending requests go to the new manager.\n\n**When to use:** to answer \"what permissions do I need to approve?\". Then approve or reject each one with\n`permission_requests.approve` / `permission_requests.reject`. Requests already waiting for HR are in\n`permission_requests.hr_list`.\n\n**Prerequisites:** a token created by a manager who is linked to an employee record.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلبات استئذان الفريق بانتظار قراري","x-description-ar":"يعرض طلبات الاستئذان (الغياب بالساعات) الخاصة بالمرؤوسين المباشرين الحاليين لصاحب الرمز التي تنتظر قرار\nالمدير (`pending_manager`)، الأقرب موعداً أولاً. تنتقل الطلبات مع الموظف: إن تغيّر مديره انتقلت طلباته\nالمعلّقة إلى المدير الجديد.\n\n**متى تستخدمه:** للإجابة عن \"ما طلبات الاستئذان التي عليّ اعتمادها؟\"، ثم وافق على كل طلب أو ارفضه عبر\n`permission_requests.approve` أو `permission_requests.reject`. الطلبات التي تنتظر الموارد البشرية موجودة في\n`permission_requests.hr_list`.\n\n**المتطلبات:** رمز أنشأه مدير مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of requests waiting for the manager.","x-description-ar":"صفحة من الطلبات بانتظار المدير.","content":{"application/json":{"example":{"records":[{"id":4812,"employee_id":1203,"minutes":120,"kind":"early_leave","note":"Doctor's appointment","status":"pending_manager","approval_route":"manager","reference":"PRM-4812","employee_no":"E-0042","employee_name":"Sara Ahmed","date":"2026-11-30","start_time":"15:00","end_time":"17:00","starts_at":"2026-11-30T12:00:00Z","ends_at":"2026-11-30T14:00:00Z","hours":2.0,"revoke_type":null,"attachment":null,"current_approver_name":"Omar Ali","actions":{"can_edit":false,"can_cancel":false,"can_approve":true,"can_reject":true,"can_withdraw":false,"can_revoke":false,"blocked_reason":null},"manager":null,"hr":null,"revoked":null,"cancelled_at":null,"created_at":"2026-11-26T07:15:00Z"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/permission_request_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_permissions/stat_cards":{"get":{"summary":"Count my team's permission requests","operationId":"permission_requests.team_stat_cards","tags":["Permission requests"],"description":"Counts, for the token owner's current direct reports, the permission requests (hourly leaves of absence)\nwaiting for the manager, and the requests approved this calendar month with their total hours.\n`earliest_pending_start` is the start of the soonest pending window, in UTC.\n\n**When to use:** to answer \"how many permissions are waiting for me?\" or \"how many hours of permission did\nmy team take this month?\".\n\n**Prerequisites:** a token created by a manager who is linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"إحصاءات طلبات استئذان فريقي","x-description-ar":"يحسب لمرؤوسي صاحب الرمز المباشرين الحاليين طلبات الاستئذان (الغياب بالساعات) التي تنتظر المدير، والطلبات\nالمقبولة في الشهر الحالي ومجموع ساعاتها. ويعطي `earliest_pending_start` بداية أقرب طلب معلّق بتوقيت UTC.\n\n**متى تستخدمه:** للإجابة عن \"كم طلب استئذان ينتظرني؟\" أو \"كم ساعة استئذان أخذ فريقي هذا الشهر؟\".\n\n**المتطلبات:** رمز أنشأه مدير مرتبط بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The team's counts.","x-description-ar":"أعداد الفريق.","content":{"application/json":{"example":{"needs_my_action":2,"approved_this_month":5,"approved_hours_this_month":9.5,"earliest_pending_start":"2026-11-30T12:00:00Z"},"schema":{"type":"object","properties":{"needs_my_action":{"type":"integer","description":"Requests waiting for the manager.","x-description-ar":"الطلبات بانتظار المدير."},"approved_this_month":{"type":"integer","description":"Requests approved for dates this month.","x-description-ar":"الطلبات المقبولة لتواريخ هذا الشهر."},"approved_hours_this_month":{"type":"number","description":"Their total hours.","x-description-ar":"مجموع ساعاتها."},"earliest_pending_start":{"type":"string","description":"Start of the soonest pending window, in UTC; null when none waits.","x-description-ar":"بداية أقرب طلب معلّق بتوقيت UTC؛ null إن لم يوجد.","nullable":true}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز بلا سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.","x-meaning-ar":"صاحب الرمز مستخدم في الشركة بلا سجل وظيفي، فلا يستطيع التصرف كمدير أو كمعتمد من الموارد البشرية.","x-fix":"Use a token created by a user who is linked to an employee, or ask HR to link this user to their employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بموظف، أو اطلب من الموارد البشرية ربط هذا المستخدم بسجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_time_incidents":{"get":{"summary":"List my team's time incidents waiting on me","operationId":"time_incidents.team_list","tags":["Time incidents"],"description":"The manager's queue: the incidents of the token owner's direct reports that are waiting on the manager\n(`pending_manager`) in a period, newest date first, with the attendance behind each, the employee's reason\nif they gave one, and `deduct_escalates` (deducting passes it to HR rather than ending it). Incidents already\nwith HR or decided are not here.\n\n**When to use:** for a manager's \"what do I need to review?\", then `time_incidents.decide` on each. The period\nis the current month unless you send `from` / `to`.\n\n**Prerequisites:** none — the manager is the token's owner, who must be linked to an employee record.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مخالفات فريقي التي تنتظر قراري","x-description-ar":"قائمة المدير: مخالفات مرؤوسي صاحب الرمز المباشرين التي تنتظر قرار المدير (`pending_manager`) في فترة، الأحدث\nتاريخاً أولاً، مع الحضور الذي نشأت منه كل مخالفة وسبب الموظف إن ذكره، و`deduct_escalates` (الخصم ينقلها إلى\nالموارد البشرية بدل إنهائها). لا تشمل ما وصل إلى الموارد البشرية أو صدر فيه القرار.\n\n**متى تستخدمه:** لسؤال المدير \"ما الذي عليّ مراجعته؟\"، ثم `time_incidents.decide` لكل مخالفة. الفترة هي الشهر\nالحالي ما لم ترسل `from` و`to`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز، ويجب أن يكون مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ مخالفة في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_from"},{"$ref":"#/components/parameters/time_incident_to"},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["absence","late","early_leave","short_hours","incomplete"]},"description":"Only this kind.","x-description-ar":"نوع محدد فقط.","example":"late"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee (id from `employees.list`).","x-description-ar":"موظف محدد فقط (الرقم من `employees.list`).","example":1203},{"name":"q[justified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents the employee explained.","x-description-ar":"`true`: المخالفات التي برّرها الموظف فقط.","example":true},{"name":"q[unjustified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents with no explanation.","x-description-ar":"`true`: المخالفات التي لا تبرير لها فقط.","example":true},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of incidents waiting on the manager.","x-description-ar":"صفحة من المخالفات بانتظار المدير.","content":{"application/json":{"example":{"records":[{"id":5120,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","department":"Finance","date":"2026-08-12","kind":"late","minutes":35,"hours":0.58,"status":"pending_manager","deductible":true,"can_decide":true,"can_act":true,"lock_reason":null,"payroll_reference":null,"payroll_id":null,"deduct_escalates":true,"manager":{"id":88,"name":"Omar Ali"},"manager_acted_at":null,"manager_note":null,"decided_by":null,"decided_at":null,"note":null,"justification":{"reason":"Accident on the Eastern Ring Road; traffic was stopped for 40 minutes.","submitted_at":"2026-08-12T09:10:00Z","conflicted":false},"justification_window":{"open":true,"deadline":"2026-08-19","days_left":7},"attendance":{"record_id":90311,"status":"late","check_in_at":"2026-08-12T06:35:00Z","check_out_at":"2026-08-12T14:00:00Z","worked_hours":7.42},"attendance_profile":{"id":1,"name":"Head office","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/time_incident_page"}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"`from` or `to` is not a date in `YYYY-MM-DD` form.","x-meaning-ar":"`from` أو `to` ليس تاريخاً بالصيغة `YYYY-MM-DD`.","x-fix":"Send both dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company. A decision records who made it, and a manager's queue is their own direct reports, so both need one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. القرار يُسجَّل باسم من اتخذه، وقائمة المدير هي مرؤوسوه المباشرون، فكلاهما يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/team_time_incidents/stat_cards":{"get":{"summary":"Summarise my team's time incidents waiting on me","operationId":"time_incidents.team_stat_cards","tags":["Time incidents"],"description":"For the token owner's direct reports, in a period: how many incidents wait on the manager\n(`needs_my_action`, always equal to `time_incidents.team_list`'s total), their absence hours and undertime\nhours (late, early leave, short hours), and the team's size.\n\n**When to use:** for \"how much do I have to review?\" before opening the list. The period is the current month\nunless you send `from` / `to`.\n\n**Prerequisites:** none — the manager is the token's owner, who must be linked to an employee record.\n\n**Side effects:** none.","x-summary-ar":"ملخص مخالفات فريقي التي تنتظر قراري","x-description-ar":"لمرؤوسي صاحب الرمز المباشرين في فترة: عدد المخالفات التي تنتظر المدير (`needs_my_action`، ويساوي دائماً إجمالي\n`time_incidents.team_list`)، وساعات الغياب وساعات نقص الوقت فيها (التأخر والانصراف المبكر ونقص الساعات)، وعدد\nأفراد الفريق.\n\n**متى تستخدمه:** لمعرفة \"كم عليّ أن أراجع؟\" قبل فتح القائمة. الفترة هي الشهر الحالي ما لم ترسل `from` و`to`.\n\n**المتطلبات:** لا شيء — المدير هو صاحب الرمز، ويجب أن يكون مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_from"},{"$ref":"#/components/parameters/time_incident_to"}],"responses":{"200":{"description":"The team's figures.","x-description-ar":"أرقام الفريق.","content":{"application/json":{"example":{"period":{"from":"2026-08-01","to":"2026-08-31"},"needs_my_action":4,"absence_hours":8.0,"undertime_hours":1.75,"team_size":6},"schema":{"type":"object","required":["period","needs_my_action","absence_hours","undertime_hours","team_size"],"properties":{"period":{"type":"object","description":"The period counted.","x-description-ar":"الفترة المحسوبة.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"}}},"needs_my_action":{"type":"integer","description":"Incidents waiting on the manager.","x-description-ar":"المخالفات التي تنتظر المدير."},"absence_hours":{"type":"number","description":"Hours of absence among them.","x-description-ar":"ساعات الغياب فيها."},"undertime_hours":{"type":"number","description":"Hours late, left early or short among them.","x-description-ar":"ساعات التأخر والانصراف المبكر ونقص الساعات فيها."},"team_size":{"type":"integer","description":"Direct reports.","x-description-ar":"عدد المرؤوسين المباشرين."}}}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"`from` or `to` is not a date in `YYYY-MM-DD` form.","x-meaning-ar":"`from` أو `to` ليس تاريخاً بالصيغة `YYYY-MM-DD`.","x-fix":"Send both dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل وظيفي.","x-codes":[{"code":"employee_required","meaning":"The token's owner has no employee record in this company. A decision records who made it, and a manager's queue is their own direct reports, so both need one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. القرار يُسجَّل باسم من اتخذه، وقائمة المدير هي مرؤوسوه المباشرون، فكلاهما يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/termination_packages":{"get":{"summary":"List termination packages","operationId":"termination_packages.list","tags":["End of service"],"description":"Returns the end-of-service packages, newest first, with the employee, reason, dates, what they are owed,\nwhat is taken off and the net payout, and the payout once recorded. `meta` gives the count per status and\nwhether confirmations go to an accountant in Qoyod (`accounting_mode: approval`). The full calculation is\nnot included; read it with `termination_packages.show`.\n\n**When to use:** to answer \"who is leaving and what are we paying them?\", or to find a package's `id`.\n\n**Prerequisites:** none. The employee filters take a name or number; `department_id` and `location_id` come\nfrom `employees.meta_data`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض تسويات نهاية الخدمة","x-description-ar":"يعرض تسويات نهاية الخدمة، الأحدث أولاً، مع الموظف والسبب والتواريخ والمستحقات والخصومات وصافي الصرف، والصرف\nالمسجّل إن وُجد. يتضمن `meta` عدد التسويات لكل حالة وهل يذهب الاعتماد إلى محاسب في قيود\n(`accounting_mode: approval`). لا تتضمن القائمة تفاصيل الحساب؛ اقرأها عبر `termination_packages.show`.\n\n**متى تستخدمه:** للإجابة عن «من يغادر وكم ندفع له؟» أو لمعرفة رقم `id` تسوية.\n\n**المتطلبات:** لا شيء. مرشّحات الموظف تأخذ الاسم أو الرقم، و`department_id` و`location_id` من\n`employees.meta_data`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["draft","pending_accounting","declined","paid","cancelled"]},"description":"Only this status.","x-description-ar":"هذه الحالة فقط.","example":"draft"},{"name":"q[employee_employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee name contains.","x-description-ar":"اسم الموظف يحتوي على.","example":"Ahmed"},{"name":"q[employee_employee_no_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee number contains.","x-description-ar":"الرقم الوظيفي يحتوي على.","example":"EMP-01"},{"name":"q[last_working_day_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last working day on or after.","x-description-ar":"آخر يوم عمل في هذا التاريخ أو بعده.","example":"2026-12-01"},{"name":"q[last_working_day_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last working day on or before.","x-description-ar":"آخر يوم عمل في هذا التاريخ أو قبله.","example":"2026-12-31"},{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this department.","x-description-ar":"هذا القسم فقط.","example":4},{"name":"location_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this work location.","x-description-ar":"موقع العمل هذا فقط.","example":2},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of packages.","x-description-ar":"صفحة من التسويات.","content":{"application/json":{"example":{"records":[{"id":41,"reference":"EOS-0041","status":"draft","include_last_payroll":false,"currency":"SAR","status_label_en":"Draft","status_label_ar":"مسودة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","has_override":false,"payment_status":null,"payment":null,"accounting":{"mode":"legacy","gate":"none"},"created_by":{"id":88,"name":"Faisal Al-Qahtani"},"created_at":"2026-11-27T08:00:00Z"}],"meta":{"accounting_mode":"legacy","counts":{"draft":1}},"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/termination_package_row"},"description":"The packages.","x-description-ar":"التسويات."},"meta":{"type":"object","description":"`accounting_mode` (`legacy` or `approval`) and `counts` per status.","x-description-ar":"`accounting_mode` (`legacy` أو `approval`) و`counts` العدد لكل حالة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Save an end-of-service package as a draft","operationId":"termination_packages.create","tags":["End of service"],"description":"Calculates an employee's end of service — as `termination_packages.preview` does — and saves it as a `draft`\nwith the calculation frozen on it and a reference (`EOS-0041`). HR may pay a different total than the one\ncalculated by sending `compensation_total` with an `override_reason` of at least 20 characters; the\ndifference is kept and shown.\n\n**A draft changes nothing:** the employee stays active and on payroll, loans and leave are untouched and\nnothing goes to accounting. All of that happens on `termination_packages.confirm`.\n\n**When to use:** once the exit is decided and the figures look right in the preview. An employee can have one\npackage at a time (cancel the old one first).\n\n**Prerequisites:** `employee_id` from `termination_packages.employee_options`, `reason_id` from\n`termination_reasons.list`. The token's owner must be an employee (they are recorded as the creator). The\npayment date cannot be in the past or before the last working day.\n\n**Side effects:** a draft package; recorded in the audit log. Not offered to Claude, because it decides what a\nleaving employee is paid.","x-summary-ar":"حفظ تسوية نهاية خدمة كمسودة","x-description-ar":"يحسب نهاية خدمة الموظف — كما في `termination_packages.preview` — ويحفظها مسودة `draft` مع تجميد الحساب\nومرجع (`EOS-0041`). يمكن للموارد البشرية صرف إجمالي مختلف عن المحسوب بإرسال `compensation_total` مع\n`override_reason` لا يقل عن ٢٠ حرفاً؛ ويُحفظ الفرق ويُعرض.\n\n**المسودة لا تغيّر شيئاً:** يبقى الموظف نشطاً وعلى المسيّر، ولا تُمس السلف والإجازات، ولا يُرسل شيء إلى\nالمحاسبة. كل ذلك يحدث عند `termination_packages.confirm`.\n\n**متى تستخدمه:** بعد تقرير المغادرة والتأكد من الأرقام في المعاينة. للموظف تسوية واحدة في كل مرة (ألغِ\nالقديمة أولاً).\n\n**المتطلبات:** `employee_id` من `termination_packages.employee_options` و`reason_id` من\n`termination_reasons.list`. يجب أن يكون صاحب الرمز موظفاً (يُسجَّل منشئاً). لا يكون تاريخ الصرف في الماضي ولا\nقبل آخر يوم عمل.\n\n**الآثار الجانبية:** تسوية بحالة مسودة، وتُسجَّل في سجل التدقيق. لا تُعرض على Claude لأنها تحدد ما يُصرف\nللموظف المغادر.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The draft package.","x-description-ar":"التسوية المسودة.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"draft","include_last_payroll":false,"status_label_en":"Draft","status_label_ar":"مسودة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":null,"approved_at":null,"paid_at":null,"cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":null,"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":null,"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":true,"can_recalculate":true,"can_confirm":true,"can_cancel":true}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The package cannot be saved.","x-description-ar":"لا يمكن حفظ التسوية.","x-codes":[{"code":"not_found","meaning":"`employee_id` names no employee.","x-meaning-ar":"`employee_id` لا يطابق أي موظف.","x-fix":"Take the id from `termination_packages.employee_options`.","x-fix-ar":"خذ الرقم من `termination_packages.employee_options`."},{"code":"package_already_exists","meaning":"The employee already has a package that is not cancelled; `id`, `reference` and `status` name it.","x-meaning-ar":"للموظف تسوية غير ملغاة؛ يذكرها `id` و`reference` و`status`.","x-fix":"Open that package (`termination_packages.show`), or cancel it first.","x-fix-ar":"افتح تلك التسوية (`termination_packages.show`)، أو ألغها أولاً."},{"code":"employee_not_active","meaning":"The employee is no longer active (already serving notice or gone).","x-meaning-ar":"الموظف لم يعد نشطاً (في فترة الإشعار أو غادر).","x-fix":"Nothing to do here; a package is only for an active employee.","x-fix-ar":"لا إجراء هنا؛ التسوية للموظف النشط فقط."},{"code":"payment_date_required","meaning":"`payment_date` is missing or not a date.","x-meaning-ar":"`payment_date` ناقص أو ليس تاريخاً.","x-fix":"Send the pay date as `YYYY-MM-DD`.","x-fix-ar":"أرسل تاريخ الصرف بالشكل `YYYY-MM-DD`."},{"code":"payment_date_in_past","meaning":"The payment date is before today (company time zone).","x-meaning-ar":"تاريخ الصرف قبل اليوم (بتوقيت الشركة).","x-fix":"Use today or a later date.","x-fix-ar":"استخدم اليوم أو تاريخاً لاحقاً."},{"code":"payment_date_before_last_working_day","meaning":"The payment date is before the last working day.","x-meaning-ar":"تاريخ الصرف قبل آخر يوم عمل.","x-fix":"Pay on or after the last working day.","x-fix-ar":"اجعل الصرف في آخر يوم عمل أو بعده."},{"code":"override_reason_required","meaning":"`compensation_total` differs from the calculated total and no `override_reason` was sent.","x-meaning-ar":"`compensation_total` يختلف عن الإجمالي المحسوب ولم يُرسل `override_reason`.","x-fix":"Explain the difference in `override_reason`, or drop `compensation_total`.","x-fix-ar":"اشرح الفرق في `override_reason`، أو احذف `compensation_total`."},{"code":"override_reason_too_short","meaning":"`override_reason` is shorter than 20 characters.","x-meaning-ar":"`override_reason` أقصر من ٢٠ حرفاً.","x-fix":"Write a real explanation, 20 characters at least.","x-fix-ar":"اكتب سبباً واضحاً لا يقل عن ٢٠ حرفاً."},{"code":"compensation_total_negative","meaning":"`compensation_total` is negative.","x-meaning-ar":"`compensation_total` سالب.","x-fix":"Send zero or more.","x-fix-ar":"أرسل صفراً أو أكثر."},{"code":"offsets_exceed_compensation","meaning":"Loans, deductions and custody owed exceed what the employee is owed; the message gives the shortfall.","x-meaning-ar":"السلف والاستقطاعات والعهد المستحقة على الموظف تتجاوز مستحقاته؛ تذكر الرسالة مقدار العجز.","x-fix":"Settle part of the loans or custody first, or raise the total.","x-fix-ar":"سدّد جزءاً من السلف أو العهد أولاً، أو ارفع الإجمالي."},{"code":"loan_not_settleable","meaning":"One of the employee's loans cannot be settled from the package; `reference` names it.","x-meaning-ar":"إحدى سلف الموظف لا يمكن تسويتها من التسوية؛ يذكرها `reference`.","x-fix":"Resolve that loan first (`hr_loans.show`).","x-fix-ar":"عالج تلك السلفة أولاً (`hr_loans.show`)."},{"code":"custody_installment_in_flight","meaning":"A custody installment is on a payroll run that is not finished; `reference` names it.","x-meaning-ar":"قسط عهدة على مسيّر رواتب لم يكتمل؛ يذكره `reference`.","x-fix":"Finish or revert that payroll run first.","x-fix-ar":"أكمل ذلك المسيّر أو أرجعه أولاً."},{"code":"payable_not_positive","meaning":"With accounting approval on, what remains after deductions and custody would be zero or less, which Qoyod refuses.","x-meaning-ar":"مع تفعيل اعتماد المحاسبة، يكون المتبقي بعد الاستقطاعات والعهد صفراً أو أقل، وهذا ترفضه قيود.","x-fix":"Override the total with a reason, or settle the custody first.","x-fix-ar":"عدّل الإجمالي يدوياً مع ذكر السبب، أو سدّد العهدة أولاً."},{"code":"no_active_salary","meaning":"The employee has no active salary, so there is no wage to calculate from.","x-meaning-ar":"ليس للموظف راتب نشط، فلا يوجد أجر يُحسب عليه.","x-fix":"Give the employee an active salary (`salaries.create`).","x-fix-ar":"أضف للموظف راتباً نشطاً (`salaries.create`)."},{"code":"no_join_date","meaning":"The employee has no join date, so the length of service is unknown.","x-meaning-ar":"ليس للموظف تاريخ التحاق، فمدة الخدمة غير معروفة.","x-fix":"Set the join date with `employees.update` (`employment_detail.join_date`).","x-fix-ar":"عيّن تاريخ الالتحاق عبر `employees.update` (`employment_detail.join_date`)."},{"code":"unknown_reason","meaning":"`reason_id` is not one of the ministry's reasons.","x-meaning-ar":"`reason_id` ليس من أسباب الوزارة.","x-fix":"Pick an id from `termination_reasons.list`.","x-fix-ar":"اختر رقماً من `termination_reasons.list`."},{"code":"last_working_day_required","meaning":"`last_working_day` is missing or not a date.","x-meaning-ar":"`last_working_day` ناقص أو ليس تاريخاً.","x-fix":"Send the last working day as `YYYY-MM-DD`.","x-fix-ar":"أرسل آخر يوم عمل بالشكل `YYYY-MM-DD`."},{"code":"last_working_day_before_join_date","meaning":"The last working day is before the employee joined.","x-meaning-ar":"آخر يوم عمل يسبق تاريخ التحاق الموظف.","x-fix":"Correct the last working day, or the join date.","x-fix-ar":"صحّح آخر يوم عمل أو تاريخ الالتحاق."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، وكل تغيير على التسوية يُسجَّل باسم الموظف الذي أجراه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required","error_code":"override_reason_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employee_id","reason_id","last_working_day","payment_date"],"properties":{"employee_id":{"type":"integer","description":"The leaving employee, from `termination_packages.employee_options`.","x-description-ar":"الموظف المغادر، من `termination_packages.employee_options`."},"reason_id":{"type":"integer","description":"Reason, from `termination_reasons.list`.","x-description-ar":"السبب، من `termination_reasons.list`."},"last_working_day":{"type":"string","description":"Last working day.","x-description-ar":"آخر يوم عمل.","format":"date"},"payment_date":{"type":"string","description":"Pay date: today or later, not before the last working day.","x-description-ar":"تاريخ الصرف: اليوم أو بعده، وليس قبل آخر يوم عمل.","format":"date"},"include_last_payroll":{"type":"boolean","description":"`true` pays the final partial month in the package (the employee is kept off that payroll run).","x-description-ar":"`true` يصرف الشهر الأخير ضمن التسوية (ويُستبعد الموظف من ذلك المسيّر)."},"compensation_total":{"type":"string","description":"Total to pay instead of the calculated one, decimal string.","x-description-ar":"إجمالي يُصرف بدلاً من المحسوب، نص عشري."},"override_reason":{"type":"string","description":"Why the total differs, 20 characters at least.","x-description-ar":"سبب اختلاف الإجمالي، ٢٠ حرفاً على الأقل."}}},"example":{"employee_id":1203,"reason_id":9,"last_working_day":"2026-12-31","payment_date":"2027-01-05","include_last_payroll":false}}},"required":true,"description":"The package."}}},"/termination_packages/accounting_sync":{"get":{"summary":"List termination packages and their accounting sync","operationId":"termination_packages.accounting_sync","tags":["End of service"],"description":"For companies connected to Qoyod accounting: the confirmed packages (with accounting, declined or paid) and\nwhether each reached the books — `sync_state` is `synced`, `syncing`, `awaiting_accounting` or `problem` —\nwith the event detail and the journal entry once posted. `summary` counts each state;\n`connection_status` says whether the company is connected at all (an unconnected company gets an empty list).\n\n**When to use:** to answer \"did Ahmed's end-of-service reach accounting?\" or to find packages to re-send with\n`termination_packages.resync`.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض تسويات نهاية الخدمة وحالة مزامنتها مع المحاسبة","x-description-ar":"للشركات المرتبطة بمحاسبة قيود: التسويات المعتمدة (لدى المحاسبة أو المرفوضة أو المصروفة) وهل وصلت كل منها\nإلى الدفاتر — `sync_state` هي `synced` أو `syncing` أو `awaiting_accounting` أو `problem` — مع تفاصيل الحدث\nوقيد اليومية بعد ترحيله. يعدّ `summary` كل حالة، ويبيّن `connection_status` هل الشركة مرتبطة أصلاً (الشركة غير\nالمرتبطة تحصل على قائمة فارغة).\n\n**متى تستخدمه:** للإجابة عن «هل وصلت مكافأة أحمد إلى المحاسبة؟» أو لمعرفة التسويات التي يُعاد إرسالها عبر\n`termination_packages.resync`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"sync_state","in":"query","required":false,"schema":{"type":"string","enum":["all","problem","syncing","awaiting_accounting","synced"]},"description":"Only this sync state; `all` when omitted.","x-description-ar":"حالة المزامنة هذه فقط؛ `all` إن لم يُرسل.","example":"problem"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["all","pending_accounting","declined","paid"]},"description":"Only this package status.","x-description-ar":"حالة التسوية هذه فقط.","example":"paid"},{"name":"period","in":"query","required":false,"schema":{"type":"string"},"description":"Confirmed in this month, `YYYY-MM`.","x-description-ar":"اعتُمدت في هذا الشهر، بالشكل `YYYY-MM`.","example":"2026-11"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"The packages and their sync state.","x-description-ar":"التسويات وحالة مزامنتها.","content":{"application/json":{"example":{"records":[{"package_id":41,"reference":"EOS-0041","employee_id":1203,"employee_no":"EMP-0142","employee_name":"Ahmed Al-Otaibi","status":"paid","amount":"37888.89","currency":"SAR","last_working_day":"2026-12-31","confirmed_at":"2026-11-27T09:00:00Z","sync_state":"synced","can_sync":false,"events":[{"event_type":"termination_package.finalized","event_id":"7f3c9a1e-0b2d-4c55-9a43-1d2e3f4a5b6c","state":"posted","title":"End-of-service settlement EOS-0041","amount":"37888.89","currency":"SAR","occurred_at":"2026-11-27T09:00:00Z","can_sync":false,"sync_reason":"posted","reason":null,"journal_entry":{"ref":"JE-1042","url":"https://app.qoyod.com/journal_entries/1042"},"attempts":1,"next_attempt_at":null}]}],"connection_status":"connected","sync_enabled":true,"summary":{"total":1,"synced":1,"syncing":0,"awaiting_accounting":0,"problem":0},"pagination":{"current_page":1,"per_page":50,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"One row per package.","x-description-ar":"صف لكل تسوية.","items":{"type":"object","properties":{"package_id":{"type":"integer","description":"Package id.","x-description-ar":"رقم التسوية."},"reference":{"type":"string","description":"Package reference.","x-description-ar":"مرجع التسوية."},"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Employee name.","x-description-ar":"اسم الموظف."},"status":{"type":"string","description":"Package status.","x-description-ar":"حالة التسوية."},"amount":{"type":"string","description":"Net payout.","x-description-ar":"صافي الصرف."},"currency":{"type":"string","description":"Currency.","x-description-ar":"العملة."},"last_working_day":{"type":"string","description":"Last working day.","x-description-ar":"آخر يوم عمل."},"confirmed_at":{"type":"string","description":"When confirmed.","x-description-ar":"وقت الاعتماد.","nullable":true},"sync_state":{"type":"string","description":"`synced`, `syncing`, `awaiting_accounting` or `problem`.","x-description-ar":"`synced` أو `syncing` أو `awaiting_accounting` أو `problem`."},"can_sync":{"type":"boolean","description":"True when it can be re-sent now by this caller.","x-description-ar":"صحيح إذا أمكن لهذا المستدعي إعادة إرسالها الآن."},"events":{"type":"array","description":"Accounting events: state, reason, journal entry, attempts.","x-description-ar":"أحداث المحاسبة: الحالة والسبب وقيد اليومية وعدد المحاولات.","items":{"type":"object"}}}}},"connection_status":{"type":"string","description":"`connected`, `needs_reauth`, `disconnected` or `not_connected`.","x-description-ar":"`connected` أو `needs_reauth` أو `disconnected` أو `not_connected`."},"sync_enabled":{"type":"boolean","description":"True when sending to accounting is switched on.","x-description-ar":"صحيح إذا كان الإرسال إلى المحاسبة مفعّلاً."},"summary":{"type":"object","description":"`total` and a count per sync state.","x-description-ar":"`total` وعدد لكل حالة مزامنة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/termination_packages/employee_options":{"get":{"summary":"List employees a package can be created for","operationId":"termination_packages.employee_options","tags":["End of service"],"description":"Returns the active employees with an active salary and no package already in progress, alphabetically, with\ntheir join date and contract type — the facts the calculation starts from.\n\n**When to use:** to pick the `employee_id` for `termination_packages.preview` and\n`termination_packages.create`. Someone missing here is inactive, has no salary, or already has a package.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الموظفين الذين يمكن إنشاء تسوية لهم","x-description-ar":"يعرض الموظفين النشطين الذين لهم راتب نشط وليس لهم تسوية قائمة، أبجدياً، مع تاريخ الالتحاق ونوع العقد — وهما\nأساس الحساب.\n\n**متى تستخدمه:** لاختيار `employee_id` في `termination_packages.preview` و`termination_packages.create`. من لا\nيظهر هنا إما غير نشط أو بلا راتب أو له تسوية قائمة.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Name or employee number contains.","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على.","example":"Ahmed"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"Employees who can be given a package.","x-description-ar":"الموظفون الذين يمكن إنشاء تسوية لهم.","content":{"application/json":{"example":{"records":[{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","location":"Riyadh HQ","join_date":"2019-03-01","contract_type":"indefinite","currency":"SAR"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"The employees.","x-description-ar":"الموظفون.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية.","nullable":true},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"location":{"type":"string","description":"Work location.","x-description-ar":"موقع العمل.","nullable":true},"join_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","format":"date","nullable":true},"contract_type":{"type":"string","description":"`definite` or `indefinite`.","x-description-ar":"`definite` محدد أو `indefinite` غير محدد.","nullable":true},"currency":{"type":"string","description":"Pay currency.","x-description-ar":"عملة الراتب."}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/termination_packages/export":{"get":{"summary":"Export termination packages to Excel or CSV","operationId":"termination_packages.export","tags":["End of service"],"description":"Builds a file of the end-of-service packages, one row per package, with the columns you choose (reference,\nemployee, status, reason, last working day, currency, compensation, offsets, net payout, payment status…) and a\ntotals row per currency. It takes the same filters as `termination_packages.list`, so the file matches what\nthe list shows.\n\n**When to use:** to hand end-of-service figures to finance or archive them. To read figures,\n`termination_packages.list` is lighter.\n\n**Prerequisites:** column keys from `termination_packages.export_columns`. You need \"Export payroll data\" as\nwell as \"Manage offboarding\" (`x-permission.x-also`).\n\n**Side effects:** the export is recorded (it shows in `exports.list`) and in the audit log. Up to 10,000 rows\nthe file comes back at once; above that it is built in the background (202) and QHR emails you when it is\nready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not\noffered to Claude.","x-summary-ar":"تصدير تسويات نهاية الخدمة إلى إكسل أو CSV","x-description-ar":"يُنشئ ملفاً بتسويات نهاية الخدمة، صفاً لكل تسوية، بالأعمدة التي تختارها (المرجع والموظف والحالة والسبب وآخر\nيوم عمل والعملة والمستحقات والخصومات وصافي الصرف وحالة الصرف…) مع صف إجماليات لكل عملة. يقبل مرشحات\n`termination_packages.list` نفسها، فيطابق الملف ما تعرضه القائمة.\n\n**متى تستخدمه:** لتسليم أرقام نهاية الخدمة إلى المالية أو أرشفتها. لقراءة الأرقام فقط\n`termination_packages.list` أخف.\n\n**المتطلبات:** مفاتيح الأعمدة من `termination_packages.export_columns`. تحتاج «تصدير بيانات الرواتب» إضافة\nإلى «إدارة إنهاء الخدمة» (`x-permission.x-also`).\n\n**الآثار الجانبية:** يُسجَّل التصدير (ويظهر في `exports.list`) وفي سجل التدقيق. حتى ١٠٬٠٠٠ صف يعود الملف\nفوراً، وما زاد يُنشأ في الخلفية (202) ويصلك بريد عند جاهزيته. تصدير واحد لهذه الصفحة في كل مرة للشخص،\nوبحد أقصى ٢٠٬٠٠٠ صف. يعيد ملفاً، لذلك لا يُعرض على Claude.","x-access":"write","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"}]},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["xlsx","csv"]},"description":"File format: `xlsx` (Excel) or `csv`.","x-description-ar":"صيغة الملف: `xlsx` (إكسل) أو `csv`.","example":"xlsx"},{"name":"columns[]","in":"query","required":true,"schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true,"description":"Column keys, in file order, from the page's `…export_columns` operation.","x-description-ar":"مفاتيح الأعمدة بترتيبها في الملف، من عملية `…export_columns` للصفحة.","example":["employee_no","employee_name"]},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["draft","pending_accounting","declined","paid","cancelled"]},"description":"Only this status.","x-description-ar":"هذه الحالة فقط.","example":"paid"},{"name":"q[employee_employee_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Employee name contains.","x-description-ar":"اسم الموظف يحتوي على.","example":"Ahmed"}],"responses":{"200":{"description":"The file (`xlsx` or `csv`, as asked), named `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","x-description-ar":"الملف (`xlsx` أو `csv` حسب الطلب) باسم `QHR_\u003cpage\u003e_\u003ccompany\u003e_\u003cdate\u003e.\u003cformat\u003e`.","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Queued: the file is built in the background (more than 10,000 rows).","x-description-ar":"في الطابور: يُنشأ الملف في الخلفية (أكثر من ١٠٬٠٠٠ صف).","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"$ref":"#/components/schemas/data_export"}}},"example":{"export":{"id":318,"page":"payslips","format":"xlsx","status":"queued","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":null,"expires_at":"2026-12-04T07:58:40Z","download_url":null}}}}},"400":{"description":"The export request is malformed.","x-description-ar":"طلب التصدير غير صحيح.","x-codes":[{"code":"bad_format","meaning":"`format` is missing or is not `xlsx` or `csv`.","x-meaning-ar":"`format` ناقص أو ليس `xlsx` أو `csv`.","x-fix":"Send `format=xlsx` or `format=csv`.","x-fix-ar":"أرسل `format=xlsx` أو `format=csv`."},{"code":"no_columns","meaning":"No `columns[]` were sent.","x-meaning-ar":"لم تُرسل أي أعمدة `columns[]`.","x-fix":"Send at least one column key from the page's `…export_columns` operation.","x-fix-ar":"أرسل مفتاح عمود واحداً على الأقل من عملية `…export_columns` للصفحة."},{"code":"unknown_column","meaning":"A column key does not exist on this page, or your role may not see it.","x-meaning-ar":"مفتاح عمود غير موجود في هذه الصفحة، أو لا يحق لدورك رؤيته.","x-fix":"Use only keys returned by the page's `…export_columns` operation.","x-fix-ar":"استخدم فقط المفاتيح التي تعيدها عملية `…export_columns` للصفحة."},{"code":"bad_filters","meaning":"A filter value is malformed.","x-meaning-ar":"قيمة أحد المرشحات غير صحيحة.","x-fix":"Send the same filters the page's list operation accepts.","x-fix-ar":"أرسل المرشحات نفسها التي تقبلها عملية القائمة للصفحة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose Excel or CSV.","code":"bad_format","error_code":"bad_format"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"409":{"description":"An export of this page is already running.","x-description-ar":"تصدير لهذه الصفحة قيد التنفيذ.","x-codes":[{"code":"export_in_progress","meaning":"An export of this page by the same person is still being built. `export` is that run.","x-meaning-ar":"تصدير لهذه الصفحة من الشخص نفسه ما زال قيد الإنشاء. `export` هو ذلك التصدير.","x-fix":"Wait for it: poll `exports.show` with `export.id`, then `exports.download`.","x-fix-ar":"انتظره: تابع `exports.show` برقم `export.id` ثم `exports.download`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"An export of this page is already running.","code":"export_in_progress","error_code":"export_in_progress","export":{"id":318,"page":"payslips","format":"xlsx","status":"processing","total_records":42,"total_rows":42,"processed_rows":42,"filename":"QHR_Payslips_Acme_2026-11-27.xlsx","error_code":null,"created_at":"2026-11-27T07:58:10Z","snapshot_at":"2026-11-27T07:58:11Z","finished_at":"2026-11-27T07:58:40Z","expires_at":"2026-12-04T07:58:40Z","download_url":"/open/v1/exports/318/download"}}}}},"422":{"description":"Nothing to export, or too much.","x-description-ar":"لا شيء للتصدير، أو البيانات أكثر من الحد.","x-codes":[{"code":"no_data","meaning":"No record matches the filters, so there is nothing to export.","x-meaning-ar":"لا سجل يطابق المرشحات، فلا شيء للتصدير.","x-fix":"Loosen the filters.","x-fix-ar":"خفّف المرشحات."},{"code":"too_large","meaning":"The file would have more than 20,000 rows. `row_count` and `max_rows` say by how much.","x-meaning-ar":"سيتجاوز الملف ٢٠٬٠٠٠ صف. يوضح `row_count` و`max_rows` بكم.","x-fix":"Narrow the filters or the date range and export in parts.","x-fix-ar":"ضيّق المرشحات أو الفترة وصدّر على أجزاء."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"No data to export.","code":"no_data","error_code":"no_data"}}}}}}},"/termination_packages/export/columns":{"get":{"summary":"List the columns a termination packages export can have","operationId":"termination_packages.export_columns","tags":["End of service"],"description":"Returns the columns of the end-of-service export that your role may see, in screen order, with their header\nin the requested language and whether QHR ticks them by default.\n\n**When to use:** before `termination_packages.export`, to choose `columns[]`.\n\n**Prerequisites:** none. You need \"Export payroll data\" as well as \"Manage offboarding\".\n\n**Side effects:** none.","x-summary-ar":"عرض الأعمدة المتاحة لتصدير تسويات نهاية الخدمة","x-description-ar":"يعرض أعمدة تصدير تسويات نهاية الخدمة التي يحق لدورك رؤيتها بترتيب الشاشة، مع عنوان كل عمود بلغة الطلب وهل\nيحدده QHR افتراضياً.\n\n**متى تستخدمه:** قبل `termination_packages.export` لاختيار `columns[]`.\n\n**المتطلبات:** لا شيء. تحتاج «تصدير بيانات الرواتب» إضافة إلى «إدارة إنهاء الخدمة».\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"exports/payroll_data","label":"Export Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV","x-label-ar":"تصدير قسائم الرواتب ومسيرات الرواتب والسلف والخصومات والمكافآت والمدفوعات وحزم إنهاء الخدمة إلى Excel/CSV","x-also":[{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"}]},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The columns you may export from this page.","x-description-ar":"الأعمدة التي يحق لك تصديرها من هذه الصفحة.","content":{"application/json":{"example":{"columns":[{"key":"reference","label":"Reference","default":true,"type":"string"},{"key":"employee_no","label":"Employee ID","default":true,"type":"string"},{"key":"employee_name","label":"Employee","default":true,"type":"string"},{"key":"net_payout","label":"Net Payout","default":true,"type":"money"}]},"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Columns, in screen order.","x-description-ar":"الأعمدة بترتيب الشاشة.","items":{"type":"object","properties":{"key":{"type":"string","description":"Key to send in `columns[]`.","x-description-ar":"المفتاح الذي يُرسل في `columns[]`."},"label":{"type":"string","description":"Header in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in QHR.","x-description-ar":"محدد افتراضياً في QHR."},"type":{"type":"string","description":"`string`, `money`, `date`, `datetime`, `enum`…","x-description-ar":"`string` أو `money` أو `date` أو `datetime` أو `enum`…"}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/termination_packages/preview":{"get":{"summary":"Calculate end of service without saving","operationId":"termination_packages.preview","tags":["End of service"],"description":"Calculates what an employee would be owed if they left on `last_working_day` for `reason_id`, and saves\nnothing. The answer shows the length of service, the wage the award is based on (basic plus fixed\nallowances), the award under the Saudi labour law (half a month's wage per year for the first five years,\na full month after; resignations scaled by tenure), unused leave paid out, the final salary when\n`include_last_payroll` is true, pending bonuses, and what is taken off — loans, deductions and custody —\ndown to the net payout. `blockers` lists what would stop the package being saved (an active loan that\ncannot be settled, offsets larger than the award…).\n\n**When to use:** to answer \"how much end-of-service would Ahmed get if he resigned at the end of the year?\",\nor before `termination_packages.create`.\n\n**Prerequisites:** `employee_id` from `termination_packages.employee_options`, `reason_id` from\n`termination_reasons.list`. The employee needs a join date and an active salary.\n\n**Side effects:** none — no package, no status change, no leave cancelled.","x-summary-ar":"حساب مكافأة نهاية الخدمة دون حفظ","x-description-ar":"يحسب ما يستحقه الموظف لو غادر في `last_working_day` للسبب `reason_id`، دون حفظ أي شيء. يعرض الناتج مدة\nالخدمة، والأجر الذي تُحسب عليه المكافأة (الأساسي والبدلات الثابتة)، والمكافأة وفق نظام العمل السعودي (أجر\nنصف شهر عن كل سنة من السنوات الخمس الأولى وأجر شهر عمّا بعدها، والاستقالة متدرجة حسب المدة)، وبدل الإجازات\nغير المستخدمة، والراتب الأخير عند `include_last_payroll`، والمكافآت المعلّقة، والخصومات — السلف والاستقطاعات\nوالعهد — حتى صافي الصرف. ويذكر `blockers` ما يمنع حفظ التسوية (سلفة نشطة لا يمكن تسويتها، خصومات تتجاوز\nالمكافأة…).\n\n**متى تستخدمه:** للإجابة عن «كم مكافأة نهاية الخدمة لأحمد لو استقال نهاية السنة؟» أو قبل\n`termination_packages.create`.\n\n**المتطلبات:** `employee_id` من `termination_packages.employee_options` و`reason_id` من\n`termination_reasons.list`. يحتاج الموظف تاريخ التحاق وراتباً نشطاً.\n\n**الآثار الجانبية:** لا شيء — لا تُنشأ تسوية ولا تتغير حالة ولا تُلغى إجازة.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"employee_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The leaving employee, from `termination_packages.employee_options`.","x-description-ar":"الموظف المغادر، من `termination_packages.employee_options`.","example":1203},{"name":"reason_id","in":"query","required":true,"schema":{"type":"integer"},"description":"Reason, from `termination_reasons.list`.","x-description-ar":"السبب، من `termination_reasons.list`.","example":9},{"name":"last_working_day","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last working day.","x-description-ar":"آخر يوم عمل.","example":"2026-12-31"},{"name":"include_last_payroll","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` pays the final partial month in the package instead of through payroll.","x-description-ar":"`true` يصرف الشهر الأخير ضمن التسوية بدلاً من المسيّر.","example":false}],"responses":{"200":{"description":"The calculation.","x-description-ar":"نتيجة الحساب.","content":{"application/json":{"example":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"blockers":[]},"schema":{"type":"object","properties":{"employee":{"type":"object","description":"The employee.","x-description-ar":"الموظف."},"contract":{"type":"object","description":"Contract type.","x-description-ar":"نوع العقد."},"reason":{"$ref":"#/components/schemas/termination_reason"},"service":{"type":"object","description":"Tenure: `join_date`, `years`, `months`, `days`, and a hint when close to the next award tier.","x-description-ar":"مدة الخدمة: `join_date` و`years` و`months` و`days`، وتنبيه عند الاقتراب من شريحة أعلى."},"wage_base":{"type":"object","description":"The monthly wage the award uses and the daily wage.","x-description-ar":"الأجر الشهري الذي تُحسب عليه المكافأة والأجر اليومي."},"gratuity":{"type":"object","description":"The award: `amount` and `tier`.","x-description-ar":"المكافأة: `amount` و`tier`."},"leave_encashment":{"type":"object","description":"Unused leave paid out: `days`, `amount`, and policies left out with why.","x-description-ar":"بدل الإجازات غير المستخدمة: `days` و`amount` والسياسات المستبعدة مع السبب."},"affected_leave_requests":{"type":"array","description":"Approved leave after the last day, cancelled on confirm.","x-description-ar":"إجازات معتمدة بعد آخر يوم، تُلغى عند الاعتماد.","items":{"type":"object"}},"final_salary":{"type":"object","description":"The final partial month, when paid in the package.","x-description-ar":"الشهر الأخير عند صرفه ضمن التسوية."},"bonuses":{"type":"array","description":"Pending bonuses added.","x-description-ar":"مكافآت معلّقة مضافة.","items":{"type":"object"}},"deductions":{"type":"array","description":"Pending deductions taken off.","x-description-ar":"استقطاعات معلّقة مخصومة.","items":{"type":"object"}},"loans":{"type":"array","description":"Outstanding loans settled from the package.","x-description-ar":"سلف قائمة تُسوّى من التسوية.","items":{"type":"object"}},"custody":{"type":"array","description":"Custody deducted.","x-description-ar":"عهد مخصومة.","items":{"type":"object"}},"held_custody":{"type":"array","description":"Assets still held.","x-description-ar":"أصول ما زالت لدى الموظف.","items":{"type":"object"}},"totals":{"type":"object","description":"`compensation`, `offsets` and `net_payout`.","x-description-ar":"`compensation` و`offsets` و`net_payout`."},"accounting":{"type":"object","description":"Whether an accountant must approve.","x-description-ar":"هل يلزم اعتماد محاسب."},"blockers":{"type":"array","description":"What would stop saving (`code`, `message`).","x-description-ar":"ما يمنع الحفظ (`code` و`message`).","items":{"type":"object"}}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"End of service cannot be calculated.","x-description-ar":"لا يمكن حساب نهاية الخدمة.","x-codes":[{"code":"no_active_salary","meaning":"The employee has no active salary, so there is no wage to calculate from.","x-meaning-ar":"ليس للموظف راتب نشط، فلا يوجد أجر يُحسب عليه.","x-fix":"Give the employee an active salary (`salaries.create`).","x-fix-ar":"أضف للموظف راتباً نشطاً (`salaries.create`)."},{"code":"no_join_date","meaning":"The employee has no join date, so the length of service is unknown.","x-meaning-ar":"ليس للموظف تاريخ التحاق، فمدة الخدمة غير معروفة.","x-fix":"Set the join date with `employees.update` (`employment_detail.join_date`).","x-fix-ar":"عيّن تاريخ الالتحاق عبر `employees.update` (`employment_detail.join_date`)."},{"code":"unknown_reason","meaning":"`reason_id` is not one of the ministry's reasons.","x-meaning-ar":"`reason_id` ليس من أسباب الوزارة.","x-fix":"Pick an id from `termination_reasons.list`.","x-fix-ar":"اختر رقماً من `termination_reasons.list`."},{"code":"last_working_day_required","meaning":"`last_working_day` is missing or not a date.","x-meaning-ar":"`last_working_day` ناقص أو ليس تاريخاً.","x-fix":"Send the last working day as `YYYY-MM-DD`.","x-fix-ar":"أرسل آخر يوم عمل بالشكل `YYYY-MM-DD`."},{"code":"last_working_day_before_join_date","meaning":"The last working day is before the employee joined.","x-meaning-ar":"آخر يوم عمل يسبق تاريخ التحاق الموظف.","x-fix":"Correct the last working day, or the join date.","x-fix-ar":"صحّح آخر يوم عمل أو تاريخ الالتحاق."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This employee has no active salary, so end-of-service cannot be calculated.","code":"no_active_salary","error_code":"no_active_salary"}}}}}}},"/termination_packages/stat_cards":{"get":{"summary":"Count termination packages and their money by status","operationId":"termination_packages.stat_cards","tags":["End of service"],"description":"Returns how many packages are in each status (draft, with accounting, declined, paid, cancelled) and the net\npayout per status in each currency. Without date filters it covers packages created this month (in the\ncompany's time zone); `filters` echoes what was applied.\n\n**When to use:** for \"how much end-of-service did we pay this month?\" or a dashboard. Takes the same `q[…]`\nfilters as `termination_packages.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"إحصاء تسويات نهاية الخدمة ومبالغها حسب الحالة","x-description-ar":"يعرض عدد التسويات في كل حالة (مسودة، لدى المحاسبة، مرفوضة، مصروفة، ملغاة) وصافي الصرف لكل حالة بكل عملة.\nبدون مرشّحات تاريخ يغطي التسويات المنشأة هذا الشهر (بتوقيت الشركة)، ويعيد `filters` ما طُبّق.\n\n**متى تستخدمه:** لسؤال «كم صرفنا مكافآت نهاية خدمة هذا الشهر؟» أو للوحة مؤشرات. يقبل مرشّحات `q[…]`\nنفسها في `termination_packages.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[created_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Created on or after; start of this month when omitted.","x-description-ar":"أُنشئت في هذا التاريخ أو بعده؛ بداية الشهر الحالي إن لم يُرسل.","example":"2026-11-01"},{"name":"q[created_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Created on or before; end of this month when omitted.","x-description-ar":"أُنشئت في هذا التاريخ أو قبله؛ نهاية الشهر الحالي إن لم يُرسل.","example":"2026-11-30"}],"responses":{"200":{"description":"The counts and amounts.","x-description-ar":"الأعداد والمبالغ.","content":{"application/json":{"example":{"counts":{"total":3,"draft":1,"pending_accounting":0,"declined":0,"paid":2,"cancelled":0},"amounts":{"SAR":{"total":"98400.00","draft":"37888.89","pending_accounting":"0.00","declined":"0.00","paid":"60511.11","cancelled":"0.00"}},"filters":{"submitted_from":"2026-11-01","submitted_to":"2026-11-30","status":"all","employee_name":null,"employee_no":null}},"schema":{"type":"object","properties":{"counts":{"type":"object","description":"`total` and one count per status.","x-description-ar":"`total` وعدد لكل حالة."},"amounts":{"type":"object","description":"Per currency: `total` and the net payout per status, decimal strings.","x-description-ar":"لكل عملة: `total` وصافي الصرف لكل حالة، نصوص عشرية."},"filters":{"type":"object","description":"The filters applied: `submitted_from`, `submitted_to`, `status`, `employee_name`, `employee_no`.","x-description-ar":"المرشّحات المطبّقة: `submitted_from` و`submitted_to` و`status` و`employee_name` و`employee_no`."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/termination_packages/{id}":{"get":{"summary":"Get a termination package with its calculation","operationId":"termination_packages.show","tags":["End of service"],"description":"Returns one package in full: the frozen calculation (`breakdown`), the totals, any override HR entered and why,\nthe custody involved, the payout once recorded, and what confirmation did (`effects`). `stale` and\n`blockers` say whether it can be confirmed as is, and `actions` what may be done next.\n\n**When to use:** to explain how a payout was reached (\"why is Ahmed getting two thirds?\"), or before\n`termination_packages.confirm`.\n\n**Prerequisites:** the package `id` from `termination_packages.list`.\n\n**Side effects:** none. A draft's figures are compared with today's data to report staleness; nothing is saved.","x-summary-ar":"عرض تسوية نهاية خدمة مع تفاصيل حسابها","x-description-ar":"يعرض تسوية واحدة كاملة: الحساب المجمّد (`breakdown`) والإجماليات وأي تعديل يدوي أدخلته الموارد البشرية وسببه،\nوالعهد المعنية، والصرف بعد تسجيله، وما ترتب على الاعتماد (`effects`). يوضح `stale` و`blockers` هل يمكن\nاعتمادها كما هي، و`actions` ما يمكن فعله بعدها.\n\n**متى تستخدمه:** لشرح كيف حُسب المبلغ («لماذا يحصل أحمد على الثلثين؟») أو قبل `termination_packages.confirm`.\n\n**المتطلبات:** رقم `id` التسوية من `termination_packages.list`.\n\n**الآثار الجانبية:** لا شيء. تُقارن أرقام المسودة ببيانات اليوم للإبلاغ عن تقادمها دون حفظ أي شيء.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"200":{"description":"The package.","x-description-ar":"التسوية.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"draft","include_last_payroll":false,"status_label_en":"Draft","status_label_ar":"مسودة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":null,"approved_at":null,"paid_at":null,"cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":null,"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":null,"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":true,"can_recalculate":true,"can_confirm":true,"can_cancel":true}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a draft end-of-service package","operationId":"termination_packages.update","tags":["End of service"],"description":"Changes the reason, dates, `include_last_payroll` or the overridden total of a `draft` or `declined` package,\nand recalculates it against today's data. Fields you leave out keep their value; an earlier override is kept\nunless you send a new `compensation_total`.\n\n**When to use:** to correct a package before confirming it, or after accounting declined it.\n\n**Prerequisites:** the package `id` from `termination_packages.list`. The token's owner must be an employee.\n\n**Side effects:** the frozen calculation is replaced; recorded in the audit log. Not offered to Claude,\nbecause it changes what a leaving employee is paid.","x-summary-ar":"تعديل مسودة تسوية نهاية خدمة","x-description-ar":"يغيّر السبب أو التواريخ أو `include_last_payroll` أو الإجمالي المعدّل يدوياً لتسوية بحالة `draft` أو\n`declined`، ويعيد حسابها على بيانات اليوم. الحقول غير المرسلة تحتفظ بقيمتها، ويبقى التعديل اليدوي السابق ما لم\nترسل `compensation_total` جديداً.\n\n**متى تستخدمه:** لتصحيح التسوية قبل اعتمادها، أو بعد رفض المحاسبة لها.\n\n**المتطلبات:** رقم `id` التسوية من `termination_packages.list`. يجب أن يكون صاحب الرمز موظفاً.\n\n**الآثار الجانبية:** يُستبدل الحساب المجمّد ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف\nللموظف المغادر.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"200":{"description":"The package after the change.","x-description-ar":"التسوية بعد التعديل.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"draft","include_last_payroll":false,"status_label_en":"Draft","status_label_ar":"مسودة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-10","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":null,"approved_at":null,"paid_at":null,"cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":null,"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":null,"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":true,"can_recalculate":true,"can_confirm":true,"can_cancel":true}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"package_not_editable","meaning":"Only a `draft` or `declined` package can change.","x-meaning-ar":"لا تتغير إلا التسوية بحالة `draft` أو `declined`.","x-fix":"Cancel it and create a new one, if it is not paid.","x-fix-ar":"ألغها وأنشئ غيرها إن لم تُصرف."},{"code":"employee_not_active","meaning":"The employee is no longer active (already serving notice or gone).","x-meaning-ar":"الموظف لم يعد نشطاً (في فترة الإشعار أو غادر).","x-fix":"Nothing to do here; a package is only for an active employee.","x-fix-ar":"لا إجراء هنا؛ التسوية للموظف النشط فقط."},{"code":"payment_date_required","meaning":"`payment_date` is missing or not a date.","x-meaning-ar":"`payment_date` ناقص أو ليس تاريخاً.","x-fix":"Send the pay date as `YYYY-MM-DD`.","x-fix-ar":"أرسل تاريخ الصرف بالشكل `YYYY-MM-DD`."},{"code":"payment_date_in_past","meaning":"The payment date is before today (company time zone).","x-meaning-ar":"تاريخ الصرف قبل اليوم (بتوقيت الشركة).","x-fix":"Use today or a later date.","x-fix-ar":"استخدم اليوم أو تاريخاً لاحقاً."},{"code":"payment_date_before_last_working_day","meaning":"The payment date is before the last working day.","x-meaning-ar":"تاريخ الصرف قبل آخر يوم عمل.","x-fix":"Pay on or after the last working day.","x-fix-ar":"اجعل الصرف في آخر يوم عمل أو بعده."},{"code":"override_reason_required","meaning":"`compensation_total` differs from the calculated total and no `override_reason` was sent.","x-meaning-ar":"`compensation_total` يختلف عن الإجمالي المحسوب ولم يُرسل `override_reason`.","x-fix":"Explain the difference in `override_reason`, or drop `compensation_total`.","x-fix-ar":"اشرح الفرق في `override_reason`، أو احذف `compensation_total`."},{"code":"override_reason_too_short","meaning":"`override_reason` is shorter than 20 characters.","x-meaning-ar":"`override_reason` أقصر من ٢٠ حرفاً.","x-fix":"Write a real explanation, 20 characters at least.","x-fix-ar":"اكتب سبباً واضحاً لا يقل عن ٢٠ حرفاً."},{"code":"compensation_total_negative","meaning":"`compensation_total` is negative.","x-meaning-ar":"`compensation_total` سالب.","x-fix":"Send zero or more.","x-fix-ar":"أرسل صفراً أو أكثر."},{"code":"offsets_exceed_compensation","meaning":"Loans, deductions and custody owed exceed what the employee is owed; the message gives the shortfall.","x-meaning-ar":"السلف والاستقطاعات والعهد المستحقة على الموظف تتجاوز مستحقاته؛ تذكر الرسالة مقدار العجز.","x-fix":"Settle part of the loans or custody first, or raise the total.","x-fix-ar":"سدّد جزءاً من السلف أو العهد أولاً، أو ارفع الإجمالي."},{"code":"loan_not_settleable","meaning":"One of the employee's loans cannot be settled from the package; `reference` names it.","x-meaning-ar":"إحدى سلف الموظف لا يمكن تسويتها من التسوية؛ يذكرها `reference`.","x-fix":"Resolve that loan first (`hr_loans.show`).","x-fix-ar":"عالج تلك السلفة أولاً (`hr_loans.show`)."},{"code":"custody_installment_in_flight","meaning":"A custody installment is on a payroll run that is not finished; `reference` names it.","x-meaning-ar":"قسط عهدة على مسيّر رواتب لم يكتمل؛ يذكره `reference`.","x-fix":"Finish or revert that payroll run first.","x-fix-ar":"أكمل ذلك المسيّر أو أرجعه أولاً."},{"code":"payable_not_positive","meaning":"With accounting approval on, what remains after deductions and custody would be zero or less, which Qoyod refuses.","x-meaning-ar":"مع تفعيل اعتماد المحاسبة، يكون المتبقي بعد الاستقطاعات والعهد صفراً أو أقل، وهذا ترفضه قيود.","x-fix":"Override the total with a reason, or settle the custody first.","x-fix-ar":"عدّل الإجمالي يدوياً مع ذكر السبب، أو سدّد العهدة أولاً."},{"code":"no_active_salary","meaning":"The employee has no active salary, so there is no wage to calculate from.","x-meaning-ar":"ليس للموظف راتب نشط، فلا يوجد أجر يُحسب عليه.","x-fix":"Give the employee an active salary (`salaries.create`).","x-fix-ar":"أضف للموظف راتباً نشطاً (`salaries.create`)."},{"code":"no_join_date","meaning":"The employee has no join date, so the length of service is unknown.","x-meaning-ar":"ليس للموظف تاريخ التحاق، فمدة الخدمة غير معروفة.","x-fix":"Set the join date with `employees.update` (`employment_detail.join_date`).","x-fix-ar":"عيّن تاريخ الالتحاق عبر `employees.update` (`employment_detail.join_date`)."},{"code":"unknown_reason","meaning":"`reason_id` is not one of the ministry's reasons.","x-meaning-ar":"`reason_id` ليس من أسباب الوزارة.","x-fix":"Pick an id from `termination_reasons.list`.","x-fix-ar":"اختر رقماً من `termination_reasons.list`."},{"code":"last_working_day_required","meaning":"`last_working_day` is missing or not a date.","x-meaning-ar":"`last_working_day` ناقص أو ليس تاريخاً.","x-fix":"Send the last working day as `YYYY-MM-DD`.","x-fix-ar":"أرسل آخر يوم عمل بالشكل `YYYY-MM-DD`."},{"code":"last_working_day_before_join_date","meaning":"The last working day is before the employee joined.","x-meaning-ar":"آخر يوم عمل يسبق تاريخ التحاق الموظف.","x-fix":"Correct the last working day, or the join date.","x-fix-ar":"صحّح آخر يوم عمل أو تاريخ الالتحاق."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، وكل تغيير على التسوية يُسجَّل باسم الموظف الذي أجراه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This package can no longer be edited.","code":"package_not_editable","error_code":"package_not_editable"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_id":{"type":"integer","description":"Reason, from `termination_reasons.list`.","x-description-ar":"السبب، من `termination_reasons.list`."},"last_working_day":{"type":"string","description":"Last working day.","x-description-ar":"آخر يوم عمل.","format":"date"},"payment_date":{"type":"string","description":"Pay date.","x-description-ar":"تاريخ الصرف.","format":"date"},"include_last_payroll":{"type":"boolean","description":"Pay the final partial month in the package.","x-description-ar":"صرف الشهر الأخير ضمن التسوية."},"compensation_total":{"type":"string","description":"Total to pay instead of the calculated one.","x-description-ar":"إجمالي يُصرف بدلاً من المحسوب."},"override_reason":{"type":"string","description":"Why the total differs, 20 characters at least.","x-description-ar":"سبب اختلاف الإجمالي، ٢٠ حرفاً على الأقل."}}},"example":{"payment_date":"2027-01-10"}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Cancel an end-of-service package","operationId":"termination_packages.cancel","tags":["End of service"],"description":"Cancels a package that is not paid yet. A draft simply becomes `cancelled`. A package waiting for accounting\nis withdrawn: the loans it was settling go back to `approved`, its custody claims are released and the\naccounting events not yet posted are discarded. The record stays, with status `cancelled`.\n\n**When to use:** when the employee is no longer leaving, or to start over with a new package.\n\n**Prerequisites:** the package `id` from `termination_packages.list`. The token's owner must be an employee.\nA `paid` package cannot be cancelled.\n\n**Side effects:** as above; `loan_settlements` lists the loans released. Recorded in the audit log. Not\noffered to Claude.","x-summary-ar":"إلغاء تسوية نهاية خدمة","x-description-ar":"يلغي تسوية لم تُصرف بعد. المسودة تصبح `cancelled` فحسب. أما التسوية المنتظرة لدى المحاسبة فتُسحب: تعود السلف\nالتي كانت تسويها إلى `approved`، وتُحرَّر العهد المحجوزة لها، وتُستبعد أحداث المحاسبة غير المرحّلة. يبقى السجل\nبحالة `cancelled`.\n\n**متى تستخدمه:** عندما يعدل الموظف عن المغادرة، أو للبدء بتسوية جديدة.\n\n**المتطلبات:** رقم `id` التسوية من `termination_packages.list`. يجب أن يكون صاحب الرمز موظفاً. لا يمكن إلغاء\nتسوية بحالة `paid`.\n\n**الآثار الجانبية:** ما سبق، ويذكر `loan_settlements` السلف المحرَّرة. يُسجَّل في سجل التدقيق. لا يُعرض على\nClaude.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"200":{"description":"The cancelled package and the loans released.","x-description-ar":"التسوية الملغاة والسلف المحرَّرة.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"cancelled","include_last_payroll":false,"status_label_en":"Cancelled","status_label_ar":"ملغاة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":null,"approved_at":null,"paid_at":null,"cancelled_at":"2026-11-28T10:00:00Z","created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":null,"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":null,"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":false,"can_recalculate":false,"can_confirm":false,"can_cancel":false}},"loan_settlements":[]},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"},"loan_settlements":{"type":"array","description":"Loans returned to `approved`: `loan_id`, `reference`, `status`.","x-description-ar":"السلف المعادة إلى `approved`: `loan_id` و`reference` و`status`.","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The package cannot be cancelled.","x-description-ar":"لا يمكن إلغاء التسوية.","x-codes":[{"code":"package_already_settled","meaning":"The package is approved and paid; the body names its payment and settled loans.","x-meaning-ar":"التسوية معتمدة ومصروفة؛ يذكر الجسم دفعتها والسلف المسوّاة.","x-fix":"Reverse it in accounting; it cannot be undone in QHR.","x-fix-ar":"اعكسها في المحاسبة؛ لا يمكن التراجع عنها في QHR."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، وكل تغيير على التسوية يُسجَّل باسم الموظف الذي أجراه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This package has already been approved and paid. It can no longer be cancelled.","code":"package_already_settled","error_code":"package_already_settled","status":"paid"}}}}}}},"/termination_packages/{id}/accounting_sync":{"post":{"summary":"Re-send an end-of-service package to accounting","operationId":"termination_packages.resync","tags":["End of service"],"description":"Sends a confirmed package to Qoyod accounting again when it never arrived, delivery failed, or Qoyod refused the\ndata: a missing event is emitted fresh, and a failed one is meant to be retried with the same id. Answers 202\nwith the row as `termination_packages.accounting_sync` shows it. Known issue: re-sending a package whose\nevent *failed* currently answers an error instead of retrying; a package that never reached accounting\nre-sends normally.\n\n**When to use:** when the sync list shows the package with `can_sync: true`.\n\n**Prerequisites:** the package `id` from `termination_packages.accounting_sync` (`package_id`). Besides\n\"Manage offboarding\", re-sending needs the accounting \"Manage\" permission (403 `forbidden` without it).\n\n**Side effects:** queues delivery to Qoyod. Not offered to Claude, because it is integration recovery that posts\nto the company's books.","x-summary-ar":"إعادة إرسال تسوية نهاية خدمة إلى المحاسبة","x-description-ar":"يرسل تسوية معتمدة إلى محاسبة قيود مرة أخرى إذا لم تصل أو فشل تسليمها أو رفضت قيود البيانات: يُعاد الحدث الفاشل\nبالرقم نفسه (هذا هو المقصود)، ويُنشأ الحدث المفقود من جديد. يُرجع 202 مع الصف كما يظهر في\n`termination_packages.accounting_sync`. مشكلة معروفة: إعادة إرسال تسوية *فشل* حدثها تُرجع حالياً خطأً بدلاً\nمن إعادة المحاولة، أما التسوية التي لم تصل إلى المحاسبة قط فيُعاد إرسالها بشكل طبيعي.\n\n**متى تستخدمه:** عندما تظهر التسوية في قائمة المزامنة مع `can_sync: true`.\n\n**المتطلبات:** رقم التسوية من `termination_packages.accounting_sync` (`package_id`). يحتاج الإرسال إضافة إلى\n«إدارة إنهاء الخدمة» صلاحية «الإدارة» في المحاسبة (وبدونها 403 `forbidden`).\n\n**الآثار الجانبية:** يضع التسليم إلى قيود في الطابور. لا يُعرض على Claude لأنه استعادة تكامل تُرحّل إلى دفاتر\nالشركة.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"202":{"description":"Queued for delivery.","x-description-ar":"وُضع في طابور التسليم.","content":{"application/json":{"example":{"record":{"package_id":41,"reference":"EOS-0041","employee_id":1203,"employee_no":"EMP-0142","employee_name":"Ahmed Al-Otaibi","status":"paid","amount":"37888.89","currency":"SAR","last_working_day":"2026-12-31","confirmed_at":"2026-11-27T09:00:00Z","sync_state":"syncing","can_sync":false,"events":[]},"queued":1},"schema":{"type":"object","properties":{"record":{"type":"object","description":"The package's sync row, as in `termination_packages.accounting_sync`.","x-description-ar":"صف مزامنة التسوية كما في `termination_packages.accounting_sync`."},"queued":{"type":"integer","description":"Events queued.","x-description-ar":"عدد الأحداث في الطابور."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"409":{"description":"There is nothing to send.","x-description-ar":"لا يوجد ما يُرسل.","x-codes":[{"code":"nothing_to_sync","meaning":"The package is already posted, on its way, or waiting for an accountant; `error` says which.","x-meaning-ar":"التسوية مرحّلة أو في طريقها أو بانتظار محاسب؛ يوضح `error` أيها.","x-fix":"Nothing to do; check the state with `termination_packages.accounting_sync`.","x-fix-ar":"لا حاجة لأي إجراء؛ راجع الحالة عبر `termination_packages.accounting_sync`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"There is nothing to send for this package — it is already posted.","code":"nothing_to_sync","error_code":"nothing_to_sync"}}}},"422":{"description":"The package cannot be sent.","x-description-ar":"لا يمكن إرسال التسوية.","x-codes":[{"code":"not_confirmed","meaning":"The package is not confirmed yet, so nothing was sent to accounting.","x-meaning-ar":"التسوية لم تُعتمد بعد، فلم يُرسل شيء إلى المحاسبة.","x-fix":"Confirm it with `termination_packages.confirm`.","x-fix-ar":"اعتمدها عبر `termination_packages.confirm`."},{"code":"not_connected","meaning":"The company is not connected to Qoyod accounting.","x-meaning-ar":"الشركة غير مرتبطة بمحاسبة قيود.","x-fix":"Connect accounting in QHR first.","x-fix-ar":"اربط المحاسبة في QHR أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This package has not been confirmed yet, so there is nothing to send to accounting.","code":"not_confirmed","error_code":"not_confirmed"}}}}}}},"/termination_packages/{id}/confirm":{"post":{"summary":"Confirm an end-of-service package","operationId":"termination_packages.confirm","tags":["End of service"],"description":"Makes the package real. In a company **not** using accounting approval it completes at once (200, status\n`paid`): the employee's loans are settled from it, deducting custody is settled and held assets are handed\nto the confirming employee, an offboarding record is created and the employee moves to `notice_period`\n(inactive after the last working day), approved leave after the last day is cancelled, pending bonuses and\ndeductions are claimed so payroll never pays them twice, and the payout is recorded as a payment.\n\nIn a company connected to Qoyod with approval on, it is **submitted** instead (202, status\n`pending_accounting`): the events go to the accountant, and all of the above happens only when every\ndecision comes back approved. A decline returns it to `declined`, with the employee untouched.\n\n**When to use:** once the package is final. It cannot be confirmed while `stale` or with `blockers`; when the\nemployee still holds company assets send `acknowledge_held_custody: true`.\n\n**Prerequisites:** the package `id` from `termination_packages.list`; check `actions.can_confirm` with\n`termination_packages.show`. The token's owner must be an employee (recorded as the confirmer).\n\n**Side effects:** ends the employment and moves money, as above; `effects` lists what was done. Recorded in the\naudit log and sent to accounting when connected. Irreversible once paid, so not offered to Claude.","x-summary-ar":"اعتماد تسوية نهاية خدمة","x-description-ar":"يجعل التسوية نافذة. في الشركة التي **لا** تستخدم اعتماد المحاسبة تكتمل فوراً (200، الحالة `paid`): تُسوّى\nسلف الموظف منها، وتُسوّى العهد المخصومة وتُسلَّم الأصول التي لديه للموظف المعتمِد، ويُنشأ سجل إنهاء خدمة وينتقل\nالموظف إلى `notice_period` (ثم غير نشط بعد آخر يوم عمل)، وتُلغى الإجازات المعتمدة بعد آخر يوم، وتُحتسب\nالمكافآت والاستقطاعات المعلّقة فلا يصرفها المسيّر مرتين، ويُسجَّل الصرف دفعةً.\n\nأما في الشركة المرتبطة بقيود مع تفعيل الاعتماد فتُ**رسل** بدلاً من ذلك (202، الحالة `pending_accounting`):\nتذهب الأحداث إلى المحاسب، ولا يحدث كل ما سبق إلا عند ورود موافقة على كل القرارات. والرفض يعيدها إلى `declined`\nدون أي أثر على الموظف.\n\n**متى تستخدمه:** عندما تصبح التسوية نهائية. لا يمكن اعتمادها وهي متقادمة `stale` أو عليها `blockers`؛ وإذا كان\nلدى الموظف أصول للشركة فأرسل `acknowledge_held_custody: true`.\n\n**المتطلبات:** رقم `id` التسوية من `termination_packages.list`؛ وتحقق من `actions.can_confirm` عبر\n`termination_packages.show`. يجب أن يكون صاحب الرمز موظفاً (يُسجَّل معتمِداً).\n\n**الآثار الجانبية:** تنهي علاقة العمل وتحرّك أموالاً كما سبق، ويذكر `effects` ما تم. تُسجَّل في سجل التدقيق\nوتُرسل إلى المحاسبة عند الربط. لا يمكن التراجع عنها بعد الصرف، لذلك لا تُعرض على Claude.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"200":{"description":"Completed: the package is paid.","x-description-ar":"اكتملت: التسوية مصروفة.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"paid","include_last_payroll":false,"status_label_en":"Paid","status_label_ar":"مصروفة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":"paid","payment":{"id":910,"reference":"EPY-0910","kind":"paid","purpose":"termination_package","date":"2027-01-05","amount":"37888.89"},"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":"2026-11-28T10:00:00Z","approved_at":"2026-11-28T10:00:00Z","paid_at":"2026-11-28T10:00:00Z","cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":{"id":88,"name":"Faisal Al-Qahtani"},"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":{"employment_status":"notice_period","offboarding_log_id":77,"leave_requests_cancelled":[],"loans_settled":[],"bonuses_claimed":[],"deductions_claimed":[],"custody_settled":[],"custody_transferred":[],"removed_from_payroll_roster":false,"payment_created":"EPY-0910"},"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":false,"can_recalculate":false,"can_confirm":false,"can_cancel":false}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"202":{"description":"Submitted to accounting for approval.","x-description-ar":"أُرسلت إلى المحاسبة للموافقة.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"pending_accounting","include_last_payroll":false,"status_label_en":"With accounting","status_label_ar":"لدى المحاسبة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":"2026-11-28T10:00:00Z","approved_at":null,"paid_at":null,"cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":{"id":88,"name":"Faisal Al-Qahtani"},"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":1,"loan_settlements":[],"effects":null,"accounting":{"mode":"approval","gate":"termination_package"},"actions":{"can_edit":false,"can_recalculate":false,"can_confirm":false,"can_cancel":true}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The package cannot be confirmed.","x-description-ar":"لا يمكن اعتماد التسوية.","x-codes":[{"code":"package_not_confirmable","meaning":"The package is not a `draft` or `declined` one (already confirmed, paid or cancelled).","x-meaning-ar":"التسوية ليست بحالة `draft` أو `declined` (معتمدة أو مصروفة أو ملغاة مسبقاً).","x-fix":"Read its status with `termination_packages.show`.","x-fix-ar":"اقرأ حالتها عبر `termination_packages.show`."},{"code":"package_stale","meaning":"The employee's data changed since the calculation; `stale_reasons` says what.","x-meaning-ar":"تغيرت بيانات الموظف بعد الحساب؛ يوضح `stale_reasons` ما تغير.","x-fix":"Run `termination_packages.recalculate`, then confirm.","x-fix-ar":"شغّل `termination_packages.recalculate` ثم اعتمد."},{"code":"held_custody_unacknowledged","meaning":"The employee still holds company assets (`held_custody`) and they were not acknowledged.","x-meaning-ar":"ما زالت لدى الموظف أصول للشركة (`held_custody`) ولم يُقَرّ بها.","x-fix":"Send `acknowledge_held_custody: true`.","x-fix-ar":"أرسل `acknowledge_held_custody: true`."},{"code":"held_custody_self_transfer","meaning":"The confirming employee is the leaving employee, so held assets would be handed to themselves.","x-meaning-ar":"المعتمِد هو الموظف المغادر نفسه، فتُسلَّم الأصول إليه.","x-fix":"Have another HR employee confirm.","x-fix-ar":"اطلب من موظف موارد بشرية آخر الاعتماد."},{"code":"custody_unclaimed_deducting","meaning":"A deducting custody of the employee is not covered by the package.","x-meaning-ar":"عهدة مستقطعة للموظف لا تغطيها التسوية.","x-fix":"Recalculate the package so it includes the custody.","x-fix-ar":"أعد حساب التسوية لتشمل العهدة."},{"code":"employee_not_active","meaning":"The employee is no longer active (already serving notice or gone).","x-meaning-ar":"الموظف لم يعد نشطاً (في فترة الإشعار أو غادر).","x-fix":"Nothing to do here; a package is only for an active employee.","x-fix-ar":"لا إجراء هنا؛ التسوية للموظف النشط فقط."},{"code":"loan_not_settleable","meaning":"One of the employee's loans cannot be settled from the package; `reference` names it.","x-meaning-ar":"إحدى سلف الموظف لا يمكن تسويتها من التسوية؛ يذكرها `reference`.","x-fix":"Resolve that loan first (`hr_loans.show`).","x-fix-ar":"عالج تلك السلفة أولاً (`hr_loans.show`)."},{"code":"custody_installment_in_flight","meaning":"A custody installment is on a payroll run that is not finished; `reference` names it.","x-meaning-ar":"قسط عهدة على مسيّر رواتب لم يكتمل؛ يذكره `reference`.","x-fix":"Finish or revert that payroll run first.","x-fix-ar":"أكمل ذلك المسيّر أو أرجعه أولاً."},{"code":"offsets_exceed_compensation","meaning":"Loans, deductions and custody owed exceed what the employee is owed; the message gives the shortfall.","x-meaning-ar":"السلف والاستقطاعات والعهد المستحقة على الموظف تتجاوز مستحقاته؛ تذكر الرسالة مقدار العجز.","x-fix":"Settle part of the loans or custody first, or raise the total.","x-fix-ar":"سدّد جزءاً من السلف أو العهد أولاً، أو ارفع الإجمالي."},{"code":"payable_not_positive","meaning":"With accounting approval on, what remains after deductions and custody would be zero or less, which Qoyod refuses.","x-meaning-ar":"مع تفعيل اعتماد المحاسبة، يكون المتبقي بعد الاستقطاعات والعهد صفراً أو أقل، وهذا ترفضه قيود.","x-fix":"Override the total with a reason, or settle the custody first.","x-fix-ar":"عدّل الإجمالي يدوياً مع ذكر السبب، أو سدّد العهدة أولاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، وكل تغيير على التسوية يُسجَّل باسم الموظف الذي أجراه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."},{"code":"no_active_salary","meaning":"The employee has no active salary, so there is no wage to calculate from.","x-meaning-ar":"ليس للموظف راتب نشط، فلا يوجد أجر يُحسب عليه.","x-fix":"Give the employee an active salary (`salaries.create`).","x-fix-ar":"أضف للموظف راتباً نشطاً (`salaries.create`)."},{"code":"no_join_date","meaning":"The employee has no join date, so the length of service is unknown.","x-meaning-ar":"ليس للموظف تاريخ التحاق، فمدة الخدمة غير معروفة.","x-fix":"Set the join date with `employees.update` (`employment_detail.join_date`).","x-fix-ar":"عيّن تاريخ الالتحاق عبر `employees.update` (`employment_detail.join_date`)."},{"code":"unknown_reason","meaning":"`reason_id` is not one of the ministry's reasons.","x-meaning-ar":"`reason_id` ليس من أسباب الوزارة.","x-fix":"Pick an id from `termination_reasons.list`.","x-fix-ar":"اختر رقماً من `termination_reasons.list`."},{"code":"last_working_day_required","meaning":"`last_working_day` is missing or not a date.","x-meaning-ar":"`last_working_day` ناقص أو ليس تاريخاً.","x-fix":"Send the last working day as `YYYY-MM-DD`.","x-fix-ar":"أرسل آخر يوم عمل بالشكل `YYYY-MM-DD`."},{"code":"last_working_day_before_join_date","meaning":"The last working day is before the employee joined.","x-meaning-ar":"آخر يوم عمل يسبق تاريخ التحاق الموظف.","x-fix":"Correct the last working day, or the join date.","x-fix-ar":"صحّح آخر يوم عمل أو تاريخ الالتحاق."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This package can no longer be confirmed.","code":"package_not_confirmable","error_code":"package_not_confirmable"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"acknowledge_held_custody":{"type":"boolean","description":"Required (`true`) when the package lists `held_custody`: HR acknowledges the assets still with the employee.","x-description-ar":"مطلوب (`true`) إذا ذكرت التسوية `held_custody`: تُقِرّ الموارد البشرية بالأصول التي ما زالت لدى الموظف."}}},"example":{"acknowledge_held_custody":true}}},"required":true,"description":"The confirmation."}}},"/termination_packages/{id}/recalculate":{"post":{"summary":"Recalculate an end-of-service package","operationId":"termination_packages.recalculate","tags":["End of service"],"description":"Recalculates a `draft` or `declined` package against today's data — salary, leave balance, loans, bonuses,\ndeductions, custody — keeping its reason, dates and any total HR entered. Clears `stale`.\n\n**When to use:** when `termination_packages.show` reports the package `stale`, before confirming.\n\n**Prerequisites:** the package `id` from `termination_packages.list`. The token's owner must be an employee.\n\n**Side effects:** the frozen calculation is replaced; recorded in the audit log. Not offered to Claude,\nbecause it changes what a leaving employee is paid.","x-summary-ar":"إعادة حساب تسوية نهاية خدمة","x-description-ar":"يعيد حساب تسوية بحالة `draft` أو `declined` على بيانات اليوم — الراتب ورصيد الإجازات والسلف والمكافآت\nوالاستقطاعات والعهد — مع الإبقاء على السبب والتواريخ وأي إجمالي أدخلته الموارد البشرية. يزيل `stale`.\n\n**متى تستخدمه:** عندما يبيّن `termination_packages.show` أن التسوية متقادمة `stale`، قبل اعتمادها.\n\n**المتطلبات:** رقم `id` التسوية من `termination_packages.list`. يجب أن يكون صاحب الرمز موظفاً.\n\n**الآثار الجانبية:** يُستبدل الحساب المجمّد ويُسجَّل في سجل التدقيق. لا يُعرض على Claude لأنه يغيّر ما يُصرف\nللموظف المغادر.","x-access":"write","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/termination_package_id"}],"responses":{"200":{"description":"The recalculated package.","x-description-ar":"التسوية بعد إعادة الحساب.","content":{"application/json":{"example":{"record":{"id":41,"reference":"EOS-0041","status":"draft","include_last_payroll":false,"status_label_en":"Draft","status_label_ar":"مسودة","employee":{"id":1203,"employee_no":"EMP-0142","name_en":"Ahmed Al-Otaibi","name_ar":"أحمد العتيبي","department":"Finance","employment_status":"active"},"reason":{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"},"last_working_day":"2026-12-31","payment_date":"2027-01-05","computed_compensation_total":"37888.89","compensation_total":"37888.89","offsets_total":"0.00","net_payout":"37888.89","currency":"SAR","has_override":false,"override":null,"payment_status":null,"payment":null,"breakdown":{"service":{"join_date":"2019-03-01","years":7,"months":7,"days":0,"days_360":2730},"wage_base":{"gross":"11000.00","deductions_total":"1000.00","wage":"10000.00","daily_wage":"333.33"},"gratuity":{"amount":"33888.89","tier":"resignation_two_thirds"},"leave_encashment":{"days":"12.0","amount":"4000.00","policies":[],"excluded":[]},"final_salary":{"include_last_payroll":false,"days":0,"components":[]},"bonuses":[],"deductions":[],"loans":[],"totals":{"compensation":{"gratuity":"33888.89","leave_encashment":"4000.00","final_salary":"0.00","bonuses":"0.00","total":"37888.89"},"offsets":{"deductions":"0.00","loans":"0.00","total":"0.00"},"net_payout":"37888.89"}},"custody":[],"held_custody":[],"calculated_at":"2026-11-27T08:00:00Z","confirmed_at":null,"approved_at":null,"paid_at":null,"cancelled_at":null,"created_at":"2026-11-27T08:00:00Z","created_by":{"id":88,"name":"Faisal Al-Qahtani"},"confirmed_by":null,"stale":false,"stale_reasons":[],"blockers":[],"decisions_outstanding":0,"loan_settlements":[],"effects":null,"accounting":{"mode":"legacy","gate":"none"},"actions":{"can_edit":true,"can_recalculate":true,"can_confirm":true,"can_cancel":true}}},"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/termination_package"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The package cannot be recalculated.","x-description-ar":"لا يمكن إعادة حساب التسوية.","x-codes":[{"code":"package_not_editable","meaning":"Only a `draft` or `declined` package can change.","x-meaning-ar":"لا تتغير إلا التسوية بحالة `draft` أو `declined`.","x-fix":"Cancel it and create a new one, if it is not paid.","x-fix-ar":"ألغها وأنشئ غيرها إن لم تُصرف."},{"code":"employee_not_active","meaning":"The employee is no longer active (already serving notice or gone).","x-meaning-ar":"الموظف لم يعد نشطاً (في فترة الإشعار أو غادر).","x-fix":"Nothing to do here; a package is only for an active employee.","x-fix-ar":"لا إجراء هنا؛ التسوية للموظف النشط فقط."},{"code":"payment_date_required","meaning":"`payment_date` is missing or not a date.","x-meaning-ar":"`payment_date` ناقص أو ليس تاريخاً.","x-fix":"Send the pay date as `YYYY-MM-DD`.","x-fix-ar":"أرسل تاريخ الصرف بالشكل `YYYY-MM-DD`."},{"code":"payment_date_in_past","meaning":"The payment date is before today (company time zone).","x-meaning-ar":"تاريخ الصرف قبل اليوم (بتوقيت الشركة).","x-fix":"Use today or a later date.","x-fix-ar":"استخدم اليوم أو تاريخاً لاحقاً."},{"code":"payment_date_before_last_working_day","meaning":"The payment date is before the last working day.","x-meaning-ar":"تاريخ الصرف قبل آخر يوم عمل.","x-fix":"Pay on or after the last working day.","x-fix-ar":"اجعل الصرف في آخر يوم عمل أو بعده."},{"code":"override_reason_required","meaning":"`compensation_total` differs from the calculated total and no `override_reason` was sent.","x-meaning-ar":"`compensation_total` يختلف عن الإجمالي المحسوب ولم يُرسل `override_reason`.","x-fix":"Explain the difference in `override_reason`, or drop `compensation_total`.","x-fix-ar":"اشرح الفرق في `override_reason`، أو احذف `compensation_total`."},{"code":"override_reason_too_short","meaning":"`override_reason` is shorter than 20 characters.","x-meaning-ar":"`override_reason` أقصر من ٢٠ حرفاً.","x-fix":"Write a real explanation, 20 characters at least.","x-fix-ar":"اكتب سبباً واضحاً لا يقل عن ٢٠ حرفاً."},{"code":"compensation_total_negative","meaning":"`compensation_total` is negative.","x-meaning-ar":"`compensation_total` سالب.","x-fix":"Send zero or more.","x-fix-ar":"أرسل صفراً أو أكثر."},{"code":"offsets_exceed_compensation","meaning":"Loans, deductions and custody owed exceed what the employee is owed; the message gives the shortfall.","x-meaning-ar":"السلف والاستقطاعات والعهد المستحقة على الموظف تتجاوز مستحقاته؛ تذكر الرسالة مقدار العجز.","x-fix":"Settle part of the loans or custody first, or raise the total.","x-fix-ar":"سدّد جزءاً من السلف أو العهد أولاً، أو ارفع الإجمالي."},{"code":"loan_not_settleable","meaning":"One of the employee's loans cannot be settled from the package; `reference` names it.","x-meaning-ar":"إحدى سلف الموظف لا يمكن تسويتها من التسوية؛ يذكرها `reference`.","x-fix":"Resolve that loan first (`hr_loans.show`).","x-fix-ar":"عالج تلك السلفة أولاً (`hr_loans.show`)."},{"code":"custody_installment_in_flight","meaning":"A custody installment is on a payroll run that is not finished; `reference` names it.","x-meaning-ar":"قسط عهدة على مسيّر رواتب لم يكتمل؛ يذكره `reference`.","x-fix":"Finish or revert that payroll run first.","x-fix-ar":"أكمل ذلك المسيّر أو أرجعه أولاً."},{"code":"payable_not_positive","meaning":"With accounting approval on, what remains after deductions and custody would be zero or less, which Qoyod refuses.","x-meaning-ar":"مع تفعيل اعتماد المحاسبة، يكون المتبقي بعد الاستقطاعات والعهد صفراً أو أقل، وهذا ترفضه قيود.","x-fix":"Override the total with a reason, or settle the custody first.","x-fix-ar":"عدّل الإجمالي يدوياً مع ذكر السبب، أو سدّد العهدة أولاً."},{"code":"no_active_salary","meaning":"The employee has no active salary, so there is no wage to calculate from.","x-meaning-ar":"ليس للموظف راتب نشط، فلا يوجد أجر يُحسب عليه.","x-fix":"Give the employee an active salary (`salaries.create`).","x-fix-ar":"أضف للموظف راتباً نشطاً (`salaries.create`)."},{"code":"no_join_date","meaning":"The employee has no join date, so the length of service is unknown.","x-meaning-ar":"ليس للموظف تاريخ التحاق، فمدة الخدمة غير معروفة.","x-fix":"Set the join date with `employees.update` (`employment_detail.join_date`).","x-fix-ar":"عيّن تاريخ الالتحاق عبر `employees.update` (`employment_detail.join_date`)."},{"code":"unknown_reason","meaning":"`reason_id` is not one of the ministry's reasons.","x-meaning-ar":"`reason_id` ليس من أسباب الوزارة.","x-fix":"Pick an id from `termination_reasons.list`.","x-fix-ar":"اختر رقماً من `termination_reasons.list`."},{"code":"last_working_day_required","meaning":"`last_working_day` is missing or not a date.","x-meaning-ar":"`last_working_day` ناقص أو ليس تاريخاً.","x-fix":"Send the last working day as `YYYY-MM-DD`.","x-fix-ar":"أرسل آخر يوم عمل بالشكل `YYYY-MM-DD`."},{"code":"last_working_day_before_join_date","meaning":"The last working day is before the employee joined.","x-meaning-ar":"آخر يوم عمل يسبق تاريخ التحاق الموظف.","x-fix":"Correct the last working day, or the join date.","x-fix-ar":"صحّح آخر يوم عمل أو تاريخ الالتحاق."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.","x-meaning-ar":"صاحب الرمز ليس له سجل موظف في هذه الشركة، وكل تغيير على التسوية يُسجَّل باسم الموظف الذي أجراه.","x-fix":"Use a token created by a person who is an employee here.","x-fix-ar":"استخدم رمزاً أنشأه شخص له سجل موظف في هذه الشركة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This package can no longer be edited.","code":"package_not_editable","error_code":"package_not_editable"}}}}}}},"/termination_reasons":{"get":{"summary":"List the reasons an employment can end","operationId":"termination_reasons.list","tags":["End of service"],"description":"Returns the Ministry of Human Resources' list of reasons an employment can end, in Arabic and English, with\nwhat each does to the end-of-service award: `full`, `none` (e.g. dismissal under Article 80) or `tiered`\n(resignation, scaled by years of service). The ids are the ministry's own.\n\n**When to use:** to pick the `reason_id` for `termination_packages.preview` and `termination_packages.create`.\nThe reason changes the payout, so choose the one that matches the case.\n\n**Prerequisites:** none.\n\n**Side effects:** none. A fixed list, not paginated.","x-summary-ar":"عرض أسباب انتهاء علاقة العمل","x-description-ar":"يعرض قائمة وزارة الموارد البشرية لأسباب انتهاء علاقة العمل بالعربية والإنجليزية، مع أثر كل سبب على مكافأة\nنهاية الخدمة: `full` كاملة، أو `none` لا شيء (مثل الفصل وفق المادة ٨٠)، أو `tiered` متدرجة (الاستقالة حسب\nسنوات الخدمة). الأرقام هي أرقام الوزارة نفسها.\n\n**متى تستخدمه:** لاختيار `reason_id` في `termination_packages.preview` و`termination_packages.create`. السبب\nيغيّر المبلغ المستحق، فاختر ما يطابق الحالة.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. قائمة ثابتة بلا صفحات.","x-access":"read","x-permission":{"key":"time_off/manage_offboarding","label":"Manage employee offboarding","x-label-ar":"إدارة إجراءات إنهاء الخدمة"},"x-feature":"time_off","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The reasons.","x-description-ar":"الأسباب.","content":{"application/json":{"example":{"records":[{"id":1,"code":"contract_expiry","name_en":"Expiry of the contract term","name_ar":"انتهاء مدة العقد","payout_class":"full"},{"id":9,"code":"resignation","name_en":"Resignation","name_ar":"استقالة","payout_class":"tiered"}]},"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/termination_reason"},"description":"Every reason, by ministry id.","x-description-ar":"كل الأسباب حسب رقم الوزارة."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/ticket_approvals":{"get":{"summary":"List requests waiting for my approval","operationId":"ticket_approvals.list","tags":["Request approvals"],"description":"Returns the requests the token's owner can decide now, oldest first: their direct reports' requests at the\nmanager stage, and — with Requests › manage — every request at the HR stage. Never the owner's own requests.\n`stage` says which hat the owner wears for each row.\n\n**When to use:** to answer \"what is waiting for my approval?\" and to get the ids for `tickets.approve`,\n`tickets.reject` or the bulk decisions. Every row listed can be decided by the owner.\n\n**Prerequisites:** none.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض الطلبات التي تنتظر موافقتي","x-description-ar":"يعرض الطلبات التي يستطيع صاحب الرمز البت فيها الآن، الأقدم أولاً: طلبات مرؤوسيه المباشرين في مرحلة المدير،\nو— لمن لديه الطلبات › الإدارة — كل الطلبات في مرحلة الموارد البشرية. ولا تظهر طلبات صاحب الرمز نفسه.\nويوضح `stage` بأي صفة يقرر صاحب الرمز في كل طلب.\n\n**متى تستخدمه:** للإجابة عن «ما الذي ينتظر موافقتي؟» وللحصول على الأرقام لـ `tickets.approve` أو\n`tickets.reject` أو القرارات المجمّعة. كل طلب في القائمة يستطيع صاحب الرمز البت فيه.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of requests waiting for the owner.","x-description-ar":"صفحة من الطلبات التي تنتظر صاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"pending_manager","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":null,"overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["approve","reject"],"stage":"manager"}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/ticket_approval_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; approvers act as employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، وأصحاب الموافقة يتصرفون بصفتهم موظفين.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/ticket_approvals/bulk_approve":{"patch":{"summary":"Approve several requests at once","operationId":"ticket_approvals.bulk_approve","tags":["Request approvals"],"description":"Approves up to 50 requests in one call, each exactly as `tickets.approve` would, one by one: a request the\nowner may not decide, cannot see, or that someone else decided first is reported in `failed` with the reason,\nand the others go through. It is not all-or-nothing.\n\n**When to use:** to clear a backlog of approvals. For one request, `tickets.approve`.\n\n**Prerequisites:** ids from `ticket_approvals.list`.\n\n**Side effects:** per approved request, as `tickets.approve`: the request moves to HR or to the department\nqueue (due date set), an activity-log entry is written, and the next people are notified in QHR and by email.\n\n**Not offered to Claude:** it decides many people's requests in one step, with no chance to read each one.","x-summary-ar":"الموافقة على عدة طلبات دفعة واحدة","x-description-ar":"يوافق على ما يصل إلى ٥٠ طلباً في استدعاء واحد، كلٌّ منها تماماً كما يفعل `tickets.approve` وواحداً تلو الآخر:\nالطلب الذي لا يستطيع صاحب الرمز البت فيه أو لا يراه أو سبقه غيره إلى قراره يُذكر في `failed` مع السبب، وتمضي\nالبقية. فالعملية لا تُنفَّذ كلها أو لا شيء.\n\n**متى تستخدمه:** لإنجاز تراكم من الموافقات. لطلب واحد استخدم `tickets.approve`.\n\n**المتطلبات:** الأرقام من `ticket_approvals.list`.\n\n**الآثار الجانبية:** لكل طلب تمت الموافقة عليه، كما في `tickets.approve`: ينتقل إلى الموارد البشرية أو إلى\nقائمة القسم (ويُحدد تاريخ الاستحقاق)، ويُكتب سجل نشاط، ويُشعَر أصحاب الدور التالي داخل QHR وبالبريد.\n\n**لا يُعرض على Claude:** يبت في طلبات أشخاص كثيرين بخطوة واحدة دون فرصة لقراءة كل طلب.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"What happened to each id.","x-description-ar":"نتيجة كل رقم.","content":{"application/json":{"example":{"succeeded":[5012],"failed":[{"id":5013,"error":"You cannot approve or reject your own request"}]},"schema":{"$ref":"#/components/schemas/ticket_approval_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no ids, more than 50, or (reject) no reason. Decisions on single requests that fail are reported in `failed`, not here.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠، أو (للرفض) لا يوجد سبب. أما الطلبات المفردة التي يتعذر البت فيها فتُذكر في `failed` لا هنا.","x-fix":"Send 1 to 50 ids from `ticket_approvals.list`, and a reason to reject.","x-fix-ar":"أرسل من ١ إلى ٥٠ رقماً من `ticket_approvals.list`، وسبباً عند الرفض."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; approvers act as employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، وأصحاب الموافقة يتصرفون بصفتهم موظفين.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","description":"1 to 50 request ids, from `ticket_approvals.list`.","x-description-ar":"من ١ إلى ٥٠ رقم طلب، من `ticket_approvals.list`.","items":{"type":"integer"},"minItems":1,"maxItems":50}}},"example":{"ids":[5012,5013]}}},"required":true,"description":"The requests to approve."}}},"/ticket_approvals/bulk_reject":{"patch":{"summary":"Reject several requests at once","operationId":"ticket_approvals.bulk_reject","tags":["Request approvals"],"description":"Rejects up to 50 requests in one call with one reason, each exactly as `tickets.reject` would, one by one: a\nrequest the owner may not decide, cannot see, or that someone else decided first is reported in `failed`, and\nthe others are rejected. Rejected requests are final.\n\n**When to use:** to refuse many requests for the same reason. For one request, `tickets.reject`.\n\n**Prerequisites:** ids from `ticket_approvals.list`.\n\n**Side effects:** per rejected request: an activity-log entry with the reason, and the requester is notified\nin QHR and by email with the reason.\n\n**Not offered to Claude:** it ends many people's requests for good in one step.","x-summary-ar":"رفض عدة طلبات دفعة واحدة","x-description-ar":"يرفض ما يصل إلى ٥٠ طلباً في استدعاء واحد بسبب واحد، كلٌّ منها تماماً كما يفعل `tickets.reject` وواحداً تلو\nالآخر: الطلب الذي لا يستطيع صاحب الرمز البت فيه أو لا يراه أو سبقه غيره إلى قراره يُذكر في `failed`، وتُرفض\nالبقية. والرفض نهائي.\n\n**متى تستخدمه:** لرفض طلبات كثيرة للسبب نفسه. لطلب واحد استخدم `tickets.reject`.\n\n**المتطلبات:** الأرقام من `ticket_approvals.list`.\n\n**الآثار الجانبية:** لكل طلب مرفوض: سجل نشاط مع السبب، ويُشعَر مقدّم الطلب داخل QHR وبالبريد مع السبب.\n\n**لا يُعرض على Claude:** ينهي طلبات أشخاص كثيرين نهائياً بخطوة واحدة.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"What happened to each id.","x-description-ar":"نتيجة كل رقم.","content":{"application/json":{"example":{"succeeded":[5012,5013],"failed":[]},"schema":{"$ref":"#/components/schemas/ticket_approval_bulk_result"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"validation_failed","meaning":"The batch was refused as a whole: no ids, more than 50, or (reject) no reason. Decisions on single requests that fail are reported in `failed`, not here.","x-meaning-ar":"رُفضت الدفعة كاملة: لا توجد أرقام، أو أكثر من ٥٠، أو (للرفض) لا يوجد سبب. أما الطلبات المفردة التي يتعذر البت فيها فتُذكر في `failed` لا هنا.","x-fix":"Send 1 to 50 ids from `ticket_approvals.list`, and a reason to reject.","x-fix-ar":"أرسل من ١ إلى ٥٠ رقماً من `ticket_approvals.list`، وسبباً عند الرفض."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; approvers act as employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، وأصحاب الموافقة يتصرفون بصفتهم موظفين.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","reason"],"properties":{"ids":{"type":"array","description":"1 to 50 request ids, from `ticket_approvals.list`.","x-description-ar":"من ١ إلى ٥٠ رقم طلب، من `ticket_approvals.list`.","items":{"type":"integer"},"minItems":1,"maxItems":50},"reason":{"type":"string","description":"One reason for all, up to 500 characters.","x-description-ar":"سبب واحد للجميع حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"ids":[5012,5013],"reason":"Hardware purchases are frozen until January."}}},"required":true,"description":"The requests to reject, and why."}}},"/ticket_catalog":{"get":{"summary":"List the request types an employee can raise","operationId":"ticket_catalog.list","tags":["Request catalog"],"description":"Returns the request catalog: every enabled category, in display order, each with its enabled request types.\nFor each type you get the form to fill in (`form_fields`), who approves it (`approval_flow`), the\ndepartment that will do the work, its default priority and its target days. A category with no enabled\ntype is left out.\n\n**How a type shapes a request:** the request copies the type when it is submitted. Its form decides the\n`answers` `tickets.create` needs (by field `key`, with the field's rules). Its approval flow decides the\nfirst stage: `none` goes straight to the department's queue, `manager` waits for the requester's direct\nmanager (or HR when there is none), `hr` waits for HR, `manager_and_hr` for both in turn. Its department\nis who takes and works on it, and its target days set the due date once approved. Editing a type later\nnever changes a request already submitted.\n\n**When to use:** before `tickets.create`, to choose the type and know which answers to send. HR's full\nsettings view, disabled types included, is `ticket_types.list`.\n\n**Prerequisites:** none. The token owner must be linked to an employee.\n\n**Side effects:** none.","x-summary-ar":"عرض أنواع الطلبات التي يمكن للموظف تقديمها","x-description-ar":"يعرض دليل الطلبات: كل فئة مفعّلة بترتيب العرض، ومع كل فئة أنواع الطلبات المفعّلة فيها. لكل نوع تحصل على\nالنموذج المطلوب تعبئته (`form_fields`)، ومن يعتمده (`approval_flow`)، والقسم الذي سينفّذ العمل، وأولويته\nالافتراضية، وعدد أيامه المستهدف. لا تظهر الفئة التي ليس فيها نوع مفعّل.\n\n**كيف يشكّل النوعُ الطلبَ:** ينسخ الطلب بيانات النوع لحظة تقديمه. فالنموذج يحدد الإجابات `answers` التي\nتحتاجها `tickets.create` (بمفتاح كل حقل `key` ووفق قواعده). ومسار الاعتماد يحدد المرحلة الأولى: `none`\nيذهب مباشرة إلى قائمة القسم، و`manager` ينتظر المدير المباشر لمقدّم الطلب (أو الموارد البشرية إن لم يوجد)،\nو`hr` ينتظر الموارد البشرية، و`manager_and_hr` ينتظرهما بالتتابع. والقسم هو من يستلم الطلب وينفّذه، وعدد\nالأيام المستهدف يحدد تاريخ الاستحقاق بعد الاعتماد. تعديل النوع لاحقاً لا يغيّر أي طلب قُدّم من قبل.\n\n**متى تستخدمه:** قبل `tickets.create` لاختيار النوع ومعرفة الإجابات المطلوبة. أما عرض الإعدادات الكامل\nللموارد البشرية، بما فيه الأنواع المعطّلة، فهو `ticket_types.list`.\n\n**المتطلبات:** لا شيء. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The catalog.","x-description-ar":"الدليل.","content":{"application/json":{"example":{"records":[{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue","position":0,"enabled":true,"types":[{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"manager","default_priority":"medium","target_days":5,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}]}]}]},"schema":{"$ref":"#/components/schemas/ticket_catalog"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile; only employees raise requests.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف؛ تقديم الطلبات للموظفين فقط.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/ticket_catalog/employees":{"get":{"summary":"Find a colleague for an employee form field","operationId":"ticket_catalog.employees","tags":["Request catalog"],"description":"Returns up to 20 employed people whose name (English or Arabic) or employee number contains `search`,\nordered by name, each with their department. Without `search`, the first 20 by name.\n\n**When to use:** to fill a form field of type `employee` in `tickets.create` (for example \"who is the new\njoiner?\"): send the chosen person's `id` as that field's answer. To browse the whole directory use\n`employees.list`, which needs more permissions.\n\n**Prerequisites:** none. The token owner must be linked to an employee.\n\n**Side effects:** none.","x-summary-ar":"البحث عن زميل لحقل من نوع موظف","x-description-ar":"يعرض حتى ٢٠ شخصاً على رأس العمل يحتوي اسمهم (بالعربية أو الإنجليزية) أو رقمهم الوظيفي على `search`،\nمرتبين بالاسم ومع قسم كل منهم. بدون `search` يعرض أول ٢٠ بالاسم.\n\n**متى تستخدمه:** لتعبئة حقل من نوع `employee` في `tickets.create` (مثل «من الموظف الجديد؟»): أرسل رقم\n`id` الشخص المختار إجابةً لذلك الحقل. لتصفح دليل الموظفين كاملاً استخدم `employees.list`، وهي تحتاج\nصلاحيات أكثر.\n\n**المتطلبات:** لا شيء. يجب أن يكون صاحب الرمز مرتبطاً بملف موظف.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":100},"description":"Name or employee number contains (up to 100 characters).","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على (حتى ١٠٠ حرف).","example":"Omar"}],"responses":{"200":{"description":"Matching employees.","x-description-ar":"الموظفون المطابقون.","content":{"application/json":{"example":{"records":[{"id":1207,"name":"Omar Khaled","department_name":"IT"}]},"schema":{"$ref":"#/components/schemas/ticket_catalog_employee_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner is not an employee.","x-description-ar":"صاحب الرمز ليس موظفاً.","x-codes":[{"code":"employee_required","meaning":"The token's owner is a system user with no employee profile; only employees raise requests.","x-meaning-ar":"صاحب الرمز مستخدم نظام بلا ملف موظف؛ تقديم الطلبات للموظفين فقط.","x-fix":"Use a token created by a user linked to an employee.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بملف موظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/ticket_categories":{"get":{"summary":"List request categories","operationId":"ticket_categories.list","tags":["Request settings"],"description":"Returns every request category, enabled or not, in display order, with how many request types each holds\nand whether it can still be deleted. Not paginated.\n\n**When to use:** to manage the catalog's headings, or to find a `ticket_category_id` for\n`ticket_types.list` or `ticket_types.create`. Employees see only the enabled part through\n`ticket_catalog.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عرض فئات الطلبات","x-description-ar":"يعرض كل فئات الطلبات، المفعّلة وغير المفعّلة، بترتيب العرض، مع عدد أنواع الطلبات في كل فئة وهل ما زال\nحذفها ممكناً. بلا تقسيم إلى صفحات.\n\n**متى تستخدمه:** لإدارة عناوين دليل الطلبات، أو لمعرفة رقم `ticket_category_id` اللازم لـ\n`ticket_types.list` أو `ticket_types.create`. يرى الموظفون الجزء المفعّل فقط عبر `ticket_catalog.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Every category.","x-description-ar":"كل الفئات.","content":{"application/json":{"example":{"records":[{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue","position":0,"enabled":true,"types_count":2,"deletable":false},{"id":5,"name_en":"HR letters","name_ar":"خطابات الموارد البشرية","name":"HR letters","icon":"file-text","color":"purple","position":1,"enabled":false,"types_count":0,"deletable":true}]},"schema":{"$ref":"#/components/schemas/ticket_category_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create a request category","operationId":"ticket_categories.create","tags":["Request settings"],"description":"Adds a heading to the request catalog, placed after the last one. It holds no request type yet: add them\nwith `ticket_types.create`. A category without an enabled type stays out of `ticket_catalog.list`.\n\n**When to use:** when HR opens a new family of requests (for example \"Facilities\").\n\n**Prerequisites:** none. Both names must be unique.\n\n**Side effects:** recorded in the audit log.\n\n**Not offered to Claude:** it changes what every employee of the company is offered; HR sets the catalog\nup in QHR.","x-summary-ar":"إنشاء فئة طلبات","x-description-ar":"يضيف عنواناً إلى دليل الطلبات في آخر القائمة. لا تحوي الفئة أي نوع طلب بعد: أضف الأنواع عبر\n`ticket_types.create`. ولا تظهر الفئة في `ticket_catalog.list` ما لم يكن فيها نوع مفعّل.\n\n**متى تستخدمه:** عندما تفتح الموارد البشرية مجموعة طلبات جديدة (مثل «المرافق»).\n\n**المتطلبات:** لا شيء. يجب أن يكون الاسمان فريدين.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه يغيّر ما يُعرض على كل موظفي الشركة؛ وتُعِدّ الموارد البشرية الدليل من داخل QHR.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new category.","x-description-ar":"الفئة الجديدة.","content":{"application/json":{"example":{"id":6,"name_en":"Facilities","name_ar":"المرافق","name":"Facilities","icon":"building","color":"green","position":2,"enabled":true,"types_count":0,"deletable":true},"schema":{"$ref":"#/components/schemas/ticket_category"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The category is not valid.","x-description-ar":"بيانات الفئة غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Name en has already been taken","code":"validation_failed","errors":{"name_en":["has already been taken"]}}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ticket_category_input"},"example":{"ticket_category":{"name_en":"Facilities","name_ar":"المرافق","icon":"building","color":"green"}}}},"required":true,"description":"The new category."}}},"/ticket_categories/reorder":{"patch":{"summary":"Reorder request categories","operationId":"ticket_categories.reorder","tags":["Request settings"],"description":"Saves the order categories are shown in, in the catalog and in settings. `ids` must list every category\nexactly once, in the new order; the answer is the full list in that order.\n\n**When to use:** after HR moves categories around. To change one category's name or icon use\n`ticket_categories.update`.\n\n**Prerequisites:** every id, from `ticket_categories.list`.\n\n**Side effects:** each move is recorded in the audit log.\n\n**Not offered to Claude:** a company-wide layout choice made by HR in QHR.","x-summary-ar":"إعادة ترتيب فئات الطلبات","x-description-ar":"يحفظ ترتيب ظهور الفئات في دليل الطلبات وفي الإعدادات. يجب أن تذكر `ids` كل الفئات مرة واحدة بالضبط\nبالترتيب الجديد؛ والرد هو القائمة كاملة بذلك الترتيب.\n\n**متى تستخدمه:** بعد أن تعيد الموارد البشرية ترتيب الفئات. لتغيير اسم فئة أو أيقونتها استخدم\n`ticket_categories.update`.\n\n**المتطلبات:** كل الأرقام، من `ticket_categories.list`.\n\n**الآثار الجانبية:** يُسجَّل كل نقل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه قرار تنظيمي على مستوى الشركة تتخذه الموارد البشرية داخل QHR.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Every category, in the new order.","x-description-ar":"كل الفئات بالترتيب الجديد.","content":{"application/json":{"example":{"records":[{"id":5,"name_en":"HR letters","name_ar":"خطابات الموارد البشرية","name":"HR letters","icon":"file-text","color":"purple","position":0,"enabled":true,"types_count":1,"deletable":true},{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue","position":1,"enabled":true,"types_count":2,"deletable":false}]},"schema":{"$ref":"#/components/schemas/ticket_category_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The order is not valid.","x-description-ar":"الترتيب غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"`ids` does not list every category exactly once.","x-meaning-ar":"`ids` لا يذكر كل الفئات مرة واحدة بالضبط.","x-fix":"Read `ticket_categories.list` and send every id once, in the new order.","x-fix-ar":"اقرأ `ticket_categories.list` وأرسل كل رقم مرة واحدة بالترتيب الجديد."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The order must list every category exactly once","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"description":"Every category id, once, in the new order.","x-description-ar":"كل أرقام الفئات، مرة واحدة، بالترتيب الجديد."}}},"example":{"ids":[5,4]}}},"required":true,"description":"The new order."}}},"/ticket_categories/{id}":{"patch":{"summary":"Update a request category","operationId":"ticket_categories.update","tags":["Request settings"],"description":"Changes the fields you send: names, icon, colour, or `enabled`. Disabling a category hides it and all its\nrequest types from `ticket_catalog.list`, so nobody can raise those requests any more; requests already\nsubmitted carry on unchanged.\n\n**When to use:** to rename a category or to stop offering it (a category that was used cannot be deleted,\nonly disabled).\n\n**Prerequisites:** the category's `id`, from `ticket_categories.list`.\n\n**Side effects:** recorded in the audit log.\n\n**Not offered to Claude:** it changes what every employee of the company is offered.","x-summary-ar":"تعديل فئة طلبات","x-description-ar":"يغيّر الحقول التي ترسلها: الاسمين أو الأيقونة أو اللون أو `enabled`. تعطيل الفئة يخفيها ويخفي كل أنواع\nطلباتها من `ticket_catalog.list`، فلا يستطيع أحد تقديم تلك الطلبات بعد ذلك؛ أما الطلبات المقدَّمة سابقاً\nفتستمر دون تغيير.\n\n**متى تستخدمه:** لإعادة تسمية فئة أو لإيقاف عرضها (الفئة المستخدمة لا يمكن حذفها، بل تعطيلها فقط).\n\n**المتطلبات:** رقم `id` الفئة من `ticket_categories.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه يغيّر ما يُعرض على كل موظفي الشركة.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_category_id"}],"responses":{"200":{"description":"The category.","x-description-ar":"الفئة.","content":{"application/json":{"example":{"id":4,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue","position":0,"enabled":false,"types_count":2,"deletable":false},"schema":{"$ref":"#/components/schemas/ticket_category"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The category is not valid.","x-description-ar":"بيانات الفئة غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Icon is not included in the list","code":"validation_failed","errors":{"icon":["is not included in the list"]}}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ticket_category_input"},"example":{"ticket_category":{"enabled":false}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a request category","operationId":"ticket_categories.delete","tags":["Request settings"],"description":"Deletes a category together with its request types. Refused while any of those types has ever been used by\na request (`deletable` is false); disable it instead.\n\n**When to use:** to remove a category created by mistake. To stop offering one that was used, use\n`ticket_categories.update` with `enabled: false`.\n\n**Prerequisites:** the category's `id`, from `ticket_categories.list`.\n\n**Side effects:** its request types are deleted too. Recorded in the audit log. Cannot be undone.\n\n**Not offered to Claude:** it is irreversible and takes the category's request types with it.","x-summary-ar":"حذف فئة طلبات","x-description-ar":"يحذف الفئة مع أنواع طلباتها. يُرفض ما دام أي من تلك الأنواع قد استُخدم في طلب (`deletable` خطأ)؛ عطّلها\nبدلاً من ذلك.\n\n**متى تستخدمه:** لحذف فئة أُنشئت بالخطأ. لإيقاف عرض فئة مستخدمة استخدم `ticket_categories.update` مع\n`enabled: false`.\n\n**المتطلبات:** رقم `id` الفئة من `ticket_categories.list`.\n\n**الآثار الجانبية:** تُحذف أنواع طلباتها أيضاً. يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه.\n\n**لا يُعرض على Claude:** لأنه لا يمكن التراجع عنه ويحذف معه أنواع طلبات الفئة.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_category_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذفت."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The category is in use.","x-description-ar":"الفئة مستخدمة.","x-codes":[{"code":"validation_failed","meaning":"A request type of the category has already been used by a request.","x-meaning-ar":"أحد أنواع الفئة استُخدم في طلب من قبل.","x-fix":"Disable the category instead (`ticket_categories.update` with `enabled: false`).","x-fix-ar":"عطّل الفئة بدلاً من ذلك (`ticket_categories.update` مع `enabled: false`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This category has been used and can only be disabled","code":"validation_failed"}}}}}}},"/ticket_types":{"get":{"summary":"List request types","operationId":"ticket_types.list","tags":["Request settings"],"description":"Returns request types, enabled or not, in display order, each with its form, approval flow, handling\ndepartment (and how many employed people it has), default priority, target days, how many requests used\nit and whether it can still be deleted. Pass `ticket_category_id` for one category's types. Not paginated.\n\n**When to use:** to review or manage how requests work. Employees choosing what to ask for use\n`ticket_catalog.list`, which shows only what is enabled.\n\n**Prerequisites:** `ticket_category_id` from `ticket_categories.list` (optional).\n\n**Side effects:** none.","x-summary-ar":"عرض أنواع الطلبات","x-description-ar":"يعرض أنواع الطلبات، المفعّلة وغير المفعّلة، بترتيب العرض، ولكل نوع نموذجه ومسار اعتماده والقسم المنفّذ\n(وعدد موظفيه على رأس العمل) وأولويته الافتراضية وعدد أيامه المستهدف وعدد الطلبات التي استخدمته وهل ما زال\nحذفه ممكناً. أرسل `ticket_category_id` لعرض أنواع فئة واحدة. بلا تقسيم إلى صفحات.\n\n**متى تستخدمه:** لمراجعة طريقة عمل الطلبات أو إدارتها. أما الموظف الذي يختار ما يطلبه فيستخدم\n`ticket_catalog.list` الذي يعرض المفعّل فقط.\n\n**المتطلبات:** `ticket_category_id` من `ticket_categories.list` (اختياري).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"ticket_category_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this category's types (id from `ticket_categories.list`).","x-description-ar":"أنواع هذه الفئة فقط (الرقم من `ticket_categories.list`).","example":4}],"responses":{"200":{"description":"The request types.","x-description-ar":"أنواع الطلبات.","content":{"application/json":{"example":{"records":[{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"manager","default_priority":"medium","target_days":5,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}],"tickets_count":18,"deletable":false}]},"schema":{"$ref":"#/components/schemas/ticket_type_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Create a request type","operationId":"ticket_types.create","tags":["Request settings"],"description":"Adds a kind of request to a category, placed last in it, and offers it in `ticket_catalog.list` while it\nand its category are enabled.\n\n**What the type decides for every request raised with it:**\n- `form_fields` — the questions the employee answers in `tickets.create`, with their rules (required,\n  length, number range, file types and size, choices).\n- `approval_flow` — who approves before work starts: `none` (straight to the department), `manager` (the\n  requester's direct manager; HR when there is no manager), `hr`, or `manager_and_hr` (manager, then HR).\n  The approvers are notified when a request reaches them.\n- `department_id` — the department whose members see the request in `department_tickets.list`, take it\n  and work on it; they are notified when a request opens in their queue.\n- `default_priority` and `target_days` — the starting priority and the due date (approval day plus the\n  target days).\n\nA request copies these at submission, so later changes to the type never affect it.\n\n**Prerequisites:** `ticket_category_id` from `ticket_categories.list`; `department_id` from\n`employees.meta_data` (`departments`).\n\n**Side effects:** recorded in the audit log. No one is notified.\n\n**Not offered to Claude:** it changes what every employee can ask for and who approves and handles it;\nHR sets this up in QHR.","x-summary-ar":"إنشاء نوع طلب","x-description-ar":"يضيف نوع طلب إلى فئة في آخرها، ويظهر في `ticket_catalog.list` ما دام هو وفئته مفعّلين.\n\n**ما يحدده النوع لكل طلب يُقدَّم به:**\n- `form_fields`: الأسئلة التي يجيب عنها الموظف في `tickets.create` مع قواعدها (إلزامي، الطول، نطاق\n  الرقم، أنواع الملفات وحجمها، الخيارات).\n- `approval_flow`: من يعتمد قبل بدء العمل: `none` مباشرة إلى القسم، `manager` المدير المباشر لمقدّم الطلب\n  (أو الموارد البشرية إن لم يكن له مدير)، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد\n  البشرية. يُشعَر المعتمدون حين يصل الطلب إليهم.\n- `department_id`: القسم الذي يرى أعضاؤه الطلب في `department_tickets.list` ويستلمونه وينفّذونه، ويُشعَرون\n  حين يُفتح طلب في قائمتهم.\n- `default_priority` و`target_days`: الأولوية الأولى وتاريخ الاستحقاق (يوم الاعتماد مضافاً إليه عدد الأيام).\n\nينسخ الطلب هذه الإعدادات لحظة تقديمه، فلا يتأثر بأي تعديل لاحق على النوع.\n\n**المتطلبات:** `ticket_category_id` من `ticket_categories.list`، و`department_id` من `employees.meta_data`\n(`departments`).\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُرسَل أي إشعار.\n\n**لا يُعرض على Claude:** لأنه يغيّر ما يستطيع كل موظف طلبه ومن يعتمده وينفّذه؛ وتُعِدّه الموارد البشرية\nداخل QHR.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request type.","x-description-ar":"نوع الطلب الجديد.","content":{"application/json":{"example":{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"manager","default_priority":"medium","target_days":5,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}],"tickets_count":0,"deletable":true},"schema":{"$ref":"#/components/schemas/ticket_type"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The request type is not valid.","x-description-ar":"بيانات نوع الطلب غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are not valid. `errors` names them; form problems are under `errors.form_fields`, keyed by the field's index in the form (`\"2\"`), with list-wide ones under `errors.form_fields.base`.","x-meaning-ar":"بعض الحقول غير صحيحة. يذكرها `errors`؛ ومشكلات النموذج تحت `errors.form_fields` مفهرسة برقم الحقل في النموذج (`\"2\"`)، والمشكلات العامة للقائمة تحت `errors.form_fields.base`.","x-fix":"Fix the fields named in `errors`, then send again.","x-fix-ar":"صحّح الحقول المذكورة في `errors` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Form has errors","code":"validation_failed","errors":{"form_fields":{"1":{"label_ar":["can't be blank"]},"2":{"width":["must be 12, 6 or 4"]}}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ticket_type_input"},"example":{"ticket_type":{"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","department_id":7,"approval_flow":"manager","default_priority":"medium","target_days":5,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}]}}}},"required":true,"description":"The new request type."}}},"/ticket_types/reorder":{"patch":{"summary":"Reorder the request types of a category","operationId":"ticket_types.reorder","tags":["Request settings"],"description":"Saves the order of one category's request types, in the catalog and in settings. `ids` must list every type\nof that category exactly once, in the new order; the answer is the category's types in that order.\n\n**When to use:** after HR moves types around inside a category. To move a type to another category use\n`ticket_types.update` with a new `ticket_category_id`.\n\n**Prerequisites:** `ticket_category_id` from `ticket_categories.list`; the ids from `ticket_types.list`.\n\n**Side effects:** each move is recorded in the audit log.\n\n**Not offered to Claude:** a company-wide layout choice made by HR in QHR.","x-summary-ar":"إعادة ترتيب أنواع الطلبات في فئة","x-description-ar":"يحفظ ترتيب أنواع الطلبات في فئة واحدة، في دليل الطلبات وفي الإعدادات. يجب أن تذكر `ids` كل أنواع تلك الفئة\nمرة واحدة بالضبط بالترتيب الجديد؛ والرد هو أنواع الفئة بذلك الترتيب.\n\n**متى تستخدمه:** بعد أن تعيد الموارد البشرية ترتيب الأنواع داخل فئة. لنقل نوع إلى فئة أخرى استخدم\n`ticket_types.update` مع `ticket_category_id` جديد.\n\n**المتطلبات:** `ticket_category_id` من `ticket_categories.list`، والأرقام من `ticket_types.list`.\n\n**الآثار الجانبية:** يُسجَّل كل نقل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه قرار تنظيمي على مستوى الشركة تتخذه الموارد البشرية داخل QHR.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The category's types, in the new order.","x-description-ar":"أنواع الفئة بالترتيب الجديد.","content":{"application/json":{"example":{"records":[{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"manager","default_priority":"medium","target_days":5,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}],"tickets_count":18,"deletable":false}]},"schema":{"$ref":"#/components/schemas/ticket_type_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The order is not valid.","x-description-ar":"الترتيب غير صحيح.","x-codes":[{"code":"validation_failed","meaning":"`ids` does not list every request type of the category exactly once.","x-meaning-ar":"`ids` لا يذكر كل أنواع طلبات الفئة مرة واحدة بالضبط.","x-fix":"Read `ticket_types.list` for the category and send every id once, in the new order.","x-fix-ar":"اقرأ `ticket_types.list` للفئة وأرسل كل رقم مرة واحدة بالترتيب الجديد."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The order must list every request type of the category exactly once","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ticket_category_id","ids"],"properties":{"ticket_category_id":{"type":"integer","description":"The category whose types are reordered.","x-description-ar":"الفئة التي يُعاد ترتيب أنواعها."},"ids":{"type":"array","items":{"type":"integer"},"description":"Every type id of the category, once, in the new order.","x-description-ar":"كل أرقام أنواع الفئة، مرة واحدة، بالترتيب الجديد."}}},"example":{"ticket_category_id":4,"ids":[13,12]}}},"required":true,"description":"The category and its new order."}}},"/ticket_types/{id}":{"get":{"summary":"Get a request type with its form","operationId":"ticket_types.show","tags":["Request settings"],"description":"Returns one request type: its names and description, its form (`form_fields`), its approval flow, the\ndepartment that handles it, default priority, target days, how many requests used it and whether it can\nbe deleted.\n\n**When to use:** before `ticket_types.update`, to read the current form (an update replaces the whole form).\n\n**Prerequisites:** the type's `id`, from `ticket_types.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض نوع طلب مع نموذجه","x-description-ar":"يعرض نوع طلب واحداً: اسميه ووصفه ونموذجه (`form_fields`) ومسار اعتماده والقسم المنفّذ له وأولويته\nالافتراضية وعدد أيامه المستهدف وعدد الطلبات التي استخدمته وهل يمكن حذفه.\n\n**متى تستخدمه:** قبل `ticket_types.update` لقراءة النموذج الحالي (فالتعديل يستبدل النموذج كاملاً).\n\n**المتطلبات:** رقم `id` النوع من `ticket_types.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_type_id"}],"responses":{"200":{"description":"The request type.","x-description-ar":"نوع الطلب.","content":{"application/json":{"example":{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"manager","default_priority":"medium","target_days":5,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}],"tickets_count":18,"deletable":false},"schema":{"$ref":"#/components/schemas/ticket_type"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Update a request type","operationId":"ticket_types.update","tags":["Request settings"],"description":"Changes the fields you send. `form_fields`, when sent, replaces the whole form, so send every field (read\nthem with `ticket_types.show`). A new `ticket_category_id` moves the type to the end of that category.\n`enabled: false` stops offering it in `ticket_catalog.list`.\n\n**What changes for requests:** only requests submitted from now on. A request copies the form, approval\nflow, department and target days when it is submitted, so requests already raised keep theirs.\n\n**Prerequisites:** the type's `id` from `ticket_types.list`; ids as in `ticket_types.create`.\n\n**Side effects:** recorded in the audit log. No one is notified.\n\n**Not offered to Claude:** it changes what every employee can ask for and who approves and handles it.","x-summary-ar":"تعديل نوع طلب","x-description-ar":"يغيّر الحقول التي ترسلها. إن أرسلت `form_fields` فإنه يستبدل النموذج كاملاً، فأرسل كل الحقول (اقرأها عبر\n`ticket_types.show`). و`ticket_category_id` جديد ينقل النوع إلى آخر تلك الفئة. و`enabled: false` يوقف\nعرضه في `ticket_catalog.list`.\n\n**ما الذي يتغير في الطلبات:** الطلبات التي تُقدَّم من الآن فقط. ينسخ الطلب النموذج ومسار الاعتماد والقسم\nوعدد الأيام لحظة تقديمه، فتحتفظ الطلبات السابقة بما كان لها.\n\n**المتطلبات:** رقم `id` النوع من `ticket_types.list`، والأرقام الأخرى كما في `ticket_types.create`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يُرسَل أي إشعار.\n\n**لا يُعرض على Claude:** لأنه يغيّر ما يستطيع كل موظف طلبه ومن يعتمده وينفّذه.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_type_id"}],"responses":{"200":{"description":"The request type.","x-description-ar":"نوع الطلب.","content":{"application/json":{"example":{"id":12,"ticket_category_id":4,"name_en":"New device","name_ar":"جهاز جديد","name":"New device","description_en":"Ask for a new laptop or monitor.","description_ar":"اطلب حاسباً محمولاً أو شاشة جديدة.","description":"Ask for a new laptop or monitor.","department":{"id":7,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","active_employee_count":5},"approval_flow":"none","default_priority":"medium","target_days":3,"position":0,"enabled":true,"form_fields":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","required":true,"width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"حاسب محمول"},{"key":"o_monitor","label_en":"Monitor","label_ar":"شاشة"}]},{"key":"f_reason","type":"long_text","label_en":"Reason","label_ar":"السبب","help_en":"What is wrong with the current one?","help_ar":"ما المشكلة في الجهاز الحالي؟","required":false,"width":12,"validation":{"max_length":500}}],"tickets_count":18,"deletable":false},"schema":{"$ref":"#/components/schemas/ticket_type"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request type is not valid.","x-description-ar":"بيانات نوع الطلب غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are not valid. `errors` names them; form problems are under `errors.form_fields`, keyed by the field's index in the form (`\"2\"`), with list-wide ones under `errors.form_fields.base`.","x-meaning-ar":"بعض الحقول غير صحيحة. يذكرها `errors`؛ ومشكلات النموذج تحت `errors.form_fields` مفهرسة برقم الحقل في النموذج (`\"2\"`)، والمشكلات العامة للقائمة تحت `errors.form_fields.base`.","x-fix":"Fix the fields named in `errors`, then send again.","x-fix-ar":"صحّح الحقول المذكورة في `errors` ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Target days must be greater than or equal to 1","code":"validation_failed","errors":{"target_days":["must be greater than or equal to 1"]}}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ticket_type_input"},"example":{"ticket_type":{"approval_flow":"none","target_days":3}}}},"required":true,"description":"The fields to change."}},"delete":{"summary":"Delete a request type","operationId":"ticket_types.delete","tags":["Request settings"],"description":"Deletes a request type. Refused once any request has used it (`deletable` is false); disable it instead.\n\n**When to use:** to remove a type created by mistake. To stop offering one that was used, use\n`ticket_types.update` with `enabled: false`.\n\n**Prerequisites:** the type's `id`, from `ticket_types.list`.\n\n**Side effects:** recorded in the audit log. Cannot be undone.\n\n**Not offered to Claude:** it is irreversible.","x-summary-ar":"حذف نوع طلب","x-description-ar":"يحذف نوع طلب. يُرفض متى استُخدم في أي طلب (`deletable` خطأ)؛ عطّله بدلاً من ذلك.\n\n**متى تستخدمه:** لحذف نوع أُنشئ بالخطأ. لإيقاف عرض نوع مستخدم استخدم `ticket_types.update` مع\n`enabled: false`.\n\n**المتطلبات:** رقم `id` النوع من `ticket_types.list`.\n\n**الآثار الجانبية:** يُسجَّل في سجل التدقيق. لا يمكن التراجع عنه.\n\n**لا يُعرض على Claude:** لأنه لا يمكن التراجع عنه.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_type_id"}],"responses":{"204":{"description":"Deleted.","x-description-ar":"حُذف."},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The request type is in use.","x-description-ar":"نوع الطلب مستخدم.","x-codes":[{"code":"validation_failed","meaning":"The request type has already been used by a request.","x-meaning-ar":"نوع الطلب استُخدم في طلب من قبل.","x-fix":"Disable it instead (`ticket_types.update` with `enabled: false`).","x-fix-ar":"عطّله بدلاً من ذلك (`ticket_types.update` مع `enabled: false`)."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request type has been used and can only be disabled","code":"validation_failed"}}}}}}},"/tickets":{"get":{"summary":"List my requests","operationId":"tickets.list","tags":["Requests"],"description":"Returns the requests the token's owner raised themself, in every status, most recently active first, with\ntheir status, priority, handling department, assignee, due date and what the owner may do on each now\n(`available_actions`).\n\n**When to use:** to answer \"what happened to my request?\" or to find a request's `id` for another operation.\nFor the counts only, `tickets.stat_cards` is lighter. Requests waiting on the owner's approval are in\n`ticket_approvals.list`, not here.\n\n**Prerequisites:** none. The type filter takes ids from `ticket_catalog.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض طلباتي","x-description-ar":"يعرض الطلبات التي قدّمها صاحب الرمز بنفسه بكل حالاتها، الأحدث نشاطاً أولاً، مع الحالة والأولوية والقسم\nالمعالج والمُسند إليه وتاريخ الاستحقاق وما يستطيع صاحب الرمز فعله على كل طلب الآن (`available_actions`).\n\n**متى تستخدمه:** للإجابة عن «ماذا حدث لطلبي؟» أو لمعرفة رقم `id` الطلب لاستخدامه في عملية أخرى. للأعداد فقط\n`tickets.stat_cards` أخف. الطلبات التي تنتظر موافقة صاحب الرمز موجودة في `ticket_approvals.list` لا هنا.\n\n**المتطلبات:** لا شيء. أرقام الأنواع للتصفية من `ticket_catalog.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ طلباً في الصفحة.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"in_review"},{"name":"q[ticket_type_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this request type (id from `ticket_catalog.list`).","x-description-ar":"نوع طلب محدد فقط (الرقم من `ticket_catalog.list`).","example":7},{"name":"q[reference_or_subject_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference or subject contains, e.g. `TKT-000123` or `laptop`.","x-description-ar":"المرجع أو العنوان يحتوي على، مثل `TKT-000123` أو `laptop`.","example":"laptop"},{"name":"q[created_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or after this day (company time zone).","x-description-ar":"قُدّم في هذا اليوم أو بعده (بتوقيت الشركة).","example":"2026-11-01"},{"name":"q[created_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or before this day (company time zone).","x-description-ar":"قُدّم في هذا اليوم أو قبله (بتوقيت الشركة).","example":"2026-11-30"},{"name":"overdue","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` keeps only requests past their due date that the department has not finished.","x-description-ar":"`true` يُبقي فقط الطلبات التي تجاوزت تاريخ استحقاقها ولم ينجزها القسم.","example":true},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc` (`created_at`, `due_on`, `priority`, `status`, `last_activity_at`). `last_activity_at desc` when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc` (`created_at` و`due_on` و`priority` و`status` و`last_activity_at`). الافتراضي `last_activity_at desc`.","example":"created_at desc"}],"responses":{"200":{"description":"A page of the owner's requests.","x-description-ar":"صفحة من طلبات صاحب الرمز.","content":{"application/json":{"example":{"records":[{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"]}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/ticket_page"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Submit a request","operationId":"tickets.create","tags":["Requests"],"description":"Raises a request, in the token owner's name, to the department that handles its type (a laptop from IT, a\nletter from HR…). Send the type, a subject, an optional description and the answers to the type's form in\n`answers`, keyed by each field's `key`.\n\n**What happens next:** the request copies its type's approval flow, priority and target days. With no\napproval it goes straight to the department queue (`open`); otherwise it waits for the owner's direct\nmanager (`pending_manager`), then HR if the flow says so (`pending_hr`). If the owner has no manager who can\napprove, the manager stage goes to HR. Once approved, the due date is the approval day + the type's target\ndays.\n\n**When to use:** when an employee asks for something from another department. Leave, overtime and\nattendance corrections have their own operations.\n\n**Prerequisites:** `ticket_type_id` and the form's fields (`key`, `type`, `required`, options) from\n`ticket_catalog.list`. Answer formats: text as a string, `number` as a number, `date` as `YYYY-MM-DD`,\n`date_range` as `{ \"from\", \"to\" }`, `select` as one option `key`, `multi_select` as a list of keys,\n`checkbox` as true/false, `employee` as an employee id. `file` fields cannot be filled here (this operation\ntakes JSON only), so a type with a required file field must be submitted in QHR.\n\n**Side effects:** the request gets the next `TKT-…` reference and a `submitted` entry in its activity log.\nWhoever acts next is notified in QHR and by email: the direct manager, HR, or the handling department's\nmembers when it opens straight away.","x-summary-ar":"تقديم طلب","x-description-ar":"يرفع طلباً باسم صاحب الرمز إلى القسم الذي يعالج نوعه (جهاز محمول من تقنية المعلومات، خطاب من الموارد\nالبشرية…). أرسل النوع والعنوان ووصفاً اختيارياً وإجابات نموذج النوع في `answers` بمفتاح كل حقل (`key`).\n\n**ما يحدث بعد ذلك:** ينسخ الطلب من نوعه مسار الموافقة والأولوية وعدد الأيام المستهدف. إن لم يحتج موافقة\nيدخل مباشرة قائمة القسم (`open`)، وإلا انتظر المدير المباشر لصاحب الرمز (`pending_manager`) ثم الموارد\nالبشرية إن كان المسار يتطلب ذلك (`pending_hr`). وإن لم يكن لصاحب الرمز مدير يستطيع الموافقة تنتقل مرحلة\nالمدير إلى الموارد البشرية. وبعد الاعتماد يكون تاريخ الاستحقاق يوم الاعتماد مضافاً إليه أيام النوع.\n\n**متى تستخدمه:** عندما يطلب موظف شيئاً من قسم آخر. للإجازات والعمل الإضافي وتصحيح الحضور عملياتها الخاصة.\n\n**المتطلبات:** `ticket_type_id` وحقول النموذج (`key` و`type` و`required` والخيارات) من\n`ticket_catalog.list`. صيغ الإجابات: النص كسلسلة نصية، و`number` كرقم، و`date` بالشكل `YYYY-MM-DD`،\nو`date_range` بالشكل `{ \"from\", \"to\" }`، و`select` بمفتاح خيار واحد، و`multi_select` بقائمة مفاتيح،\nو`checkbox` بقيمة true/false، و`employee` برقم موظف. لا يمكن تعبئة حقول `file` هنا (العملية تقبل JSON فقط)،\nفالنوع الذي فيه حقل ملف إلزامي يُقدَّم من QHR.\n\n**الآثار الجانبية:** يحصل الطلب على المرجع التالي `TKT-…` وعلى سجل `submitted` في سجل نشاطه. ويُشعَر من\nعليه الدور التالي داخل QHR وبالبريد: المدير المباشر، أو الموارد البشرية، أو أعضاء القسم المعالج إن فُتح\nالطلب مباشرة.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new request, with its details.","x-description-ar":"الطلب الجديد بتفاصيله.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"pending_manager","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":null,"overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["cancel"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":null,"assigned_at":null,"review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":null,"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required","errors":{"subject":["can't be blank"],"answers":{"laptop_model":["is required"]}}}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ticket_type_id","subject"],"properties":{"ticket_type_id":{"type":"integer","description":"Request type, from `ticket_catalog.list`.","x-description-ar":"نوع الطلب، من `ticket_catalog.list`."},"subject":{"type":"string","description":"Short subject, up to 120 characters.","x-description-ar":"عنوان قصير حتى ١٢٠ حرفاً.","maxLength":120},"description":{"type":"string","description":"Optional details, up to 5,000 characters.","x-description-ar":"تفاصيل اختيارية حتى ٥٠٠٠ حرف.","maxLength":5000},"answers":{"type":"object","description":"The form's answers, `{ \"\u003cfield key\u003e\": \u003cvalue\u003e }`; formats in the description. Unknown keys are ignored; a required field left out is refused.","x-description-ar":"إجابات النموذج بالشكل `{ \"\u003cfield key\u003e\": \u003cvalue\u003e }` وصيغها في الوصف. تُهمل المفاتيح غير المعروفة، ويُرفض ترك حقل إلزامي.","additionalProperties":true}}},"example":{"ticket_type_id":7,"subject":"New laptop for the audit team","description":"Two laptops for the new auditors joining on 1 December.","answers":{"f_device":"o_laptop","f_count":2}}}},"required":true,"description":"The request."}}},"/tickets/stat_cards":{"get":{"summary":"Count my requests by stage","operationId":"tickets.stat_cards","tags":["Requests"],"description":"Counts the requests the token's owner raised: `in_progress` (waiting for approval or with the department),\n`in_review` (done, waiting for the owner to confirm), `overdue` (past due and not finished) and `resolved`\n(closed). Rejected and cancelled requests are not counted.\n\n**When to use:** for a quick \"how many of my requests are still open / waiting for me?\". To see the requests\nthemselves, use `tickets.list`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"عدّ طلباتي حسب المرحلة","x-description-ar":"يعدّ الطلبات التي قدّمها صاحب الرمز: `in_progress` (بانتظار الموافقة أو لدى القسم) و`in_review` (أُنجزت\nوتنتظر تأكيد صاحب الرمز) و`overdue` (تجاوزت تاريخ الاستحقاق ولم تُنجز) و`resolved` (مغلقة). لا تُحسب\nالطلبات المرفوضة أو الملغاة.\n\n**متى تستخدمه:** لمعرفة سريعة «كم طلباً لي ما زال مفتوحاً أو ينتظرني؟». لعرض الطلبات نفسها استخدم\n`tickets.list`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"The four counts.","x-description-ar":"الأعداد الأربعة.","content":{"application/json":{"example":{"in_progress":2,"in_review":1,"overdue":0,"resolved":5},"schema":{"type":"object","properties":{"in_progress":{"type":"integer","description":"Waiting for approval, open, assigned or being worked on.","x-description-ar":"بانتظار الموافقة أو مفتوحة أو مُسندة أو قيد التنفيذ."},"in_review":{"type":"integer","description":"Done by the department, waiting for the owner to confirm.","x-description-ar":"أنجزها القسم وتنتظر تأكيد صاحب الرمز."},"overdue":{"type":"integer","description":"Past their due date and not finished.","x-description-ar":"تجاوزت تاريخ استحقاقها ولم تُنجز."},"resolved":{"type":"integer","description":"Closed.","x-description-ar":"مغلقة."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/tickets/{id}":{"get":{"summary":"Get a request's details","operationId":"tickets.show","tags":["Requests"],"description":"Returns one request with everything on its details page: the subject, description and form answers as\nsubmitted, who approved it and when, the department and assignee, due and auto-close dates, a progress\ntracker, and what the token's owner may do on it now (`available_actions`, `can_comment`).\n\n**Who sees a request:** its requester, its assignee, the requester's direct manager while it waits for\nthem, members of the handling department once it is approved, and HR (Requests › manage) — any other id\nanswers 404.\n\n**When to use:** to answer questions about one request, or before a member action to check\n`available_actions`. For its history use `tickets.events`; for the messages, `ticket_comments.list`.\n\n**Prerequisites:** the request's `id`, from `tickets.list` or `ticket_approvals.list`.\n\n**Side effects:** none.","x-summary-ar":"عرض تفاصيل طلب","x-description-ar":"يعرض طلباً واحداً بكل ما في صفحة تفاصيله: العنوان والوصف وإجابات النموذج كما قُدّمت، ومن وافق عليه ومتى،\nوالقسم والمُسند إليه، وتاريخ الاستحقاق وتاريخ الإغلاق التلقائي، وشريط التقدم، وما يستطيع صاحب الرمز فعله\nعليه الآن (`available_actions` و`can_comment`).\n\n**من يرى الطلب:** مقدّمه، والمُسند إليه، والمدير المباشر لمقدّمه ما دام ينتظر قراره، وأعضاء القسم المعالج\nبعد اعتماده، والموارد البشرية (الطلبات › الإدارة) — وأي رقم آخر يُرجع 404.\n\n**متى تستخدمه:** للإجابة عن أسئلة تخص طلباً بعينه، أو قبل أي إجراء عليه للتحقق من `available_actions`.\nلتاريخه استخدم `tickets.events`، وللرسائل `ticket_comments.list`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` أو `ticket_approvals.list`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request.","x-description-ar":"الطلب.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/tickets/{id}/accept":{"patch":{"summary":"Accept a request assigned to me","operationId":"tickets.accept","tags":["Requests"],"description":"The assignee accepts a request someone gave them: `assigned` → `in_progress`. Only the current assignee.\n\n**When to use:** when the owner agrees to work on a request assigned to them. To refuse it instead use\n`tickets.reject_work`; to pass it to someone else, `tickets.assign`.\n\n**Prerequisites:** the request's `id`, from the department's queue or `tickets.show` (`accept` in\n`available_actions`).\n\n**Side effects:** an `accepted` entry in the activity log. No notification.","x-summary-ar":"قبول طلب أُسند إليّ","x-description-ar":"يقبل المُسند إليه طلباً أعطاه إياه غيره: `assigned` ← `in_progress`. للمُسند إليه الحالي فقط.\n\n**متى تستخدمه:** عندما يوافق صاحب الرمز على العمل على طلب أُسند إليه. لرفضه استخدم `tickets.reject_work`،\nولتسليمه لغيره `tickets.assign`.\n\n**المتطلبات:** رقم `id` الطلب من قائمة القسم أو `tickets.show` (وجود `accept` في `available_actions`).\n\n**الآثار الجانبية:** سجل `accepted` في سجل النشاط. لا إشعار.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request, now in progress.","x-description-ar":"الطلب وقد أصبح قيد التنفيذ.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You can't do this on this request","code":"validation_failed"}}}}}}},"/tickets/{id}/approve":{"patch":{"summary":"Approve a request","operationId":"tickets.approve","tags":["Requests"],"description":"Approves a request at the stage it waits in. At the manager stage (`pending_manager`) only the requester's\ncurrent direct manager decides; at the HR stage (`pending_hr`) anyone with Requests › manage. Nobody approves\ntheir own request.\n\n**What happens:** a manager approval moves it to HR when the flow is \"manager then HR\", otherwise to the\ndepartment queue (`open`). Reaching `open` starts the clock: the due date becomes today + the type's target\ndays.\n\n**When to use:** when the owner agrees to a request waiting on them. To decide many at once, use\n`ticket_approvals.bulk_approve`.\n\n**Prerequisites:** the request's `id`, from `ticket_approvals.list` (which lists exactly what the owner may\ndecide).\n\n**Side effects:** an entry in the activity log. Notified in QHR and by email: HR when it moves to the HR\nstage; otherwise the requester (approved) and the handling department's members (new request in the queue).","x-summary-ar":"الموافقة على طلب","x-description-ar":"يوافق على طلب في المرحلة التي ينتظر فيها. في مرحلة المدير (`pending_manager`) يقرر المدير المباشر الحالي\nلمقدّم الطلب وحده، وفي مرحلة الموارد البشرية (`pending_hr`) أي شخص لديه الطلبات › الإدارة. ولا يوافق أحد\nعلى طلبه هو.\n\n**ما يحدث:** موافقة المدير تنقل الطلب إلى الموارد البشرية إن كان المسار «المدير ثم الموارد البشرية»، وإلا\nإلى قائمة القسم (`open`). وعند الوصول إلى `open` يبدأ العد: يصبح تاريخ الاستحقاق اليوم مضافاً إليه أيام النوع.\n\n**متى تستخدمه:** عندما يوافق صاحب الرمز على طلب ينتظره. لاتخاذ القرار في عدة طلبات دفعة واحدة استخدم\n`ticket_approvals.bulk_approve`.\n\n**المتطلبات:** رقم `id` الطلب من `ticket_approvals.list` (التي تعرض بالضبط ما يستطيع صاحب الرمز البت فيه).\n\n**الآثار الجانبية:** سجل في سجل النشاط. ويُشعَر داخل QHR وبالبريد: الموارد البشرية إن انتقل إلى مرحلتها،\nوإلا مقدّم الطلب (تمت الموافقة) وأعضاء القسم المعالج (طلب جديد في القائمة).","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request after the approval.","x-description-ar":"الطلب بعد الموافقة.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"open","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["take","assign","cancel","priority","due_date"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":null,"review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You cannot approve or reject your own request","code":"validation_failed"}}}}}}},"/tickets/{id}/assign":{"patch":{"summary":"Assign a request to someone","operationId":"tickets.assign","tags":["Requests"],"description":"Gives a request to a member of its handling department. Allowed for a department member while it is `open`,\nfor its current assignee handing it over, and for HR at any time before review — never for the requester.\nFrom `open` it becomes `assigned` and waits for the new assignee to accept (`tickets.accept`); a request\nalready being worked on is handed over. Assigning an open request to yourself is the same as\n`tickets.take`.\n\n**When to use:** to give work to a colleague or pass on your own. The assignee must be an employed member of\nthe handling department other than the requester: take the id from `tickets.assignee_options`.\n\n**Prerequisites:** the request's `id`, from `tickets.show`; `assignee_id` from `tickets.assignee_options`.\n\n**Side effects:** an `assigned` / `reassigned` entry in the activity log; the requester and the new assignee\nare notified in QHR and by email. Someone who hands over a request they can no longer see gets back only its\n`id` and `status`.","x-summary-ar":"إسناد طلب إلى شخص","x-description-ar":"يعطي الطلب لعضو في القسم المعالج. يُسمح بذلك لعضو القسم ما دام الطلب `open`، وللمُسند إليه الحالي عند\nتسليمه لغيره، وللموارد البشرية في أي وقت قبل المراجعة — وليس لمقدّم الطلب أبداً. من `open` يصبح `assigned`\nوينتظر قبول المُسند إليه الجديد (`tickets.accept`)، والطلب الجاري العمل عليه يُسلَّم. وإسناد طلب مفتوح إلى\nنفسك هو نفسه `tickets.take`.\n\n**متى تستخدمه:** لإعطاء عمل لزميل أو تسليم عملك لغيرك. يجب أن يكون المُسند إليه موظفاً على رأس العمل في\nالقسم المعالج وألا يكون مقدّم الطلب: خذ رقمه من `tickets.assignee_options`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.show`، و`assignee_id` من `tickets.assignee_options`.\n\n**الآثار الجانبية:** سجل `assigned` / `reassigned` في سجل النشاط، ويُشعَر مقدّم الطلب والمُسند إليه الجديد\nداخل QHR وبالبريد. ومن يسلّم طلباً لم يعد يستطيع رؤيته يحصل على `id` و`status` فقط.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request, now assigned.","x-description-ar":"الطلب بعد إسناده.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"assigned","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":95,"name":"Khalid Nasser","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","cancel","priority","due_date"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose an active employee of the handling department","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["assignee_id"],"properties":{"assignee_id":{"type":"integer","description":"Employee id, from `tickets.assignee_options`.","x-description-ar":"رقم الموظف، من `tickets.assignee_options`."}}},"example":{"assignee_id":95}}},"required":true,"description":"Who gets it."}}},"/tickets/{id}/assignee_options":{"get":{"summary":"List who a request can be assigned to","operationId":"tickets.assignee_options","tags":["Requests"],"description":"Returns the people a request can be given to: the employed members of its handling department, by name,\nnever the requester. These are the only valid `assignee_id` values for `tickets.assign`.\n\n**When to use:** before `tickets.assign`, to turn a colleague's name into an id. Only someone who may assign\nor take the request (a department member while it is open, its current assignee handing it over, or HR)\ngets the list; anyone else gets 404.\n\n**Prerequisites:** the request's `id`, from `tickets.list` or `tickets.show`.\n\n**Side effects:** none.","x-summary-ar":"عرض من يمكن إسناد الطلب إليه","x-description-ar":"يعرض الأشخاص الذين يمكن إسناد الطلب إليهم: الموظفون على رأس العمل في القسم المعالج، مرتبين بالاسم، ولا\nيشمل مقدّم الطلب أبداً. هذه هي القيم الوحيدة المقبولة لـ `assignee_id` في `tickets.assign`.\n\n**متى تستخدمه:** قبل `tickets.assign` لتحويل اسم زميل إلى رقم. لا يحصل على القائمة إلا من يستطيع إسناد الطلب\nأو استلامه (عضو القسم ما دام الطلب مفتوحاً، أو المُسند إليه الحالي عند تسليمه لغيره، أو الموارد البشرية)،\nوغيرهم يحصل على 404.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` أو `tickets.show`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The people the request can be assigned to.","x-description-ar":"الأشخاص الذين يمكن إسناد الطلب إليهم.","content":{"application/json":{"example":{"records":[{"id":88,"name":"Omar Ali","department_name":"IT","label":"Omar Ali - IT"},{"id":95,"name":"Khalid Nasser","department_name":"IT","label":"Khalid Nasser - IT"}]},"schema":{"type":"object","properties":{"records":{"type":"array","description":"Members of the handling department, by name.","x-description-ar":"أعضاء القسم المعالج مرتبين بالاسم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id, for `assignee_id`.","x-description-ar":"رقم الموظف، لـ `assignee_id`."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"department_name":{"type":"string","description":"Department.","x-description-ar":"القسم."},"label":{"type":"string","description":"`\u003cname\u003e - \u003cdepartment\u003e`, ready to show.","x-description-ar":"`\u003cالاسم\u003e - \u003cالقسم\u003e` جاهز للعرض."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/tickets/{id}/cancel":{"patch":{"summary":"Cancel my request","operationId":"tickets.cancel","tags":["Requests"],"description":"The requester withdraws their own request, with an optional reason, any time before it reaches review\n(waiting for approval, open, assigned or in progress). It ends as `cancelled` and cannot be reopened. Only the\nrequester.\n\n**When to use:** when the owner no longer needs what they asked for. Once in review, use `tickets.close`\ninstead.\n\n**Prerequisites:** the request's `id`, from `tickets.list` (`cancel` in `available_actions`).\n\n**Side effects:** a `cancelled` entry in the activity log with the reason. No notification.","x-summary-ar":"إلغاء طلبي","x-description-ar":"يسحب مقدّم الطلب طلبه مع سبب اختياري في أي وقت قبل دخوله المراجعة (بانتظار الموافقة أو مفتوح أو مُسند أو\nقيد التنفيذ). ينتهي بالحالة `cancelled` ولا يمكن إعادة فتحه. لمقدّم الطلب فقط.\n\n**متى تستخدمه:** عندما لا يعود صاحب الرمز بحاجة إلى ما طلبه. بعد دخول المراجعة استخدم `tickets.close`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` (وجود `cancel` في `available_actions`).\n\n**الآثار الجانبية:** سجل `cancelled` في سجل النشاط مع السبب. لا إشعار.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The cancelled request.","x-description-ar":"الطلب الملغى.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"cancelled","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":[],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":"2026-11-27T08:00:00Z","manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":false,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You cannot cancel this request","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","description":"Reason, up to 500 characters.","x-description-ar":"السبب حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"reason":"Found a spare laptop in the office."}}},"required":true,"description":"Optional reason."}}},"/tickets/{id}/close":{"patch":{"summary":"Close a request","operationId":"tickets.close","tags":["Requests"],"description":"Closes a request for good. The requester closes their own request once it is in review, confirming the work\nis done. HR may close any unfinished request whose requester has left the company (`requester_active` is\nfalse). A closed request cannot be reopened and its conversation is locked.\n\n**When to use:** when the owner confirms their request was handled. To ask for more work use\n`tickets.send_back`; to withdraw a request that is not done yet, `tickets.cancel`.\n\n**Prerequisites:** the request's `id`, from `tickets.list` (`close` in `available_actions`).\n\n**Side effects:** a `closed` (or `closed_by_hr`) entry in the activity log. No notification.","x-summary-ar":"إغلاق طلب","x-description-ar":"يغلق الطلب نهائياً. يغلق مقدّم الطلب طلبه بعد دخوله المراجعة مؤكداً إنجاز العمل. وتستطيع الموارد البشرية\nإغلاق أي طلب غير منتهٍ غادر مقدّمه الشركة (`requester_active` خطأ). لا يمكن إعادة فتح الطلب المغلق وتُقفل\nمحادثته.\n\n**متى تستخدمه:** عندما يؤكد صاحب الرمز أن طلبه عولج. لطلب عمل إضافي استخدم `tickets.send_back`، ولسحب طلب لم\nيُنجز بعد `tickets.cancel`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` (وجود `close` في `available_actions`).\n\n**الآثار الجانبية:** سجل `closed` (أو `closed_by_hr`) في سجل النشاط. لا إشعار.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The closed request.","x-description-ar":"الطلب المغلق.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"closed","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":[],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":"2026-11-27T08:00:00Z","manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":false,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You can't do this on this request","code":"validation_failed"}}}}}}},"/tickets/{id}/due_date":{"patch":{"summary":"Change a request's due date","operationId":"tickets.due_date","tags":["Requests"],"description":"HR moves the due date of an approved, unfinished request, with a reason. The date cannot be before the day\nthe request was approved. In review, the auto-close date moves with it (the later of the due date and three\ndays after review started). Requests › manage only, and never on HR's own request.\n\n**When to use:** when the department needs more time, or HR wants it sooner. A request still waiting for\napproval has no due date yet.\n\n**Prerequisites:** the request's `id`, from `tickets.show`.\n\n**Side effects:** a `due_date_changed` entry (old and new date, reason) in the activity log. Moving the date\nto today or later lets the overdue reminder go out again if it becomes overdue.","x-summary-ar":"تغيير تاريخ استحقاق طلب","x-description-ar":"تغيّر الموارد البشرية تاريخ استحقاق طلب معتمد لم ينتهِ، مع ذكر السبب. لا يجوز أن يسبق التاريخ يوم اعتماد\nالطلب. وأثناء المراجعة يتغير تاريخ الإغلاق التلقائي معه (الأبعد بين تاريخ الاستحقاق وثلاثة أيام من بدء\nالمراجعة). لمن لديه الطلبات › الإدارة فقط، وليس على طلبه هو.\n\n**متى تستخدمه:** عندما يحتاج القسم وقتاً أطول أو تريد الموارد البشرية إنجازه أسرع. الطلب الذي ينتظر الموافقة\nليس له تاريخ استحقاق بعد.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.show`.\n\n**الآثار الجانبية:** سجل `due_date_changed` (التاريخ القديم والجديد والسبب) في سجل النشاط. ونقل التاريخ إلى\nاليوم أو بعده يسمح بإرسال تنبيه التأخر مجدداً إن تأخر الطلب.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request with its new due date.","x-description-ar":"الطلب بتاريخ استحقاقه الجديد.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-12-07","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"The due date cannot be before the request was opened","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["due_on","reason"],"properties":{"due_on":{"type":"string","description":"New due date, `YYYY-MM-DD`.","x-description-ar":"تاريخ الاستحقاق الجديد بالشكل `YYYY-MM-DD`.","format":"date"},"reason":{"type":"string","description":"Reason, up to 500 characters.","x-description-ar":"السبب حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"due_on":"2026-12-07","reason":"The supplier delivers on 6 December."}}},"required":true,"description":"The new date and why."}}},"/tickets/{id}/events":{"get":{"summary":"Show a request's activity log","operationId":"tickets.events","tags":["Requests"],"description":"Returns everything that happened to one request, newest first: submitted, approved or rejected (and by\nwhich stage), routed to HR, taken, assigned, accepted, sent for review, sent back, closed (by the\nrequester, by HR or automatically), cancelled, and priority or due-date changes, with who did it and the\ndetails (`reason`, old and new values, assignee).\n\n**When to use:** to answer \"who approved this?\", \"why was it rejected?\" or \"when was it reassigned?\". For\nthe request's current state use `tickets.show`.\n\n**Prerequisites:** the request's `id`, from `tickets.list`. Same visibility as `tickets.show`.\n\n**Side effects:** none.","x-summary-ar":"عرض سجل نشاط طلب","x-description-ar":"يعرض كل ما حدث لطلب واحد، الأحدث أولاً: التقديم، والموافقة أو الرفض (وفي أي مرحلة)، والتحويل إلى الموارد\nالبشرية، والاستلام، والإسناد، والقبول، والإرسال للمراجعة، والإعادة منها، والإغلاق (من مقدّم الطلب أو\nالموارد البشرية أو تلقائياً)، والإلغاء، وتغيير الأولوية أو تاريخ الاستحقاق — مع من قام به والتفاصيل\n(`reason` والقيم القديمة والجديدة والمُسند إليه).\n\n**متى تستخدمه:** للإجابة عن «من وافق على هذا؟» أو «لماذا رُفض؟» أو «متى أُعيد إسناده؟». لحالة الطلب الحالية\nاستخدم `tickets.show`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list`. الرؤية نفسها كما في `tickets.show`.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The activity log.","x-description-ar":"سجل النشاط.","content":{"application/json":{"example":{"records":[{"id":9004,"event":"assigned","data":{"assignee_id":88,"assignee_name":"Omar Ali","self":true},"actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"created_at":"2026-11-24T07:00:00Z"},{"id":9002,"event":"manager_approved","data":{},"actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"created_at":"2026-11-23T09:00:00Z"},{"id":9001,"event":"submitted","data":{},"actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"created_at":"2026-11-23T06:30:00Z"}]},"schema":{"$ref":"#/components/schemas/ticket_event_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}}},"/tickets/{id}/priority":{"patch":{"summary":"Change a request's priority","operationId":"tickets.priority","tags":["Requests"],"description":"HR changes the priority of a request that is not finished. Requests › manage only, and never on HR's own\nrequest.\n\n**When to use:** when HR decides something is more (or less) urgent than its type says. The due date is a\nseparate change: `tickets.due_date`.\n\n**Prerequisites:** the request's `id`, from `tickets.show`.\n\n**Side effects:** a `priority_changed` entry (old and new value) in the activity log. No notification.","x-summary-ar":"تغيير أولوية طلب","x-description-ar":"تغيّر الموارد البشرية أولوية طلب لم ينتهِ. لمن لديه الطلبات › الإدارة فقط، وليس على طلبه هو.\n\n**متى تستخدمه:** عندما تقرر الموارد البشرية أن الطلب أكثر (أو أقل) إلحاحاً مما يحدده نوعه. تاريخ الاستحقاق\nتغيير مستقل: `tickets.due_date`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.show`.\n\n**الآثار الجانبية:** سجل `priority_changed` (القيمة القديمة والجديدة) في سجل النشاط. لا إشعار.","x-access":"write","x-permission":{"key":"ticket/manage","label":"Configure request categories and types, see all requests, approve as HR, change priority and due date","x-label-ar":"إعداد فئات وأنواع الطلبات، وعرض جميع الطلبات، والموافقة كموارد بشرية، وتغيير الأولوية وتاريخ الاستحقاق"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request with its new priority.","x-description-ar":"الطلب بأولويته الجديدة.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"high","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Choose a valid priority","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["priority"],"properties":{"priority":{"type":"string","description":"`low`, `medium`, `high` or `highest`.","x-description-ar":"`low` منخفضة، `medium` متوسطة، `high` عالية، `highest` قصوى.","enum":["low","medium","high","highest"]}}},"example":{"priority":"high"}}},"required":true,"description":"The new priority."}}},"/tickets/{id}/reject":{"patch":{"summary":"Reject a request","operationId":"tickets.reject","tags":["Requests"],"description":"Rejects a request at the stage it waits in, with a reason the requester will read. Same deciders as\n`tickets.approve`: the requester's direct manager at the manager stage, HR at the HR stage, never the\nrequester. The request ends as `rejected`; it cannot be reopened.\n\n**When to use:** when the owner refuses a request waiting on them. Several at once:\n`ticket_approvals.bulk_reject`. A department member refusing work after approval uses `tickets.reject_work`.\n\n**Prerequisites:** the request's `id`, from `ticket_approvals.list`.\n\n**Side effects:** an entry in the activity log with the reason; the requester is notified in QHR and by email\nwith the reason.","x-summary-ar":"رفض طلب","x-description-ar":"يرفض طلباً في المرحلة التي ينتظر فيها مع سبب يقرؤه مقدّم الطلب. أصحاب القرار هم أنفسهم في\n`tickets.approve`: المدير المباشر لمقدّم الطلب في مرحلة المدير، والموارد البشرية في مرحلتها، وليس مقدّم\nالطلب أبداً. ينتهي الطلب بالحالة `rejected` ولا يمكن إعادة فتحه.\n\n**متى تستخدمه:** عندما يرفض صاحب الرمز طلباً ينتظره. لعدة طلبات دفعة واحدة: `ticket_approvals.bulk_reject`.\nأما عضو القسم الذي يرفض العمل بعد الاعتماد فيستخدم `tickets.reject_work`.\n\n**المتطلبات:** رقم `id` الطلب من `ticket_approvals.list`.\n\n**الآثار الجانبية:** سجل في سجل النشاط مع السبب، ويُشعَر مقدّم الطلب داخل QHR وبالبريد مع السبب.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The rejected request.","x-description-ar":"الطلب المرفوض.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"rejected","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":null,"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":[],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A reason is required","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","description":"Reason, up to 500 characters.","x-description-ar":"السبب حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"reason":"Laptops are replaced every three years; yours is from 2025."}}},"required":true,"description":"Why."}}},"/tickets/{id}/reject_work":{"patch":{"summary":"Reject a request as its assignee","operationId":"tickets.reject_work","tags":["Requests"],"description":"The assignee refuses the work, with a reason the requester will read: an `assigned` or `in_progress` request\nends as `rejected` and cannot be reopened. Only the current assignee.\n\n**When to use:** when the department cannot or will not do what was asked (out of scope, not possible). To\nhand it to a colleague instead use `tickets.assign`; an approver refusing before approval uses\n`tickets.reject`.\n\n**Prerequisites:** the request's `id`, from `tickets.show` (`reject_work` in `available_actions`).\n\n**Side effects:** a `rejected` entry in the activity log with the reason; the requester is notified in QHR and\nby email with the reason.","x-summary-ar":"رفض طلب بصفتي المُسند إليه","x-description-ar":"يرفض المُسند إليه العمل مع سبب يقرؤه مقدّم الطلب: ينتهي الطلب `assigned` أو `in_progress` بالحالة `rejected`\nولا يمكن إعادة فتحه. للمُسند إليه الحالي فقط.\n\n**متى تستخدمه:** عندما لا يستطيع القسم تنفيذ المطلوب أو لا يقبله (خارج النطاق، غير ممكن). لتسليمه لزميل\nاستخدم `tickets.assign`، أما رفض صاحب القرار قبل الاعتماد فهو `tickets.reject`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.show` (وجود `reject_work` في `available_actions`).\n\n**الآثار الجانبية:** سجل `rejected` في سجل النشاط مع السبب، ويُشعَر مقدّم الطلب داخل QHR وبالبريد مع السبب.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The rejected request.","x-description-ar":"الطلب المرفوض.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"rejected","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":[],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"A reason is required","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","description":"Reason, up to 500 characters.","x-description-ar":"السبب حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"reason":"We do not supply personal phones; ask your manager about the phone allowance."}}},"required":true,"description":"Why."}}},"/tickets/{id}/send_back":{"patch":{"summary":"Send a request back from review","operationId":"tickets.send_back","tags":["Requests"],"description":"The requester is not satisfied with the work: `in_review` → `in_progress`, back to the same assignee, with a\ncomment saying what is missing (it is added to the conversation). If that assignee has left the company, the\nrequest goes back to the department queue (`open`) instead. Only the requester.\n\n**When to use:** when the owner's own request was marked done but is not. To accept the work use\n`tickets.close`.\n\n**Prerequisites:** the request's `id`, from `tickets.list` (`send_back` in `available_actions`).\n\n**Side effects:** the comment is posted, the auto-close date is cleared, and a `sent_back` entry is written;\nthe assignee is notified in QHR and by email (or HR and the department, when it returns to the queue).","x-summary-ar":"إعادة طلب من المراجعة","x-description-ar":"مقدّم الطلب غير راضٍ عن العمل: `in_review` ← `in_progress` ويعود إلى المُسند إليه نفسه، مع تعليق يوضح\nالناقص (يُضاف إلى المحادثة). وإن كان المُسند إليه قد غادر الشركة يعود الطلب إلى قائمة القسم (`open`). لمقدّم\nالطلب فقط.\n\n**متى تستخدمه:** عندما يُعلَن انتهاء طلب صاحب الرمز وهو لم ينتهِ فعلاً. لقبول العمل استخدم `tickets.close`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` (وجود `send_back` في `available_actions`).\n\n**الآثار الجانبية:** يُنشر التعليق، ويُلغى تاريخ الإغلاق التلقائي، ويُكتب سجل `sent_back`؛ ويُشعَر المُسند إليه\nداخل QHR وبالبريد (أو الموارد البشرية والقسم إن عاد إلى القائمة).","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request, back in progress.","x-description-ar":"الطلب وقد عاد قيد التنفيذ.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Add a comment to send the request back","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["comment"],"properties":{"comment":{"type":"string","description":"Comment for the assignee, up to 5,000 characters.","x-description-ar":"تعليق للمُسند إليه حتى ٥٠٠٠ حرف.","maxLength":5000}}},"example":{"comment":"Only one laptop arrived; we asked for two."}}},"required":true,"description":"What is missing."}}},"/tickets/{id}/send_for_review":{"patch":{"summary":"Send a request for review","operationId":"tickets.send_for_review","tags":["Requests"],"description":"The assignee marks the work done: `in_progress` → `in_review`. The requester then confirms with\n`tickets.close` or sends it back with `tickets.send_back`. If they do nothing, it closes by itself on\n`auto_close_on`: the later of the due date and three days from now.\n\n**When to use:** when the assignee has finished the work. Only the current assignee, on a request in\nprogress.\n\n**Prerequisites:** the request's `id`, from `tickets.show` (`send_for_review` in `available_actions`).\n\n**Side effects:** a `sent_for_review` entry in the activity log; the requester is notified in QHR and by email\nwith the auto-close date, and reminded the day before it closes.","x-summary-ar":"إرسال طلب للمراجعة","x-description-ar":"يعلن المُسند إليه انتهاء العمل: `in_progress` ← `in_review`. ثم يؤكد مقدّم الطلب عبر `tickets.close` أو\nيعيده عبر `tickets.send_back`. وإن لم يفعل شيئاً يُغلق تلقائياً في `auto_close_on`: الأبعد بين تاريخ\nالاستحقاق وثلاثة أيام من الآن.\n\n**متى تستخدمه:** عندما ينهي المُسند إليه العمل. للمُسند إليه الحالي فقط، على طلب قيد التنفيذ.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.show` (وجود `send_for_review` في `available_actions`).\n\n**الآثار الجانبية:** سجل `sent_for_review` في سجل النشاط، ويُشعَر مقدّم الطلب داخل QHR وبالبريد بتاريخ\nالإغلاق التلقائي، ويُذكَّر قبله بيوم.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request, now in review.","x-description-ar":"الطلب وقد أصبح قيد المراجعة.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_review","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["priority","due_date"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":"2026-11-26T10:00:00Z","auto_close_on":"2026-11-30","closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You can't do this on this request","code":"validation_failed"}}}}}}},"/tickets/{id}/take":{"patch":{"summary":"Take an open request","operationId":"tickets.take","tags":["Requests"],"description":"The token's owner takes an `open` request of their own department and starts working on it: it moves to\n`in_progress` with them as the assignee. Nobody takes their own request.\n\n**When to use:** when a department member says \"I'll handle this one\". To give it to a colleague use\n`tickets.assign`. If a colleague took it first, the answer is 422 \"already taken\".\n\n**Prerequisites:** the request's `id`, from the department's queue or `tickets.show` (`take` in\n`available_actions`).\n\n**Side effects:** an `assigned` entry in the activity log; the requester is notified in QHR and by email.","x-summary-ar":"استلام طلب مفتوح","x-description-ar":"يستلم صاحب الرمز طلباً `open` في قسمه ويبدأ العمل عليه: ينتقل إلى `in_progress` ويصبح هو المُسند إليه. ولا\nيستلم أحد طلبه هو.\n\n**متى تستخدمه:** عندما يقول عضو في القسم «سأتولى هذا الطلب». لإعطائه لزميل استخدم `tickets.assign`. وإن سبقه\nزميل إليه يكون الرد 422 «تم استلامه بالفعل».\n\n**المتطلبات:** رقم `id` الطلب من قائمة القسم أو `tickets.show` (وجود `take` في `available_actions`).\n\n**الآثار الجانبية:** سجل `assigned` في سجل النشاط، ويُشعَر مقدّم الطلب داخل QHR وبالبريد.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_id"}],"responses":{"200":{"description":"The request, now in progress with the owner.","x-description-ar":"الطلب وقد أصبح قيد التنفيذ لدى صاحب الرمز.","content":{"application/json":{"example":{"id":5012,"reference":"TKT-000123","subject":"New laptop for the audit team","status":"in_progress","priority":"medium","target_days":5,"type":{"id":7,"name_en":"Laptop request","name_ar":"طلب جهاز محمول","name":"Laptop request"},"category":{"id":2,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT","icon":"laptop","color":"blue"},"department":{"id":9,"name_en":"IT","name_ar":"تقنية المعلومات","name":"IT"},"requester":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"assignee":{"id":88,"name":"Omar Ali","department_name":"IT"},"due_on":"2026-11-30","overdue":false,"last_activity_at":"2026-11-25T08:15:00Z","created_at":"2026-11-23T06:30:00Z","available_actions":["assign","reject_work","send_for_review"],"description":"Two laptops for the new auditors joining on 1 December.","approval_flow":"manager","opened_at":"2026-11-23T09:00:00Z","assigned_at":"2026-11-24T07:00:00Z","review_started_at":null,"auto_close_on":null,"closed_at":null,"manager_approval":{"approver":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"acted_at":"2026-11-23T09:00:00Z"},"hr_approval":null,"answers":[{"key":"f_device","type":"select","label_en":"Device","label_ar":"الجهاز","label":"Device","width":6,"options":[{"key":"o_laptop","label_en":"Laptop","label_ar":"جهاز محمول"}],"value":"o_laptop"},{"key":"f_count","type":"number","label_en":"How many","label_ar":"العدد","label":"How many","width":6,"value":2}],"progress":[{"step":"submitted","state":"done","label":"Submitted","actor":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"at":"2026-11-23T06:30:00Z","note":null},{"step":"manager","state":"done","label":"Huda Saleh","actor":{"id":40,"name":"Huda Saleh","department_name":"Finance"},"at":"2026-11-23T09:00:00Z","note":null},{"step":"department","state":"current","label":"Department working on it","actor":{"id":88,"name":"Omar Ali","department_name":"IT"},"at":"2026-11-24T07:00:00Z","note":"IT"},{"step":"target","state":"pending","label":"Target resolution date","actor":null,"at":"2026-11-30","note":null}],"can_view_conversation":true,"can_comment":true,"requester_active":true},"schema":{"$ref":"#/components/schemas/ticket"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The action was refused.","x-description-ar":"رُفض الإجراء.","x-codes":[{"code":"validation_failed","meaning":"The action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). `error` says which.","x-meaning-ar":"لا يمكن تنفيذ الإجراء الآن: الطلب ليس في حالة يبدأ منها هذا الإجراء (أو سبقك أحد إليه)، أو صاحب الرمز ليس الشخص المخوّل به، أو قيمة ناقصة أو غير صحيحة (السبب، التعليق، المُسند إليه…). يوضح `error` السبب.","x-fix":"Read the request again with `tickets.show`, check `available_actions`, and send the missing value.","x-fix-ar":"أعد قراءة الطلب عبر `tickets.show` وتحقق من `available_actions` وأرسل القيمة الناقصة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This request has already been taken","code":"validation_failed"}}}}}}},"/tickets/{ticket_id}/comments":{"get":{"summary":"Read a request's conversation","operationId":"ticket_comments.list","tags":["Requests"],"description":"Returns the messages exchanged on one request between the requester, the assignee and HR, oldest first, with\ntheir author and attached files. A final request keeps its conversation readable.\n\n**Who may read:** the requester, the current assignee and HR (Requests › manage). Anyone else — an approver,\na department colleague — gets 404, as for a request they cannot see; `can_view_conversation` on\n`tickets.show` tells in advance.\n\n**When to use:** to answer \"what did IT say about my request?\" or before replying with\n`ticket_comments.create`. The status history is `tickets.events`.\n\n**Prerequisites:** the request's `id`, from `tickets.list` or `tickets.show`.\n\n**Side effects:** none. File links expire after a short time; read the conversation again for fresh ones.","x-summary-ar":"قراءة محادثة طلب","x-description-ar":"يعرض الرسائل المتبادلة على طلب واحد بين مقدّمه والمُسند إليه والموارد البشرية، الأقدم أولاً، مع كاتب كل رسالة\nوالملفات المرفقة. ويبقى بالإمكان قراءة محادثة الطلب المنتهي.\n\n**من يقرأ:** مقدّم الطلب والمُسند إليه الحالي والموارد البشرية (الطلبات › الإدارة). وغيرهم — صاحب الموافقة\nأو زميل في القسم — يحصل على 404 كأنه طلب لا يراه؛ ويوضح ذلك مسبقاً `can_view_conversation` في `tickets.show`.\n\n**متى تستخدمه:** للإجابة عن «ماذا قالت تقنية المعلومات عن طلبي؟» أو قبل الرد عبر `ticket_comments.create`.\nتاريخ الحالات في `tickets.events`.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` أو `tickets.show`.\n\n**الآثار الجانبية:** لا شيء. روابط الملفات تنتهي بعد مدة قصيرة؛ أعد قراءة المحادثة للحصول على روابط جديدة.","x-access":"read","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_comment_ticket_id"},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]},"description":"`desc` for newest first; oldest first when omitted.","x-description-ar":"`desc` للأحدث أولاً؛ الأقدم أولاً إن لم يُرسل.","example":"desc"}],"responses":{"200":{"description":"The conversation.","x-description-ar":"المحادثة.","content":{"application/json":{"example":{"records":[{"id":309,"body":"Any update on the laptops?","author":{"id":1203,"name":"Sara Ahmed","department_name":"Finance"},"files":[],"created_at":"2026-11-25T07:00:00Z"},{"id":310,"body":"The laptops are ordered; they arrive on Thursday.","author":{"id":88,"name":"Omar Ali","department_name":"IT"},"files":[],"created_at":"2026-11-25T08:15:00Z"}]},"schema":{"$ref":"#/components/schemas/ticket_comment_list"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The token's owner has no employee record.","x-description-ar":"صاحب الرمز ليس له سجل موظف.","x-codes":[{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}}},"post":{"summary":"Post a comment on a request","operationId":"ticket_comments.create","tags":["Requests"],"description":"Adds a message to a request's conversation in the token owner's name. Allowed to the requester, the current\nassignee and HR, until the request is final (closed, rejected or cancelled).\n\n**When to use:** to ask about progress, answer a question from the department, or add information. Text only\nhere: attaching files needs QHR. To send finished work back, use `tickets.send_back`, which posts its comment\nitself.\n\n**Prerequisites:** the request's `id`, from `tickets.list` or `tickets.show` (`can_comment` true).\n\n**Side effects:** the requester and the assignee (except the author) are notified in QHR and by email; the\nrequest's last activity moves to now.","x-summary-ar":"إضافة تعليق على طلب","x-description-ar":"يضيف رسالة إلى محادثة الطلب باسم صاحب الرمز. يُسمح بذلك لمقدّم الطلب والمُسند إليه الحالي والموارد البشرية\nما لم يصل الطلب إلى حالة نهائية (مغلق أو مرفوض أو ملغي).\n\n**متى تستخدمه:** للسؤال عن التقدم أو الرد على سؤال من القسم أو إضافة معلومة. نص فقط هنا، وإرفاق الملفات يحتاج\nQHR. ولإعادة عمل منجز استخدم `tickets.send_back` الذي ينشر تعليقه بنفسه.\n\n**المتطلبات:** رقم `id` الطلب من `tickets.list` أو `tickets.show` (قيمة `can_comment` صحيحة).\n\n**الآثار الجانبية:** يُشعَر مقدّم الطلب والمُسند إليه (عدا الكاتب) داخل QHR وبالبريد، ويصبح آخر نشاط على\nالطلب الآن.","x-access":"write","x-permission":{"key":"ticket/request","label":"Raise and follow requests; approve as direct manager; work requests of own department","x-label-ar":"تقديم الطلبات ومتابعتها، والموافقة كمدير مباشر، والعمل على طلبات القسم"},"x-feature":"ticket","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/ticket_comment_ticket_id"}],"responses":{"201":{"description":"The new comment.","x-description-ar":"التعليق الجديد.","content":{"application/json":{"example":{"id":310,"body":"The laptops are ordered; they arrive on Thursday.","author":{"id":88,"name":"Omar Ali","department_name":"IT"},"files":[],"created_at":"2026-11-25T08:15:00Z"},"schema":{"$ref":"#/components/schemas/ticket_comment"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The comment was refused.","x-description-ar":"رُفض التعليق.","x-codes":[{"code":"validation_failed","meaning":"The comment was refused: it is empty or longer than 5,000 characters, or the request is final (closed, rejected or cancelled) and its conversation is locked.","x-meaning-ar":"رُفض التعليق: فارغ أو أطول من ٥٠٠٠ حرف، أو الطلب في حالة نهائية (مغلق أو مرفوض أو ملغي) ومحادثته مقفلة.","x-fix":"Write a shorter, non-empty comment; a final request takes no more comments.","x-fix-ar":"اكتب تعليقاً غير فارغ وأقصر؛ والطلب المنتهي لا يقبل تعليقات جديدة."},{"code":"employee_required","meaning":"The token's owner is not linked to an employee in this company; requests are raised and handled by employees.","x-meaning-ar":"صاحب الرمز غير مرتبط بسجل موظف في هذه الشركة، والطلبات يقدّمها ويعالجها الموظفون.","x-fix":"Link the owner's login to their employee record in QHR, or use a token of a user who has one.","x-fix-ar":"اربط حساب صاحب الرمز بسجله الوظيفي في QHR، أو استخدم رمز مستخدم مرتبط بموظف."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string","description":"The message, up to 5,000 characters.","x-description-ar":"نص الرسالة حتى ٥٠٠٠ حرف.","maxLength":5000}}},"example":{"body":"The laptops are ordered; they arrive on Thursday."}}},"required":true,"description":"The message."}}},"/time_incidents":{"get":{"summary":"List time incidents for HR review","operationId":"time_incidents.list","tags":["Time incidents"],"description":"HR's queue: every employee's incidents in a period — those waiting on HR (`pending_hr`, including manager\nrecommendations to deduct) and those already decided (`deducted`, `ignored`) — newest date first, with the\nemployee, the attendance behind it, the employee's reason if they gave one, and whether a payroll run blocks\na decision. Incidents still waiting on a manager are left out (HR cannot decide them); see\n`time_incidents.awaiting_managers`. See the tag for how incidents arise and what deducting does.\n\n**When to use:** to work through what HR has to decide (`q[status_eq]=pending_hr`), to check how a day was\ndecided, or to find an incident's `id` for `time_incidents.decide`. The period is the current month unless\nyou send `from` / `to`.\n\n**Prerequisites:** none. Ids for `q[employee_id_eq]` come from `employees.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مخالفات الوقت لمراجعة الموارد البشرية","x-description-ar":"قائمة الموارد البشرية: مخالفات كل الموظفين في فترة — ما ينتظر الموارد البشرية (`pending_hr`، ومنها توصيات\nالمديرين بالخصم) وما صدر فيه القرار (`deducted` و`ignored`) — الأحدث تاريخاً أولاً، مع الموظف والحضور الذي\nنشأت منه وسبب الموظف إن ذكره، وهل يمنع مسير رواتب اتخاذ القرار. لا تشمل المخالفات التي ما زالت بانتظار المدير\n(لا تستطيع الموارد البشرية البت فيها)؛ انظر `time_incidents.awaiting_managers`. راجع وصف القسم لمعرفة كيف\nتنشأ المخالفات وماذا يعني الخصم.\n\n**متى تستخدمه:** لإنجاز ما على الموارد البشرية البت فيه (`q[status_eq]=pending_hr`)، أو لمعرفة القرار في يوم\nما، أو لمعرفة رقم `id` المخالفة لاستخدامه في `time_incidents.decide`. الفترة هي الشهر الحالي ما لم ترسل\n`from` و`to`.\n\n**المتطلبات:** لا شيء. أرقام `q[employee_id_eq]` من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ مخالفة في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_from"},{"$ref":"#/components/parameters/time_incident_to"},{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_hr","deducted","ignored"]},"description":"Only this status.","x-description-ar":"حالة محددة فقط.","example":"pending_hr"},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["absence","late","early_leave","short_hours","incomplete"]},"description":"Only this kind.","x-description-ar":"نوع محدد فقط.","example":"late"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee (id from `employees.list`).","x-description-ar":"موظف محدد فقط (الرقم من `employees.list`).","example":1203},{"name":"q[justified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents the employee explained.","x-description-ar":"`true`: المخالفات التي برّرها الموظف فقط.","example":true},{"name":"q[unjustified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents with no explanation.","x-description-ar":"`true`: المخالفات التي لا تبرير لها فقط.","example":true},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of incidents.","x-description-ar":"صفحة من المخالفات.","content":{"application/json":{"example":{"records":[{"id":5120,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","department":"Finance","date":"2026-08-12","kind":"late","minutes":35,"hours":0.58,"status":"pending_hr","deductible":true,"can_decide":true,"can_act":true,"lock_reason":null,"payroll_reference":null,"payroll_id":null,"deduct_escalates":false,"manager":{"id":88,"name":"Omar Ali"},"manager_acted_at":null,"manager_note":null,"decided_by":null,"decided_at":null,"note":null,"justification":{"reason":"Accident on the Eastern Ring Road; traffic was stopped for 40 minutes.","submitted_at":"2026-08-12T09:10:00Z","conflicted":false},"justification_window":{"open":true,"deadline":"2026-08-19","days_left":7},"attendance":{"record_id":90311,"status":"late","check_in_at":"2026-08-12T06:35:00Z","check_out_at":"2026-08-12T14:00:00Z","worked_hours":7.42},"attendance_profile":{"id":1,"name":"Head office","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/time_incident_page"}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"`from` or `to` is not a date in `YYYY-MM-DD` form.","x-meaning-ar":"`from` أو `to` ليس تاريخاً بالصيغة `YYYY-MM-DD`.","x-fix":"Send both dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/time_incidents/awaiting_managers":{"get":{"summary":"List time incidents still waiting on a manager","operationId":"time_incidents.awaiting_managers","tags":["Time incidents"],"description":"The incidents in a period that are still with the employee's manager (`pending_manager`), newest date first,\neach naming the manager who owes the decision (`manager`). HR can see them but not decide them: every row has\n`can_decide: false`. They reach HR only if the manager deducts on a `manager_and_hr` route, or if the\nmanager leaves or loses the permission.\n\n**When to use:** to see which managers have not reviewed their team's incidents and chase them, e.g. before\nrunning payroll. The period is the current month unless you send `from` / `to`.\n\n**Prerequisites:** none. Ids for `q[employee_id_eq]` come from `employees.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض مخالفات الوقت التي ما زالت بانتظار المدير","x-description-ar":"مخالفات الفترة التي ما زالت لدى مدير الموظف (`pending_manager`)، الأحدث تاريخاً أولاً، وفي كل منها المدير\nالمطلوب منه القرار (`manager`). تراها الموارد البشرية لكنها لا تبت فيها: كل صف `can_decide: false`. ولا تصل\nإلى الموارد البشرية إلا إذا خصمها المدير في مسار `manager_and_hr`، أو غادر المدير أو فقد الصلاحية.\n\n**متى تستخدمه:** لمعرفة المديرين الذين لم يراجعوا مخالفات فرقهم ومتابعتهم، مثلاً قبل تشغيل الرواتب. الفترة هي\nالشهر الحالي ما لم ترسل `from` و`to`.\n\n**المتطلبات:** لا شيء. أرقام `q[employee_id_eq]` من `employees.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ مخالفة في الصفحة.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_from"},{"$ref":"#/components/parameters/time_incident_to"},{"name":"q[kind_eq]","in":"query","required":false,"schema":{"type":"string","enum":["absence","late","early_leave","short_hours","incomplete"]},"description":"Only this kind.","x-description-ar":"نوع محدد فقط.","example":"late"},{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee (id from `employees.list`).","x-description-ar":"موظف محدد فقط (الرقم من `employees.list`).","example":1203},{"name":"q[justified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents the employee explained.","x-description-ar":"`true`: المخالفات التي برّرها الموظف فقط.","example":true},{"name":"q[unjustified]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only incidents with no explanation.","x-description-ar":"`true`: المخالفات التي لا تبرير لها فقط.","example":true},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"}],"responses":{"200":{"description":"A page of incidents waiting on managers.","x-description-ar":"صفحة من المخالفات بانتظار المديرين.","content":{"application/json":{"example":{"records":[{"id":5120,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","department":"Finance","date":"2026-08-12","kind":"late","minutes":35,"hours":0.58,"status":"pending_manager","deductible":true,"can_decide":false,"can_act":true,"lock_reason":null,"payroll_reference":null,"payroll_id":null,"deduct_escalates":false,"manager":{"id":88,"name":"Omar Ali"},"manager_acted_at":null,"manager_note":null,"decided_by":null,"decided_at":null,"note":null,"justification":null,"justification_window":{"open":true,"deadline":"2026-08-19","days_left":7},"attendance":{"record_id":90311,"status":"late","check_in_at":"2026-08-12T06:35:00Z","check_out_at":"2026-08-12T14:00:00Z","worked_hours":7.42},"attendance_profile":{"id":1,"name":"Head office","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"$ref":"#/components/schemas/time_incident_page"}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"`from` or `to` is not a date in `YYYY-MM-DD` form.","x-meaning-ar":"`from` أو `to` ليس تاريخاً بالصيغة `YYYY-MM-DD`.","x-fix":"Send both dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/time_incidents/bulk_decide":{"patch":{"summary":"Deduct or ignore several time incidents at once","operationId":"time_incidents.bulk_decide","tags":["Time incidents"],"description":"Applies one decision (`deducted` or `ignored`) and one note to up to 200 incidents. Each id is decided on its\nown, with exactly the rules of `time_incidents.decide`, so some may succeed while others fail: the answer\nlists the ids decided in `succeeded` and the others in `failed` with the reason. An id that does not exist\nor is not yours to decide fails with the same \"not the approver\" reason.\n\n**When to use:** to clear a reviewed queue, e.g. ignore every late arrival on a day the whole office was\nheld up. For one incident, use `time_incidents.decide`.\n\n**Prerequisites:** ids from `time_incidents.list` or `time_incidents.team_list`. The token's owner must be\nlinked to an employee record.\n\n**Side effects:** as `time_incidents.decide`, for every id that succeeds: deductions lower pay in the payroll\nrun covering their dates, and no decision can be undone. Recorded in the audit log. Not offered to Claude:\nit changes many employees' pay in one irreversible call.","x-summary-ar":"خصم عدة مخالفات وقت أو التجاوز عنها دفعة واحدة","x-description-ar":"يطبّق قراراً واحداً (`deducted` أو `ignored`) وملاحظة واحدة على ما يصل إلى ٢٠٠ مخالفة. يُبتّ في كل رقم وحده\nبقواعد `time_incidents.decide` نفسها، فقد ينجح بعضها ويفشل بعضها: يذكر الرد الأرقام التي صدر فيها القرار في\n`succeeded` والأخرى في `failed` مع السبب. الرقم غير الموجود أو الذي لا يحق لك البت فيه يفشل بسبب «لست المعتمد»\nنفسه.\n\n**متى تستخدمه:** لإنهاء قائمة تمت مراجعتها، مثلاً التجاوز عن كل التأخيرات في يوم تعطّل فيه وصول المكتب كله.\nلمخالفة واحدة استخدم `time_incidents.decide`.\n\n**المتطلبات:** الأرقام من `time_incidents.list` أو `time_incidents.team_list`. ويجب أن يكون صاحب الرمز مرتبطاً\nبسجل وظيفي.\n\n**الآثار الجانبية:** كما في `time_incidents.decide` لكل رقم ينجح: الخصومات تخفّض الراتب في مسير الرواتب الذي\nيغطي تواريخها، ولا يمكن التراجع عن أي قرار. يُسجَّل في سجل التدقيق. لا تُعرض على Claude لأنها تغيّر رواتب عدد\nكبير من الموظفين في استدعاء واحد لا رجعة فيه.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"200":{"description":"Which ids were decided and which were not.","x-description-ar":"الأرقام التي صدر فيها القرار والتي لم يصدر.","content":{"application/json":{"example":{"succeeded":[5120,5121],"failed":[{"id":5126,"error":"This incident has already been decided and cannot be changed."}]},"schema":{"type":"object","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids decided.","x-description-ar":"الأرقام التي صدر فيها القرار.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids not decided, each with `error`.","x-description-ar":"الأرقام التي لم يصدر فيها القرار، مع `error`.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Incident id.","x-description-ar":"رقم المخالفة."},"error":{"type":"string","description":"Why.","x-description-ar":"السبب."}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The request was refused.","x-description-ar":"رُفض الطلب.","x-codes":[{"code":"validation_failed","meaning":"More than 200 ids were sent.","x-meaning-ar":"أُرسل أكثر من ٢٠٠ رقم.","x-fix":"Split the ids into calls of 200 or fewer.","x-fix-ar":"قسّم الأرقام على استدعاءات من ٢٠٠ أو أقل."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company. A decision records who made it, and a manager's queue is their own direct reports, so both need one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. القرار يُسجَّل باسم من اتخذه، وقائمة المدير هي مرؤوسوه المباشرون، فكلاهما يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["ids","status"],"properties":{"ids":{"type":"array","description":"Incident ids, at most 200.","x-description-ar":"أرقام المخالفات، ٢٠٠ كحد أقصى.","items":{"type":"integer"},"maxItems":200},"status":{"type":"string","description":"`deducted` or `ignored`, applied to every id.","x-description-ar":"`deducted` أو `ignored`، يُطبَّق على كل رقم.","enum":["deducted","ignored"]},"note":{"type":"string","description":"One note for every decision, up to 500 characters.","x-description-ar":"ملاحظة واحدة لكل القرارات، حتى ٥٠٠ حرف.","maxLength":500}}},"example":{"ids":[5120,5121,5126],"status":"ignored","note":"Metro outage on 12 August."}}},"required":true,"description":"The incidents and the decision."}}},"/time_incidents/stat_cards":{"get":{"summary":"Summarise time incidents for HR","operationId":"time_incidents.stat_cards","tags":["Time incidents"],"description":"Company-wide figures for a period: how many incidents wait on HR (`pending`) and how many were deducted, each\nwith their absence hours and undertime hours (late, early leave and short hours); how many were ignored; how\nmany still sit with managers (`pending_on_managers`, not counted in `pending`); how many undecided\n`incomplete` days need their attendance fixed first; and how many employees had any incident.\n\n**When to use:** for \"how much did we deduct this month?\" or \"how much is left to review before payroll?\".\nThe period is the current month unless you send `from` / `to`.\n\n**Prerequisites:** none.\n\n**Side effects:** none.","x-summary-ar":"ملخص مخالفات الوقت للموارد البشرية","x-description-ar":"أرقام الشركة لفترة: عدد المخالفات بانتظار الموارد البشرية (`pending`) وعدد المخصومة، ولكل منهما ساعات الغياب\nوساعات نقص الوقت (التأخر والانصراف المبكر ونقص الساعات)؛ وعدد المتجاوز عنها؛ وعدد ما زال لدى المديرين\n(`pending_on_managers`، غير محسوب في `pending`)؛ وعدد الأيام `incomplete` غير المبتوت فيها التي يجب تصحيح\nحضورها أولاً؛ وعدد الموظفين الذين لديهم أي مخالفة.\n\n**متى تستخدمه:** للإجابة عن \"كم خصمنا هذا الشهر؟\" أو \"كم بقي للمراجعة قبل الرواتب؟\". الفترة هي الشهر الحالي ما\nلم ترسل `from` و`to`.\n\n**المتطلبات:** لا شيء.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"attendance/view_reports","label":"View attendance reports","x-label-ar":"عرض تقارير الحضور"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_from"},{"$ref":"#/components/parameters/time_incident_to"}],"responses":{"200":{"description":"The period's figures.","x-description-ar":"أرقام الفترة.","content":{"application/json":{"example":{"period":{"from":"2026-08-01","to":"2026-08-31"},"pending":{"count":6,"absence_hours":16.0,"undertime_hours":3.25},"deducted":{"count":11,"absence_hours":24.0,"undertime_hours":5.5},"ignored":{"count":4},"pending_on_managers":3,"incomplete_needs_fixing":1,"employees_affected":14},"schema":{"type":"object","required":["period","pending","deducted","ignored","pending_on_managers","incomplete_needs_fixing","employees_affected"],"properties":{"period":{"type":"object","description":"The period counted.","x-description-ar":"الفترة المحسوبة.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"}}},"pending":{"type":"object","description":"Waiting on HR.","x-description-ar":"بانتظار الموارد البشرية.","properties":{"count":{"type":"integer","description":"Incidents.","x-description-ar":"عدد المخالفات."},"absence_hours":{"type":"number","description":"Hours of absence.","x-description-ar":"ساعات الغياب."},"undertime_hours":{"type":"number","description":"Hours late, left early or short.","x-description-ar":"ساعات التأخر والانصراف المبكر ونقص الساعات."}}},"deducted":{"type":"object","description":"Deducted.","x-description-ar":"المخصومة.","properties":{"count":{"type":"integer","description":"Incidents.","x-description-ar":"عدد المخالفات."},"absence_hours":{"type":"number","description":"Hours of absence.","x-description-ar":"ساعات الغياب."},"undertime_hours":{"type":"number","description":"Hours late, left early or short.","x-description-ar":"ساعات التأخر والانصراف المبكر ونقص الساعات."}}},"ignored":{"type":"object","description":"Ignored.","x-description-ar":"المتجاوز عنها.","properties":{"count":{"type":"integer","description":"Incidents.","x-description-ar":"عدد المخالفات."}}},"pending_on_managers":{"type":"integer","description":"Still waiting on a manager.","x-description-ar":"ما زالت بانتظار المدير."},"incomplete_needs_fixing":{"type":"integer","description":"Undecided `incomplete` days.","x-description-ar":"أيام `incomplete` لم يُبتّ فيها."},"employees_affected":{"type":"integer","description":"Employees with at least one incident, any status.","x-description-ar":"الموظفون الذين لديهم مخالفة واحدة على الأقل بأي حالة."}}}}}},"400":{"description":"The period is not valid.","x-description-ar":"الفترة غير صحيحة.","x-codes":[{"code":"bad_request","meaning":"`from` or `to` is not a date in `YYYY-MM-DD` form.","x-meaning-ar":"`from` أو `to` ليس تاريخاً بالصيغة `YYYY-MM-DD`.","x-fix":"Send both dates as `YYYY-MM-DD`.","x-fix-ar":"أرسل التاريخين بالصيغة `YYYY-MM-DD`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"invalid date","code":"bad_request"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/time_incidents/{id}/decide":{"patch":{"summary":"Deduct or ignore a time incident","operationId":"time_incidents.decide","tags":["Time incidents"],"description":"Records the decision on one incident: `deducted` (take the time off pay) or `ignored` (let it go), with an\noptional note. The same operation serves the employee's manager and HR; QHR checks who may act at the\nincident's stage: at `pending_manager` only the employee's direct manager, at `pending_hr` only HR (a role\nwith \"View attendance reports\").\n\nWhat happens next depends on the stage. A manager's `ignored` is final. A manager's `deducted` is final on\na `manager` route, but on a `manager_and_hr` route it is a recommendation: the incident moves to\n`pending_hr` with the manager's note and HR makes the final call (`deduct_escalates` on the row tells you in\nadvance). HR's decision is always final. A decision can never be changed afterwards.\n\n**When to use:** when the token's owner has reviewed the day and the employee's reason. `incomplete` days\ncannot be deducted, only ignored; fix the attendance instead. To decide many at once, use\n`time_incidents.bulk_decide`.\n\n**Prerequisites:** the incident's `id` from `time_incidents.list` (HR) or `time_incidents.team_list`\n(manager), where `can_decide` and `can_act` must both be true. The token's owner must be linked to an\nemployee record.\n\n**Side effects:** a final `deducted` is included by the payroll run covering the date, which lowers that\nmonth's pay (absence or undertime minutes on the timesheet). The employee can no longer change or withdraw\ntheir reason. Recorded in the audit log. Not offered to Claude, because a deduction takes money off an\nemployee's salary and cannot be undone.","x-summary-ar":"خصم مخالفة وقت أو التجاوز عنها","x-description-ar":"يسجّل القرار في مخالفة واحدة: `deducted` (خصم الوقت من الراتب) أو `ignored` (التجاوز عنها)، مع ملاحظة اختيارية.\nالعملية نفسها للمدير والموارد البشرية، ويتحقق QHR ممن يحق له القرار في مرحلة المخالفة: في `pending_manager`\nالمدير المباشر للموظف فقط، وفي `pending_hr` الموارد البشرية فقط (دور لديه «عرض تقارير الحضور»).\n\nما يحدث بعد ذلك يعتمد على المرحلة. «التجاوز» من المدير نهائي. و«الخصم» من المدير نهائي في مسار `manager`، أما في\nمسار `manager_and_hr` فهو توصية: تنتقل المخالفة إلى `pending_hr` مع ملاحظة المدير وتتخذ الموارد البشرية القرار\nالنهائي (يخبرك `deduct_escalates` في الصف بذلك مسبقاً). قرار الموارد البشرية نهائي دائماً. ولا يمكن تغيير القرار\nبعد صدوره.\n\n**متى تستخدمه:** بعد أن يراجع صاحب الرمز اليوم وسبب الموظف. الأيام `incomplete` لا تُخصم، بل يُتجاوز عنها فقط؛\nصحّح الحضور بدلاً من ذلك. للبت في عدة مخالفات دفعة واحدة استخدم `time_incidents.bulk_decide`.\n\n**المتطلبات:** رقم `id` المخالفة من `time_incidents.list` (الموارد البشرية) أو `time_incidents.team_list`\n(المدير)، ويجب أن يكون `can_decide` و`can_act` صحيحين. ويجب أن يكون صاحب الرمز مرتبطاً بسجل وظيفي.\n\n**الآثار الجانبية:** الخصم النهائي `deducted` يُدرجه مسير الرواتب الذي يغطي التاريخ، فيخفّض راتب ذلك الشهر\n(دقائق غياب أو نقص وقت في سجل الدوام). ولا يعود بإمكان الموظف تغيير سببه أو سحبه. يُسجَّل في سجل التدقيق. لا\nتُعرض على Claude لأن الخصم يقتطع من راتب الموظف ولا يمكن التراجع عنه.","x-access":"write","x-permission":{"key":"attendance/view_team","label":"View team attendance","x-label-ar":"عرض حضور الفريق"},"x-feature":"attendance","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_id"}],"responses":{"200":{"description":"The incident after the decision, in `record`.","x-description-ar":"المخالفة بعد القرار، في `record`.","content":{"application/json":{"example":{"record":{"id":5120,"employee_id":1203,"employee_no":"E-0042","employee_name":"Sara Ahmed","department":"Finance","date":"2026-08-12","kind":"late","minutes":35,"hours":0.58,"status":"deducted","deductible":true,"can_decide":false,"can_act":true,"lock_reason":null,"payroll_reference":null,"payroll_id":null,"deduct_escalates":false,"manager":{"id":88,"name":"Omar Ali"},"manager_acted_at":null,"manager_note":null,"decided_by":{"id":77,"name":"Huda Saeed"},"decided_at":"2026-08-14T07:30:00Z","note":"Third late arrival this month without a reason.","justification":{"reason":"Accident on the Eastern Ring Road; traffic was stopped for 40 minutes.","submitted_at":"2026-08-12T09:10:00Z","conflicted":false},"justification_window":{"open":true,"deadline":"2026-08-19","days_left":7},"attendance":{"record_id":90311,"status":"late","check_in_at":"2026-08-12T06:35:00Z","check_out_at":"2026-08-12T14:00:00Z","worked_hours":7.42},"attendance_profile":{"id":1,"name":"Head office","daily_target_hours":8.0,"grace_period_minutes":15,"shift_start":"09:00","shift_end":"17:00","day_type":"working_day","flexible":false,"scheduled_hours":8.0}}},"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/time_incident_row"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The decision was refused.","x-description-ar":"رُفض القرار.","x-codes":[{"code":"validation_failed","meaning":"The decision cannot be recorded. `error` says why: `status` is not `deducted` or `ignored`; the incident was already decided; the token's owner is not the approver at its stage; a payroll run has paid it or covers its date past time verification; an `incomplete` day cannot be deducted; or the note is over 500 characters.","x-meaning-ar":"لا يمكن تسجيل القرار. يوضح `error` السبب: `status` ليست `deducted` أو `ignored`؛ أو صدر القرار من قبل؛ أو صاحب الرمز ليس المعتمد في مرحلتها؛ أو صرفها مسير رواتب أو يغطي تاريخها مسير تجاوز التحقق من الوقت؛ أو يوم `incomplete` لا يُخصم؛ أو الملاحظة أطول من ٥٠٠ حرف.","x-fix":"Read the incident again with `time_incidents.list`: act only when `can_decide` and `can_act` are true, ignore rather than deduct an `incomplete` day, and to change a locked period revert its payroll run first.","x-fix-ar":"اقرأ المخالفة مجدداً عبر `time_incidents.list`: اتخذ القرار فقط عندما يكون `can_decide` و`can_act` صحيحين، وتجاوز عن يوم `incomplete` بدل خصمه، ولتغيير فترة مقفلة تراجع عن مسير الرواتب أولاً."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company. A decision records who made it, and a manager's queue is their own direct reports, so both need one.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة. القرار يُسجَّل باسم من اتخذه، وقائمة المدير هي مرؤوسوه المباشرون، فكلاهما يحتاج سجلاً وظيفياً.","x-fix":"Use a token created by a user who is linked to an employee record.","x-fix-ar":"استخدم رمزاً أنشأه مستخدم مرتبط بسجل وظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","description":"`deducted` (deduct, or recommend deducting at the manager stage of a `manager_and_hr` route) or `ignored`.","x-description-ar":"`deducted` خصم (أو توصية بالخصم في مرحلة المدير بمسار `manager_and_hr`) أو `ignored` تجاوز.","enum":["deducted","ignored"]},"note":{"type":"string","description":"Why, up to 500 characters. Shown to the employee with the decision.","x-description-ar":"السبب، حتى ٥٠٠ حرف. يظهر للموظف مع القرار.","maxLength":500}}},"example":{"status":"deducted","note":"Third late arrival this month without a reason."}}},"required":true,"description":"The decision."}}},"/time_incidents/{id}/justification":{"put":{"summary":"Explain one of my time incidents","operationId":"time_incidents.submit_justification","tags":["Time incidents"],"description":"Attaches the token owner's reason to one of their own incidents (an absence, late arrival, early leave or\nshort day), or replaces the reason already there. The manager or HR sees it next to the incident when they\ndecide whether to deduct it from pay. Writing it does not decide anything: the incident stays pending.\n\n**When to use:** when an employee wants to explain a day (\"I was stuck in traffic\", \"I was at a client's\noffice\"). Allowed only while nobody has acted on the incident, before the deadline (the attendance profile's\ncorrection days after the incident date) and while no payroll run covers the day; the incident's\n`can_justify` says whether it is still possible, and `blocked_reason` why not.\n\n**Prerequisites:** the incident's `id`, from the employee's own attendance history. Only the token owner's\nown incidents can be explained; any other id answers 404.\n\n**Side effects:** the reason is stored with the time it was written and the incident's minutes at that\nmoment; if the attendance is later corrected, the deciders see it flagged `conflicted`. Sending it again\nreplaces the text. Recorded in the audit log. No notification is sent.","x-summary-ar":"تبرير إحدى مخالفات الوقت الخاصة بي","x-description-ar":"يرفق سبب صاحب الرمز بإحدى مخالفاته (غياب أو تأخر أو انصراف مبكر أو نقص ساعات)، أو يستبدل السبب الموجود. يراه\nالمدير أو الموارد البشرية بجوار المخالفة عند تقرير خصمها من الراتب. كتابة السبب لا تُصدر قراراً: تبقى المخالفة\nمعلّقة.\n\n**متى تستخدمه:** عندما يريد الموظف تبرير يوم (\"علقت في زحمة السير\"، \"كنت في مكتب عميل\"). مسموح فقط ما دام لم\nيتخذ أحد قراراً في المخالفة، وقبل انتهاء المهلة (أيام التصحيح في ملف الحضور بعد تاريخ المخالفة)، وما دام لم\nيغطِّ اليوم مسير رواتب؛ ويخبرك `can_justify` في المخالفة إن كان ذلك ما زال ممكناً، و`blocked_reason` لماذا لا.\n\n**المتطلبات:** رقم `id` المخالفة من سجل حضور الموظف نفسه. لا يمكن تبرير إلا مخالفات صاحب الرمز؛ وأي رقم آخر\nيُرجع 404.\n\n**الآثار الجانبية:** يُحفظ السبب مع وقت كتابته ودقائق المخالفة في تلك اللحظة؛ وإن صُحّح الحضور لاحقاً يراه أصحاب\nالقرار معلَّماً `conflicted`. إرساله مرة أخرى يستبدل النص. يُسجَّل في سجل التدقيق. لا يُرسل أي إشعار.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_id"}],"responses":{"200":{"description":"The incident with its reason, in `record`.","x-description-ar":"المخالفة مع سببها، في `record`.","content":{"application/json":{"example":{"record":{"id":5120,"kind":"late","minutes":35,"status":"pending","hours":0.58,"review":{"decision":null,"decided_by":null,"decided_at":null,"note":null},"justification":{"reason":"Accident on the Eastern Ring Road; traffic was stopped for 40 minutes.","submitted_at":"2026-08-12T09:10:00Z","conflicted":false},"can_justify":true,"blocked_reason":null,"justify_deadline":"2026-08-19","days_left":7}},"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/time_incident_own"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The reason was refused.","x-description-ar":"رُفض السبب.","x-codes":[{"code":"validation_failed","meaning":"The reason cannot be changed now. `blocked_reason` says why: `corrections_disabled` (the employee's attendance profile does not allow corrections), `window_expired` (past the deadline, the profile's correction days after the incident date), `already_decided` (a manager or HR has acted on it) or `payroll_locked` (a payroll run has paid it or covers its date). Without `blocked_reason`, the reason itself is not valid (blank, or over 500 characters).","x-meaning-ar":"لا يمكن تغيير السبب الآن. يوضح `blocked_reason` السبب: `corrections_disabled` (ملف حضور الموظف لا يسمح بالتصحيح)، أو `window_expired` (انتهت المهلة، وهي أيام التصحيح في الملف بعد تاريخ المخالفة)، أو `already_decided` (اتخذ مدير أو الموارد البشرية قراراً فيها)، أو `payroll_locked` (صرفها مسير رواتب أو يغطي تاريخها). وبدون `blocked_reason` يكون السبب نفسه غير صحيح (فارغ أو أطول من ٥٠٠ حرف).","x-fix":"With `blocked_reason` nothing can be done through the API; the employee can raise it with their manager or HR. Otherwise send a reason of 1 to 500 characters.","x-fix-ar":"مع `blocked_reason` لا يمكن فعل شيء عبر الواجهة؛ يمكن للموظف مراجعة مديره أو الموارد البشرية. وفي غير ذلك أرسل سبباً من ١ إلى ٥٠٠ حرف."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company, so has no incidents to explain.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة، فلا مخالفات له ليبررها.","x-fix":"Use a token created by the employee themselves.","x-fix-ar":"استخدم رمزاً أنشأه الموظف نفسه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","blocked_reason":"already_decided","code":"employee_required"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","description":"What happened that day, in the employee's words. 1 to 500 characters.","x-description-ar":"ما حدث في ذلك اليوم بكلمات الموظف. من ١ إلى ٥٠٠ حرف.","maxLength":500}}},"example":{"reason":"Accident on the Eastern Ring Road; traffic was stopped for 40 minutes."}}},"required":true,"description":"The reason."}},"delete":{"summary":"Withdraw my reason for a time incident","operationId":"time_incidents.withdraw_justification","tags":["Time incidents"],"description":"Deletes the reason the token's owner attached to one of their own incidents. The incident itself stays\npending, now with no explanation.\n\n**When to use:** when the employee no longer wants their explanation on file. To change the wording, send a\nnew one with `time_incidents.submit_justification` instead. Allowed under the same conditions as writing it:\nnobody has acted on the incident, the deadline has not passed and no payroll run covers the day.\n\n**Prerequisites:** the incident's `id`, from the employee's own attendance history. An incident that is not\nthe owner's, or that has no reason on file, answers 404.\n\n**Side effects:** the reason is deleted for good. Recorded in the audit log. Not offered to Claude: the text\ncannot be recovered, and the deciders then see the day unexplained.","x-summary-ar":"سحب تبريري لمخالفة وقت","x-description-ar":"يحذف السبب الذي أرفقه صاحب الرمز بإحدى مخالفاته. تبقى المخالفة نفسها معلّقة، دون تبرير الآن.\n\n**متى تستخدمه:** عندما لا يريد الموظف إبقاء تبريره. لتغيير الصياغة أرسل سبباً جديداً عبر\n`time_incidents.submit_justification` بدلاً من ذلك. مسموح بالشروط نفسها التي تسمح بكتابته: لم يتخذ أحد قراراً في\nالمخالفة، ولم تنتهِ المهلة، ولم يغطِّ اليوم مسير رواتب.\n\n**المتطلبات:** رقم `id` المخالفة من سجل حضور الموظف نفسه. المخالفة التي ليست لصاحب الرمز، أو التي لا سبب لها،\nتُرجع 404.\n\n**الآثار الجانبية:** يُحذف السبب نهائياً. يُسجَّل في سجل التدقيق. لا تُعرض على Claude: لا يمكن استرجاع النص، ويرى\nأصحاب القرار اليوم دون تبرير.","x-access":"write","x-permission":{"key":"attendance/view_own","label":"Check in/out and view own attendance history","x-label-ar":"تسجيل الحضور والانصراف وعرض سجل الحضور الخاص"},"x-feature":"attendance","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/time_incident_id"}],"responses":{"200":{"description":"The incident without a reason, in `record`.","x-description-ar":"المخالفة دون سبب، في `record`.","content":{"application/json":{"example":{"record":{"id":5120,"kind":"late","minutes":35,"status":"pending","hours":0.58,"review":{"decision":null,"decided_by":null,"decided_at":null,"note":null},"justification":null,"can_justify":true,"blocked_reason":null,"justify_deadline":"2026-08-19","days_left":7}},"schema":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/time_incident_own"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The reason cannot be withdrawn.","x-description-ar":"لا يمكن سحب السبب.","x-codes":[{"code":"validation_failed","meaning":"The reason cannot be changed now. `blocked_reason` says why: `corrections_disabled` (the employee's attendance profile does not allow corrections), `window_expired` (past the deadline, the profile's correction days after the incident date), `already_decided` (a manager or HR has acted on it) or `payroll_locked` (a payroll run has paid it or covers its date). Without `blocked_reason`, the reason itself is not valid (blank, or over 500 characters).","x-meaning-ar":"لا يمكن تغيير السبب الآن. يوضح `blocked_reason` السبب: `corrections_disabled` (ملف حضور الموظف لا يسمح بالتصحيح)، أو `window_expired` (انتهت المهلة، وهي أيام التصحيح في الملف بعد تاريخ المخالفة)، أو `already_decided` (اتخذ مدير أو الموارد البشرية قراراً فيها)، أو `payroll_locked` (صرفها مسير رواتب أو يغطي تاريخها). وبدون `blocked_reason` يكون السبب نفسه غير صحيح (فارغ أو أطول من ٥٠٠ حرف).","x-fix":"With `blocked_reason` nothing can be done through the API; the employee can raise it with their manager or HR. Otherwise send a reason of 1 to 500 characters.","x-fix-ar":"مع `blocked_reason` لا يمكن فعل شيء عبر الواجهة؛ يمكن للموظف مراجعة مديره أو الموارد البشرية. وفي غير ذلك أرسل سبباً من ١ إلى ٥٠٠ حرف."},{"code":"employee_required","meaning":"The token's owner has no employee record in this company, so has no incidents to explain.","x-meaning-ar":"صاحب الرمز ليس له سجل وظيفي في هذه الشركة، فلا مخالفات له ليبررها.","x-fix":"Use a token created by the employee themselves.","x-fix-ar":"استخدم رمزاً أنشأه الموظف نفسه."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This action is available to employees only. Your account is a system user with no linked employee profile.","blocked_reason":"already_decided","code":"employee_required"}}}}}}},"/users":{"get":{"summary":"List the company's users","operationId":"users.list","tags":["Users"],"description":"Returns everyone who can sign in to this company's QHR, or has been invited to: name, login email, role,\nand whether they are active or own the company. Deactivated users are included; filter with\n`q[is_active_eq]`. Newest QHR accounts first.\n\nA user is a login, not an HR record. Employees invited to QHR appear here too; people with no employee\nrecord (the owner, an outside accountant) are \"system users\" — `q[employee_id_null]=true` lists only them.\nTo list employees, use `employees.list`.\n\n**When to use:** to answer \"who has access to our QHR?\" or \"who are our admins?\", or to find a user's `id`\nfor `users.show`, `users.change_role`, `users.deactivate` or `users.activate`.\n\n**Prerequisites:** none. Role ids for the filter come from `roles.list`.\n\n**Side effects:** none. Up to 50 per page.","x-summary-ar":"عرض قائمة مستخدمي الشركة","x-description-ar":"يعرض كل من يستطيع الدخول إلى QHR في هذه الشركة أو دُعي إليه: الاسم وبريد الدخول والدور، وهل هو نشط أو\nمالك للشركة. يشمل المستخدمين الموقوفين؛ صفِّ بـ `q[is_active_eq]`. الأحدث حساباً في QHR أولاً.\n\nالمستخدم حساب دخول وليس سجلاً في الموارد البشرية. يظهر هنا الموظفون الذين دُعوا إلى QHR، ومن ليس له سجل\nوظيفي (مالك الشركة أو محاسب من خارجها) هو «مستخدم نظام»، ويعرضهم وحدهم `q[employee_id_null]=true`.\nلعرض الموظفين استخدم `employees.list`.\n\n**متى تستخدمه:** للإجابة عن \"من يستطيع الدخول إلى QHR لدينا؟\" أو \"من هم مسؤولو النظام؟\"، أو لمعرفة رقم\n`id` المستخدم المطلوب في `users.show` و`users.change_role` و`users.deactivate` و`users.activate`.\n\n**المتطلبات:** لا شيء. أرقام الأدوار للتصفية من `roles.list`.\n\n**الآثار الجانبية:** لا شيء. حتى ٥٠ في الصفحة.","x-access":"read","x-permission":{"key":"user/view","label":"View portal users","x-label-ar":"عرض مستخدمي البوابة"},"x-feature":"user","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/per_page"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Full name (first and last) contains.","x-description-ar":"الاسم الكامل (الأول والعائلة) يحتوي على.","example":"Khalid"},{"name":"q[email_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Login email contains.","x-description-ar":"بريد الدخول يحتوي على.","example":"@example.com"},{"name":"q[is_active_eq]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` for users who can sign in, `false` for deactivated ones.","x-description-ar":"`true` للمستخدمين القادرين على الدخول، و`false` للموقوفين.","example":true},{"name":"q[tenant_role_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only users with this role (id from `roles.list`).","x-description-ar":"المستخدمون الذين لهم هذا الدور فقط (الرقم من `roles.list`).","example":3},{"name":"q[employee_id_null]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` for system users only (no employee record), `false` for users who are also employees.","x-description-ar":"`true` لمستخدمي النظام فقط (بلا سجل وظيفي)، و`false` للمستخدمين الذين هم موظفون أيضاً.","example":true},{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`: `name`, `email`, or `created_at` (when added to the company). Newest accounts first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`: `name` أو `email` أو `created_at` (تاريخ إضافته إلى الشركة). الأحدث حساباً أولاً إن لم يُرسل.","example":"name asc"}],"responses":{"200":{"description":"A page of users.","x-description-ar":"صفحة من المستخدمين.","content":{"application/json":{"example":{"records":[{"id":51,"user_id":318,"email":"khalid.omar@example.com","full_name":"Khalid Omar","is_active":true,"is_owner":false,"role":{"id":3,"name":"Accountant"}}],"pagination":{"current_page":1,"per_page":20,"total_entries":1,"pages":1}},"schema":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/user_row"},"description":"The users on this page.","x-description-ar":"المستخدمون في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}},"post":{"summary":"Give a person access to QHR as a user","operationId":"users.create","tags":["Users"],"description":"Invites a person to sign in to this company's QHR with a role, without creating an employee record — a\n\"system user\", such as an outside accountant or an auditor. The user starts as `pending` and can sign in\nonce they accept the invitation.\n\n**When to use:** to give QHR access to someone who does not work for the company as an employee. To give\nan employee access, use `employee_invitations.invite` instead, so the login is linked to their HR record.\n\n**Prerequisites:** the role's id (`tenant_role_id`) from `roles.list`. The email must not be a member of\nthe company already (`users.list`) nor an employee's email (`employees.list`).\n\n**Side effects:** a QHR account is created for the email if it has none (an existing account, from another\ncompany, is reused), Qoyod Identity is asked to invite the email, and an invitation email is sent; it must\nbe accepted within 7 days. The user takes one of the plan's user seats at once, while pending too. Recorded\nin the audit log.\n\n**Not offered to Claude:** it grants access to the company's HR data, with any role up to Admin.","x-summary-ar":"منح شخص صلاحية الدخول إلى QHR كمستخدم","x-description-ar":"يدعو شخصاً إلى الدخول إلى QHR في هذه الشركة بدور محدد، دون إنشاء سجل وظيفي له — أي «مستخدم نظام»، مثل\nمحاسب من خارج الشركة أو مدقق. تبدأ حالته `pending`، ويستطيع الدخول بعد قبول الدعوة.\n\n**متى تستخدمه:** لمنح صلاحية الدخول إلى QHR لشخص لا يعمل في الشركة موظفاً. لمنحها لموظف، استخدم\n`employee_invitations.invite` بدلاً من ذلك ليرتبط حساب دخوله بسجله في الموارد البشرية.\n\n**المتطلبات:** رقم الدور (`tenant_role_id`) من `roles.list`. يجب ألا يكون البريد لعضو في الشركة\n(`users.list`) ولا لموظف (`employees.list`).\n\n**الآثار الجانبية:** يُنشأ حساب QHR للبريد إن لم يكن له حساب (ويُعاد استخدام الحساب الموجود من شركة أخرى)،\nويُطلب من Qoyod Identity دعوة البريد، وتُرسل رسالة دعوة يجب قبولها خلال ٧ أيام. يشغل المستخدم أحد مقاعد\nالمستخدمين في الباقة فوراً، حتى وهو بانتظار القبول. يُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه يمنح صلاحية الوصول إلى بيانات الموارد البشرية في الشركة، بأي دور حتى مسؤول النظام.","x-access":"write","x-permission":{"key":"user/create","label":"Create portal users","x-label-ar":"إنشاء مستخدمي البوابة"},"x-feature":"user","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"}],"responses":{"201":{"description":"The new user, pending until they accept.","x-description-ar":"المستخدم الجديد، بانتظار قبوله الدعوة.","content":{"application/json":{"example":{"user":{"id":51,"user_id":318,"email":"khalid.omar@example.com","full_name":"Khalid Omar","is_active":true,"is_owner":false,"role":{"id":3,"name":"Accountant"}},"message":"User account created and activation email sent."},"schema":{"type":"object","required":["user","message"],"properties":{"user":{"$ref":"#/components/schemas/user_row"},"message":{"type":"string","description":"Confirmation that the invitation was sent.","x-description-ar":"تأكيد إرسال الدعوة."}}}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"422":{"description":"The user cannot be added.","x-description-ar":"لا يمكن إضافة المستخدم.","x-codes":[{"code":"validation_failed","meaning":"One of: the plan's user seats are all taken; the role does not exist or is switched off; the email is already a member of the company, or belongs to an employee; the email or a name is missing or not valid; Qoyod Identity refused the invitation.","x-meaning-ar":"أحد الأسباب: مقاعد المستخدمين في الباقة كلها مشغولة؛ الدور غير موجود أو معطّل؛ البريد لعضو في الشركة أو لموظف؛ البريد أو أحد الاسمين ناقص أو غير صحيح؛ رفضت Qoyod Identity الدعوة.","x-fix":"Read `error`. Free a seat with `users.deactivate` or add seats to the plan; pick an active role from `roles.list`; for an employee, invite them from their employee record.","x-fix-ar":"اقرأ `error`. حرّر مقعداً عبر `users.deactivate` أو أضف مقاعد إلى الباقة؛ اختر دوراً مفعّلاً من `roles.list`؛ وللموظف ادعُه من سجله الوظيفي."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This user is already a member of this organization.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/user_create_input"},"example":{"user":{"email":"khalid.omar@example.com","first_name":"Khalid","last_name":"Omar","tenant_role_id":3}}}},"required":true,"description":"The person and their role."}}},"/users/stat_cards":{"get":{"summary":"Count users by status, kind and role","operationId":"users.stat_cards","tags":["Users"],"description":"Counts the users that `users.list` would return with the same `q[...]` filters: in total, active and\ndeactivated, system users (no employee record) and users who are employees, and how many hold each role.\n`by_role` lists every role, including roles nobody holds (count 0) and switched-off roles, in role id order.\n\n**When to use:** for \"how many people can sign in?\", \"how many admins do we have?\" or \"how many user seats\nare taken?\" (system users who are active take one seat each) — without paging through the list.\n\n**Prerequisites:** none. Send the same filters as `users.list` to count a subset.\n\n**Side effects:** none.","x-summary-ar":"عدّ المستخدمين حسب الحالة والنوع والدور","x-description-ar":"يعدّ المستخدمين الذين تعيدهم `users.list` بفلاتر `q[...]` نفسها: الإجمالي، والنشطين والموقوفين، ومستخدمي\nالنظام (بلا سجل وظيفي) والمستخدمين الموظفين، وعدد من يحمل كل دور. تضم `by_role` كل الأدوار، بما فيها\nالأدوار التي لا يحملها أحد (العدد 0) والأدوار المعطّلة، مرتبة برقم الدور.\n\n**متى تستخدمه:** للإجابة عن \"كم شخصاً يستطيع الدخول؟\" أو \"كم مسؤول نظام لدينا؟\" أو \"كم مقعد مستخدم\nمشغول؟\" (كل مستخدم نظام نشط يشغل مقعداً) دون تصفح القائمة صفحةً صفحة.\n\n**المتطلبات:** لا شيء. أرسل فلاتر `users.list` نفسها لعدّ جزء منهم.\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"user/view","label":"View portal users","x-label-ar":"عرض مستخدمي البوابة"},"x-feature":"user","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Full name (first and last) contains.","x-description-ar":"الاسم الكامل (الأول والعائلة) يحتوي على.","example":"Khalid"},{"name":"q[email_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Login email contains.","x-description-ar":"بريد الدخول يحتوي على.","example":"@example.com"},{"name":"q[is_active_eq]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` for users who can sign in, `false` for deactivated ones.","x-description-ar":"`true` للمستخدمين القادرين على الدخول، و`false` للموقوفين.","example":true},{"name":"q[tenant_role_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only users with this role (id from `roles.list`).","x-description-ar":"المستخدمون الذين لهم هذا الدور فقط (الرقم من `roles.list`).","example":3},{"name":"q[employee_id_null]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` for system users only (no employee record), `false` for users who are also employees.","x-description-ar":"`true` لمستخدمي النظام فقط (بلا سجل وظيفي)، و`false` للمستخدمين الذين هم موظفون أيضاً.","example":true}],"responses":{"200":{"description":"The counts.","x-description-ar":"الأعداد.","content":{"application/json":{"example":{"data":{"total":14,"active":12,"inactive":2,"system_users":3,"employee_users":11,"by_role":[{"id":1,"name":"Admin","count":2},{"id":2,"name":"Employee","count":9},{"id":3,"name":"Accountant","count":3}]}},"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The counts, over the filtered users.","x-description-ar":"الأعداد، على المستخدمين بعد التصفية.","required":["total","active","inactive","system_users","employee_users","by_role"],"properties":{"total":{"type":"integer","description":"All users.","x-description-ar":"كل المستخدمين."},"active":{"type":"integer","description":"Users who can sign in.","x-description-ar":"المستخدمون القادرون على الدخول."},"inactive":{"type":"integer","description":"Deactivated users. `active + inactive = total`.","x-description-ar":"المستخدمون الموقوفون. `active + inactive = total`."},"system_users":{"type":"integer","description":"Users with no employee record.","x-description-ar":"المستخدمون الذين ليس لهم سجل وظيفي."},"employee_users":{"type":"integer","description":"Users who are also employees. `system_users + employee_users = total`.","x-description-ar":"المستخدمون الذين هم موظفون أيضاً. `system_users + employee_users = total`."},"by_role":{"type":"array","description":"One entry per role.","x-description-ar":"عنصر لكل دور.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name":{"type":"string","description":"Role name in the requested language.","x-description-ar":"اسم الدور بلغة الطلب."},"count":{"type":"integer","description":"Users with this role.","x-description-ar":"عدد المستخدمين الذين لهم هذا الدور."}}}}}}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"}}}},"/users/{id}":{"get":{"summary":"Get one user","operationId":"users.show","tags":["Users"],"description":"Returns one user: name, login email, role, whether they are active or own the company, and their sign-in\nstate (`portal_access`: invited and waiting, able to sign in, cancelled or expired).\n\n**When to use:** to check one person's access before `users.update`, `users.change_role`,\n`users.deactivate` or `users.activate`, or to see whether an invitation was accepted.\n\n**Prerequisites:** the user's `id`, from `users.list` (the `id` field, not `user_id`).\n\n**Side effects:** none.","x-summary-ar":"عرض مستخدم","x-description-ar":"يعرض مستخدماً واحداً: الاسم وبريد الدخول والدور، وهل هو نشط أو مالك للشركة، وحالة دخوله (`portal_access`:\nمدعو بانتظار القبول، أو قادر على الدخول، أو ملغى، أو منتهية دعوته).\n\n**متى تستخدمه:** لمراجعة صلاحية شخص قبل `users.update` أو `users.change_role` أو `users.deactivate` أو\n`users.activate`، أو لمعرفة هل قَبِل دعوته.\n\n**المتطلبات:** رقم `id` المستخدم من `users.list` (الحقل `id` وليس `user_id`).\n\n**الآثار الجانبية:** لا شيء.","x-access":"read","x-permission":{"key":"user/view","label":"View portal users","x-label-ar":"عرض مستخدمي البوابة"},"x-feature":"user","x-mcp":true,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/user_id"}],"responses":{"200":{"description":"The user.","x-description-ar":"المستخدم.","content":{"application/json":{"example":{"id":51,"user_id":318,"email":"khalid.omar@example.com","first_name":"Khalid","last_name":"Omar","portal_access":"activated","is_active":true,"is_owner":false,"role":{"id":3,"name":"Accountant"},"created_at":"2026-03-02 08:15:00 UTC","updated_at":"2026-03-09 11:40:00 UTC"},"schema":{"$ref":"#/components/schemas/user"}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/not_found"}}},"patch":{"summary":"Change a user's name or login email","operationId":"users.update","tags":["Users"],"description":"Changes a user's first name, last name or login email; a field you leave out stays as it is. The role is\nnot changed here (use `users.change_role`).\n\nThe email can only be changed while the person has never signed in and belongs to this company only —\ntypically to correct a typo in an invitation that was not accepted yet.\n\n**When to use:** to correct a user's name, or the email of a pending invitation.\n\n**Prerequisites:** the user's `id`, from `users.list`.\n\n**Side effects:** the person's QHR account itself is changed, so the new name shows in every company they\nbelong to. Recorded in the audit log.\n\n**Not offered to Claude:** changing a login email decides who can sign in to the account.","x-summary-ar":"تعديل اسم مستخدم أو بريد دخوله","x-description-ar":"يغيّر الاسم الأول أو اسم العائلة أو بريد الدخول لمستخدم؛ والحقل الذي لا ترسله يبقى كما هو. لا يتغير الدور\nهنا (استخدم `users.change_role`).\n\nلا يمكن تغيير البريد إلا إذا لم يسجّل الشخص الدخول قط ولم ينتمِ إلا إلى هذه الشركة — عادةً لتصحيح خطأ في\nبريد دعوة لم تُقبل بعد.\n\n**متى تستخدمه:** لتصحيح اسم مستخدم، أو بريد دعوة ما زالت بانتظار القبول.\n\n**المتطلبات:** رقم `id` المستخدم من `users.list`.\n\n**الآثار الجانبية:** يتغير حساب الشخص في QHR نفسه، فيظهر الاسم الجديد في كل الشركات التي ينتمي إليها.\nيُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأن تغيير بريد الدخول يحدد من يستطيع الدخول إلى الحساب.","x-access":"write","x-permission":{"key":"user/edit","label":"Edit portal users","x-label-ar":"تعديل مستخدمي البوابة"},"x-feature":"user","x-mcp":false,"parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/user_id"}],"responses":{"200":{"description":"The user after the change.","x-description-ar":"المستخدم بعد التعديل.","content":{"application/json":{"example":{"id":51,"user_id":318,"email":"khalid.omar@example.com","first_name":"Khalid","last_name":"Al-Omar","portal_access":"activated","is_active":true,"is_owner":false,"role":{"id":3,"name":"Accountant"},"created_at":"2026-03-02 08:15:00 UTC","updated_at":"2026-03-09 11:40:00 UTC"},"schema":{"$ref":"#/components/schemas/user"}}}},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The change was refused.","x-description-ar":"رُفض التعديل.","x-codes":[{"code":"validation_failed","meaning":"One of: the email cannot change because the person has already signed in, or belongs to another company too; the email is another account's; a name is blank.","x-meaning-ar":"أحد الأسباب: لا يمكن تغيير البريد لأن الشخص سجّل الدخول من قبل أو ينتمي إلى شركة أخرى أيضاً؛ البريد لحساب آخر؛ أحد الاسمين فارغ.","x-fix":"Read `error`. To move access to another email, deactivate this user with `users.deactivate` and add the new email with `users.create`.","x-fix-ar":"اقرأ `error`. لنقل الصلاحية إلى بريد آخر، أوقف هذا المستخدم عبر `users.deactivate` وأضف البريد الجديد عبر `users.create`."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Email cannot be changed for an activated user.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/user_input"},"example":{"user":{"last_name":"Al-Omar"}}}},"required":true,"description":"The fields to change."}}},"/users/{id}/activate":{"patch":{"summary":"Restore a deactivated user's access","operationId":"users.activate","tags":["Users"],"description":"Lets a user deactivated with `users.deactivate` sign in again, with the role they had. No email is sent:\nthe person uses their existing account.\n\nOnly someone who had signed in before can be reactivated. A person whose invitation was withdrawn before\nthey accepted it has no account to restore — invite them again instead.\n\n**When to use:** when a deactivated person should have access again (they returned, or were deactivated by\nmistake).\n\n**Prerequisites:** the user's `id`, from `users.list` with `q[is_active_eq]=false`. Their role must still be\nactive (`roles.list`).\n\n**Side effects:** a system user takes a user seat again. API tokens revoked when the user was deactivated\nstay revoked: the user must create new ones in QHR › Settings › API \u0026 Integrations. Recorded in the audit\nlog.\n\n**Not offered to Claude:** it gives a person access to the company again.","x-summary-ar":"إعادة صلاحية دخول مستخدم موقوف","x-description-ar":"يسمح لمستخدم أُوقف عبر `users.deactivate` بالدخول مجدداً بالدور الذي كان له. لا تُرسل أي رسالة، إذ يستخدم\nالشخص حسابه القائم.\n\nلا يُعاد تفعيل إلا من سبق له الدخول. أما من سُحبت دعوته قبل قبولها فليس له حساب يُستعاد — ادعُه من جديد.\n\n**متى تستخدمه:** عندما يجب أن يستعيد شخص موقوف صلاحية الدخول (عاد إلى الشركة، أو أُوقف خطأً).\n\n**المتطلبات:** رقم `id` المستخدم من `users.list` مع `q[is_active_eq]=false`. ويجب أن يكون دوره ما زال\nمفعّلاً (`roles.list`).\n\n**الآثار الجانبية:** يعود مستخدم النظام ليشغل مقعداً من مقاعد المستخدمين. تبقى رموز الواجهة البرمجية التي\nأُلغيت عند إيقافه ملغاة، وعلى المستخدم إنشاء رموز جديدة من QHR › الإعدادات › الواجهة البرمجية والتكاملات.\nيُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه يعيد لشخص صلاحية الوصول إلى الشركة.","x-access":"write","x-permission":{"key":"user/activate","label":"Reactivate users","x-label-ar":"إعادة تفعيل المستخدمين"},"x-feature":"user","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/user_id"}],"responses":{"200":{"description":"Access restored.","x-description-ar":"استُعيدت الصلاحية.","content":{"application/json":{"example":{"message":"Operation completed successfully."},"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Confirmation, in the requested language.","x-description-ar":"رسالة تأكيد بلغة الطلب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The user cannot be reactivated.","x-description-ar":"لا يمكن إعادة تفعيل المستخدم.","x-codes":[{"code":"validation_failed","meaning":"One of: the user is already active; they never signed in, so there is no account to restore; their role is switched off; the plan's user seats are all taken; they are not a member of the company.","x-meaning-ar":"أحد الأسباب: المستخدم نشط أصلاً؛ لم يسجّل الدخول قط فلا حساب يُستعاد؛ دوره معطّل؛ مقاعد المستخدمين في الباقة كلها مشغولة؛ ليس عضواً في الشركة.","x-fix":"Read `error`. A person who never signed in must be invited again (an employee from their employee record); give a user with a switched-off role an active one with `users.change_role`; free a seat or add seats to the plan.","x-fix-ar":"اقرأ `error`. من لم يسجّل الدخول قط تجب دعوته من جديد (والموظف من سجله الوظيفي)؛ وامنح صاحب الدور المعطّل دوراً مفعّلاً عبر `users.change_role`؛ أو حرّر مقعداً أو أضف مقاعد إلى الباقة."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This user is already active.","code":"validation_failed"}}}}}}},"/users/{id}/change_role":{"patch":{"summary":"Change a user's role","operationId":"users.change_role","tags":["Users"],"description":"Gives a user another role, which changes what they may see and do in QHR from their next request. The role\nmust be active. The last active admin cannot be moved to a role that is not an admin role, so the company\nis never left without one.\n\n**When to use:** to promote or restrict someone — make an HR officer an admin, or limit an accountant to\npayroll.\n\n**Prerequisites:** the user's `id`, from `users.list`, and the role's id (`tenant_role_id`) from\n`roles.list`.\n\n**Side effects:** the user's access changes at once, their API tokens included. Recorded in the audit log.\n\n**Not offered to Claude:** it changes what a person may see and do across the company's HR data.","x-summary-ar":"تغيير دور مستخدم","x-description-ar":"يمنح مستخدماً دوراً آخر، فيتغير ما يستطيع رؤيته والقيام به في QHR من طلبه التالي. يجب أن يكون الدور مفعّلاً.\nلا يمكن نقل آخر مسؤول نظام نشط إلى دور ليس من أدوار مسؤولي النظام، حتى لا تبقى الشركة بلا مسؤول.\n\n**متى تستخدمه:** لترقية شخص أو تقييد صلاحياته — جعل موظف موارد بشرية مسؤول نظام، أو قصر محاسب على الرواتب.\n\n**المتطلبات:** رقم `id` المستخدم من `users.list`، ورقم الدور (`tenant_role_id`) من `roles.list`.\n\n**الآثار الجانبية:** تتغير صلاحيات المستخدم فوراً، بما فيها رموز الواجهة البرمجية الخاصة به. يُسجَّل في سجل\nالتدقيق.\n\n**لا يُعرض على Claude:** لأنه يغيّر ما يستطيع شخص رؤيته والقيام به في بيانات الموارد البشرية للشركة.","x-access":"write","x-permission":{"key":"user/change_role","label":"Change user roles","x-label-ar":"تغيير أدوار المستخدمين"},"x-feature":"user","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/user_id"}],"responses":{"200":{"description":"The user with their new role.","x-description-ar":"المستخدم بدوره الجديد.","content":{"application/json":{"example":{"user":{"id":51,"user_id":318,"email":"khalid.omar@example.com","first_name":"Khalid","last_name":"Omar","portal_access":"activated","is_active":true,"is_owner":false,"role":{"id":5,"name":"Payroll Officer"},"created_at":"2026-03-02 08:15:00 UTC","updated_at":"2026-03-09 11:40:00 UTC"},"message":"Role updated successfully."},"schema":{"type":"object","required":["user","message"],"properties":{"user":{"$ref":"#/components/schemas/user"},"message":{"type":"string","description":"Confirmation, in the requested language.","x-description-ar":"رسالة تأكيد بلغة الطلب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The role cannot be given.","x-description-ar":"لا يمكن منح الدور.","x-codes":[{"code":"validation_failed","meaning":"One of: the role does not exist (or `tenant_role_id` is missing); the role is switched off; the user is the last active admin and the role is not an admin role.","x-meaning-ar":"أحد الأسباب: الدور غير موجود (أو `tenant_role_id` لم يُرسل)؛ الدور معطّل؛ المستخدم آخر مسؤول نظام نشط والدور ليس من أدوار مسؤولي النظام.","x-fix":"Pick an active role from `roles.list`. To move the last admin, first give another user an admin role.","x-fix-ar":"اختر دوراً مفعّلاً من `roles.list`. ولنقل آخر مسؤول نظام، امنح مستخدماً آخر دور مسؤول نظام أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot change the role of the last active admin. Assign another admin first.","code":"validation_failed"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["tenant_role_id"],"properties":{"tenant_role_id":{"type":"integer","description":"The role to give, from `roles.list`; must be active.","x-description-ar":"الدور الممنوح، من `roles.list`، ويجب أن يكون مفعّلاً."}}},"example":{"tenant_role_id":3}}},"required":true,"description":"The new role."}}},"/users/{id}/deactivate":{"patch":{"summary":"Stop a user from signing in","operationId":"users.deactivate","tags":["Users"],"description":"Deactivates a user: they can no longer sign in to this company's QHR, and every API token they created\nfor this company is revoked for good. Nothing is deleted; `users.activate` restores the sign-in with the\nsame role, but not the revoked tokens. If the user is also an employee, their employee record stays as it\nis (only its sign-in state changes).\n\nThe last active admin cannot be deactivated, so the company is never left without one.\n\n**When to use:** when someone should lose access — they left, or their engagement ended.\n\n**Prerequisites:** the user's `id`, from `users.list`.\n\n**Side effects:** a deactivated system user frees a user seat. A deactivated manager is no longer offered\nas an approver. The user's API tokens for this company are revoked, so any integration using them stops\nat once (deactivating yourself revokes the token making this call). Recorded in the audit log.\n\n**Not offered to Claude:** it removes a person's access to the company.","x-summary-ar":"إيقاف دخول مستخدم","x-description-ar":"يوقف مستخدماً: لا يستطيع بعدها الدخول إلى QHR في هذه الشركة، وتُلغى نهائياً كل رموز الواجهة البرمجية التي\nأنشأها لهذه الشركة. لا يُحذف شيء، ويعيد `users.activate` الدخول بالدور نفسه، لكنه لا يعيد الرموز الملغاة. إن\nكان المستخدم موظفاً أيضاً يبقى سجله الوظيفي كما هو (تتغير حالة دخوله فقط).\n\nلا يمكن إيقاف آخر مسؤول نظام نشط، حتى لا تبقى الشركة بلا مسؤول.\n\n**متى تستخدمه:** عندما يجب أن يفقد شخص صلاحية الدخول — غادر الشركة أو انتهى تعاقده.\n\n**المتطلبات:** رقم `id` المستخدم من `users.list`.\n\n**الآثار الجانبية:** يحرّر إيقاف مستخدم النظام مقعداً من مقاعد المستخدمين. ولا يعود المدير الموقوف خياراً\nللموافقة على الطلبات. تُلغى رموز الواجهة البرمجية الخاصة بالمستخدم في هذه الشركة، فيتوقف فوراً أي تكامل\nيستخدمها (وإيقاف نفسك يلغي الرمز الذي يُجري هذا الطلب). يُسجَّل في سجل التدقيق.\n\n**لا يُعرض على Claude:** لأنه يسحب صلاحية شخص في الوصول إلى الشركة.","x-access":"write","x-permission":{"key":"user/deactivate","label":"Deactivate users","x-label-ar":"تعطيل المستخدمين"},"x-feature":"user","x-mcp":false,"x-danger":"high","parameters":[{"$ref":"#/components/parameters/accept_language"},{"$ref":"#/components/parameters/user_id"}],"responses":{"200":{"description":"Deactivated.","x-description-ar":"أُوقف المستخدم.","content":{"application/json":{"example":{"message":"Operation completed successfully."},"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Confirmation, in the requested language.","x-description-ar":"رسالة تأكيد بلغة الطلب."}}}}}},"401":{"$ref":"#/components/responses/token_error"},"403":{"$ref":"#/components/responses/forbidden_or_read_only"},"404":{"$ref":"#/components/responses/not_found"},"422":{"description":"The user cannot be deactivated.","x-description-ar":"لا يمكن إيقاف المستخدم.","x-codes":[{"code":"validation_failed","meaning":"The user is the company's last active admin.","x-meaning-ar":"المستخدم هو آخر مسؤول نظام نشط في الشركة.","x-fix":"Give another user an admin role with `users.change_role` first.","x-fix-ar":"امنح مستخدماً آخر دور مسؤول نظام عبر `users.change_role` أولاً."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Cannot deactivate the last active admin. Assign another admin first.","code":"validation_failed"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"qhr_\u003cpublic_id\u003e_\u003csecret\u003e","description":"Create a token in QHR › Settings › API \u0026 Integrations, then send `Authorization: Bearer qhr_…` on every request.","x-description-ar":"أنشئ توكن من QHR › الإعدادات › واجهة البرمجة والتكاملات، ثم أرسل `Authorization: Bearer qhr_…` مع كل طلب."}},"parameters":{"accept_language":{"name":"Accept-Language","in":"header","required":false,"schema":{"type":"string","enum":["ar","en"]},"description":"Language of messages and translated labels. English when omitted.","x-description-ar":"لغة الرسائل والتسميات المترجمة. الإنجليزية إن لم يُرسل.","example":"ar"},"allocation_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Allocation id, from `payments.show` (`employee_payment.allocations[].id`).","x-description-ar":"رقم التخصيص، من `payments.show` (`employee_payment.allocations[].id`).","example":3301},"attendance_device_employee_link_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Link id, from `attendance_device_employee_links.list` (the same device).","x-description-ar":"رقم الربط، من `attendance_device_employee_links.list` (للجهاز نفسه).","example":301},"attendance_device_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Device id, from `attendance_devices.list`.","x-description-ar":"رقم الجهاز، من `attendance_devices.list`.","example":14},"attendance_device_parent_id":{"name":"attendance_device_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Device id, from `attendance_devices.list`.","x-description-ar":"رقم الجهاز، من `attendance_devices.list`.","example":14},"attendance_device_support_request_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Support request id, from `attendance_device_support_requests.list`.","x-description-ar":"رقم طلب الدعم، من `attendance_device_support_requests.list`.","example":57},"attendance_log_location":{"name":"location","in":"query","required":false,"schema":{"type":"string"},"description":"Only rows punched at this place: a location id (from `employees.meta_data`, `locations`) matched on either side, or `remote` for a check-in or check-out marked remote.","x-description-ar":"الصفوف المسجلة في هذا المكان فقط: رقم موقع (من `employees.meta_data` في `locations`) يطابق الدخول أو الخروج، أو `remote` لتسجيل دخول أو خروج عن بُعد.","example":"remote"},"attendance_log_source":{"name":"source","in":"query","required":false,"schema":{"type":"string","enum":["mobile","web","app","device","manual","system"]},"description":"Only rows where the check-in or the check-out came from: `mobile` (QHR mobile app), `web` (QHR in a browser), `app` (QHR app, client not recorded), `device` (attendance device), `manual` (entered or adjusted by HR/manager) or `system` (closed automatically).","x-description-ar":"الصفوف التي جاء تسجيل دخولها أو خروجها من: `mobile` تطبيق QHR للجوال، `web` QHR في المتصفح، `app` تطبيق QHR دون تحديد الواجهة، `device` جهاز حضور، `manual` إدخال أو تعديل يدوي من الموارد البشرية أو المدير، `system` إغلاق تلقائي من النظام.","example":"mobile"},"attendance_log_status":{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["present","late","early_leave","working","missing_check_out","absent","on_leave"]},"description":"Only rows with this day status: `present` (on time, full day), `late` (a counted late arrival), `early_leave` (left early, not late), `working` (checked in, day still open), `missing_check_out` (checked in, the day is over and no check-out), `absent` or `on_leave`.","x-description-ar":"الصفوف ذات حالة اليوم هذه فقط: `present` حاضر في الموعد ويوم كامل، `late` تأخر محتسب، `early_leave` خروج مبكر دون تأخير، `working` سجّل دخوله واليوم ما زال مفتوحاً، `missing_check_out` سجّل دخوله وانتهى اليوم دون تسجيل خروج، `absent` غائب، `on_leave` في إجازة.","example":"late"},"attendance_profile_employee_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `employees.list` or `employees.search`.","x-description-ar":"رقم الموظف، من `employees.list` أو `employees.search`.","example":1203},"attendance_profile_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Attendance profile id, from `attendance_profiles.list`.","x-description-ar":"رقم ملف الحضور، من `attendance_profiles.list`.","example":3},"attendance_record_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Attendance record (day) id: `id` in `attendances.my_history` (your own days), `attendance.record_id` in `time_incidents.team_list` (your team's days with an incident) or `id` in `attendance_log.records` (HR).","x-description-ar":"رقم سجل الحضور (اليوم): `id` في `attendances.my_history` لأيامك، أو `attendance.record_id` في `time_incidents.team_list` لأيام فريقك التي فيها مخالفة، أو `id` في `attendance_log.records` (للموارد البشرية).","example":58231},"attendance_report_department_id":{"name":"department_id","in":"query","required":false,"schema":{"type":"integer"},"description":"Only employees of this department (id from `employees.meta_data`, `departments`). An id that does not exist answers 422.","x-description-ar":"موظفو هذا القسم فقط (الرقم من `employees.meta_data` في `departments`). الرقم غير الموجود يعيد ٤٢٢.","example":4},"attendance_report_direction":{"name":"direction","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"]},"description":"`asc` (default) or `desc`.","x-description-ar":"`asc` تصاعدي (الافتراضي) أو `desc` تنازلي.","example":"asc"},"attendance_report_employee_id":{"name":"employee_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from the report's `employees` list (`employee_id`) or `employees.list`.","x-description-ar":"رقم الموظف، من قائمة `employees` في التقرير (`employee_id`) أو من `employees.list`.","example":1203},"attendance_report_from":{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First day of the period, `YYYY-MM-DD`, included. A calendar date in the company's timezone (the timezone set on the company, e.g. `Asia/Riyadh`), not UTC. Defaults to the first day of the current month in that timezone. `from` to `to` may span at most 366 days.","x-description-ar":"أول يوم في الفترة بصيغة `YYYY-MM-DD`، ويُحتسب ضمنها. تاريخ تقويمي بتوقيت الشركة (المنطقة الزمنية المضبوطة للشركة، مثل `Asia/Riyadh`) لا بتوقيت UTC. الافتراضي أول يوم من الشهر الحالي بتوقيت الشركة. لا تزيد الفترة من `from` إلى `to` على ٣٦٦ يوماً.","example":"2026-07-01"},"attendance_report_search":{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Name or employee number contains this text, case-insensitive. The name matched is the full name in the request's language (`Accept-Language`): the English name for `en`, the Arabic name for `ar`.","x-description-ar":"الاسم أو الرقم الوظيفي يحتوي على هذا النص، دون تمييز بين الأحرف الكبيرة والصغيرة. يُطابَق الاسم الكامل بلغة الطلب (`Accept-Language`): الاسم الإنجليزي مع `en` والعربي مع `ar`.","example":"Sara"},"attendance_report_sort":{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["name","employee_no","department"]},"description":"Order of the rows: `name` (default, the full name in the request's language), `employee_no` or `department` (department name). The metrics cannot be sorted on. Any other value sorts by name.","x-description-ar":"ترتيب الصفوف: `name` (الافتراضي، الاسم الكامل بلغة الطلب) أو `employee_no` الرقم الوظيفي أو `department` اسم القسم. لا يمكن الترتيب حسب المؤشرات. أي قيمة أخرى ترتب بالاسم.","example":"name"},"attendance_report_to":{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last day of the period, `YYYY-MM-DD`, included, in the company's timezone. Defaults to the last day of the current month (a future date for most of the month; future days hold no attendance yet, so they change no number). Must be on or after `from`.","x-description-ar":"آخر يوم في الفترة بصيغة `YYYY-MM-DD`، ويُحتسب ضمنها، بتوقيت الشركة. الافتراضي آخر يوم من الشهر الحالي (وهو تاريخ مستقبلي في معظم أيام الشهر؛ ولا حضور مسجّل للأيام المستقبلية بعد، فلا تغيّر أي رقم). يجب ألا يسبق `from`.","example":"2026-07-31"},"bonus_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Bonus id, from `bonuses.list` or `team_bonuses.list`.","x-description-ar":"رقم المكافأة، من `bonuses.list` أو `team_bonuses.list`.","example":418},"custody_category_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Category id, from `custody_categories.list`.","x-description-ar":"رقم الفئة، من `custody_categories.list`.","example":2},"custody_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Custody id, from `custodies.list`.","x-description-ar":"رقم العهدة، من `custodies.list`.","example":311},"custody_item_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Item id, from `custody_categories.list` (each category's `items`).","x-description-ar":"رقم الصنف، من `custody_categories.list` (أصناف كل فئة في `items`).","example":7},"dashboard_from":{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Start of the window (YYYY-MM-DD). Send with `to`; without both, the answer is for today.","x-description-ar":"بداية الفترة (YYYY-MM-DD). أرسله مع `to`؛ وبدونهما تكون الإجابة عن اليوم.","example":"2026-12-01"},"dashboard_to":{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"End of the window (YYYY-MM-DD), on or after `from`, at most 90 days in all.","x-description-ar":"نهاية الفترة (YYYY-MM-DD)، في يوم `from` أو بعده، ولا تزيد الفترة كلها عن ٩٠ يوماً.","example":"2026-12-31"},"data_export_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Export id, from `exports.list`.","x-description-ar":"رقم التصدير، من `exports.list`.","example":318},"deduction_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Deduction id, from `deductions.list` or `team_deductions.list`.","x-description-ar":"رقم الاستقطاع، من `deductions.list` أو `team_deductions.list`.","example":233},"department_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Department id, from `departments.list`.","x-description-ar":"رقم القسم، من `departments.list`.","example":4},"department_ticket_overdue":{"name":"overdue","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only requests past their due date and still open, assigned or in progress.","x-description-ar":"`true`: الطلبات التي تجاوزت تاريخ استحقاقها وما زالت مفتوحة أو مسندة أو قيد التنفيذ فقط.","example":true},"department_ticket_q_assignee_id_eq":{"name":"q[assignee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only requests assigned to this employee.","x-description-ar":"الطلبات المسندة إلى هذا الموظف فقط.","example":1207},"department_ticket_q_assignee_id_null":{"name":"q[assignee_id_null]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true`: only requests nobody is on; `false`: only assigned ones.","x-description-ar":"`true`: الطلبات غير المسندة فقط؛ `false`: المسندة فقط.","example":true},"department_ticket_q_created_at_gteq":{"name":"q[created_at_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or after this day (`YYYY-MM-DD`, company time zone).","x-description-ar":"قُدّم في هذا اليوم أو بعده (`YYYY-MM-DD` بتوقيت الشركة).","example":"2026-11-01"},"department_ticket_q_created_at_lteq":{"name":"q[created_at_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Submitted on or before this day (`YYYY-MM-DD`, company time zone).","x-description-ar":"قُدّم في هذا اليوم أو قبله (`YYYY-MM-DD` بتوقيت الشركة).","example":"2026-11-30"},"department_ticket_q_priority_eq":{"name":"q[priority_eq]","in":"query","required":false,"schema":{"type":"string","enum":["low","medium","high","highest"]},"description":"Only this priority: `low`, `medium`, `high` or `highest`.","x-description-ar":"أولوية محددة فقط: `low` أو `medium` أو `high` أو `highest`.","example":"high"},"department_ticket_q_reference_or_subject_or_requester_name_cont":{"name":"q[reference_or_subject_or_requester_name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Reference, subject or requester's name contains.","x-description-ar":"المرجع أو الموضوع أو اسم مقدّم الطلب يحتوي على.","example":"laptop"},"department_ticket_q_s":{"name":"q[s]","in":"query","required":false,"schema":{"type":"string"},"description":"Sort, `\u003cfield\u003e asc|desc`: `created_at`, `due_on`, `last_activity_at`, `priority`, `status`, `reference`. Latest activity first when omitted.","x-description-ar":"الترتيب بالشكل `\u003cfield\u003e asc|desc`: `created_at` أو `due_on` أو `last_activity_at` أو `priority` أو `status` أو `reference`. الأحدث نشاطاً أولاً إن لم يُرسل.","example":"due_on asc"},"department_ticket_q_status_eq":{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]},"description":"Only this status (see `status` on a row).","x-description-ar":"حالة محددة فقط (انظر `status` في الصف).","example":"open"},"department_ticket_q_status_in":{"name":"q[status_in][]","in":"query","required":false,"style":"form","explode":true,"schema":{"type":"array","items":{"type":"string","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]}},"description":"Only these statuses (repeat the parameter).","x-description-ar":"هذه الحالات فقط (كرّر المعامل).","example":["open","assigned"]},"department_ticket_q_ticket_type_id_eq":{"name":"q[ticket_type_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this request type.","x-description-ar":"نوع طلب محدد فقط.","example":12},"department_ticket_q_ticket_type_ticket_category_id_eq":{"name":"q[ticket_type_ticket_category_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this request category (id from `ticket_categories.list` or `ticket_catalog.list`).","x-description-ar":"فئة طلبات محددة فقط (الرقم من `ticket_categories.list` أو `ticket_catalog.list`).","example":4},"document_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Document id, from `documents.list`, `folders.list` (`attachments`) or `documents.versions`.","x-description-ar":"رقم المستند، من `documents.list` أو `folders.list` (`attachments`) أو `documents.versions`.","example":512},"employee_bulk_update_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Bulk update id, the `bulk_update_id` returned by `employee_bulk_updates.create`.","x-description-ar":"رقم التعديل الجماعي، أي `bulk_update_id` الذي يعيده `employee_bulk_updates.create`.","example":42},"employee_earning_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Payslip line id, from `payslips.show` (`payslip.earnings[].id`).","x-description-ar":"رقم بند القسيمة، من `payslips.show` (`payslip.earnings[].id`).","example":90412},"employee_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `employees.list` or `employees.search`.","x-description-ar":"رقم الموظف، من `employees.list` أو `employees.search`.","example":1203},"employee_import_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Import id, the `import_id` returned by `employee_imports.create`.","x-description-ar":"رقم الاستيراد، أي `import_id` الذي يعيده `employee_imports.create`.","example":31},"employee_leave_policy_my_policy_id":{"name":"leave_policy_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Id of one of your leave policies, from `employee_leave_policies.my_list` (`id`).","x-description-ar":"رقم إحدى سياسات إجازتك، من `employee_leave_policies.my_list` (`id`).","example":12},"employee_leave_policy_policy_id":{"name":"leave_policy_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Leave policy id, from `leave_policies.list`.","x-description-ar":"رقم سياسة الإجازة، من `leave_policies.list`.","example":12},"employee_payment_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Payment id, from `payments.list`.","x-description-ar":"رقم الدفعة، من `payments.list`.","example":910},"folder_employee_id":{"name":"employee_id","in":"path","required":true,"schema":{"type":"integer"},"description":"The employee whose folders these are, from `employees.list` or `employees.search`.","x-description-ar":"الموظف صاحب المجلدات، من `employees.list` أو `employees.search`.","example":88},"folder_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Folder id, from `folders.list`.","x-description-ar":"رقم المجلد، من `folders.list`.","example":31},"folder_include_hidden":{"name":"include_hidden","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` to include hidden folders. Required to reach a hidden folder by its id (otherwise 404).","x-description-ar":"`true` لتشمل المجلدات المخفية. مطلوب للوصول إلى مجلد مخفي برقمه (وإلا يعود 404).","example":true},"gosi_employee_id":{"name":"employee_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `employees.list` or `employees.search`. Only employees the caller may see.","x-description-ar":"رقم الموظف، من `employees.list` أو `employees.search`. الموظفون الذين يراهم المستدعي فقط.","example":1203},"holiday_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Holiday id, from `holidays.list`.","x-description-ar":"رقم العطلة، من `holidays.list`.","example":41},"hr_leave_employee_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `hr_leaves.employees` or `employees.list`. Leavers can be read too.","x-description-ar":"رقم الموظف، من `hr_leaves.employees` أو `employees.list`. ويمكن قراءة من غادروا أيضاً.","example":1203},"hr_loan_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Loan id, from `hr_loans.list`.","x-description-ar":"رقم السلفة، من `hr_loans.list`.","example":418},"hr_ticket_q_department_id_eq":{"name":"q[department_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only requests handled by this department (id from `employees.meta_data`, `departments`).","x-description-ar":"الطلبات التي ينفّذها هذا القسم فقط (الرقم من `employees.meta_data`، `departments`).","example":7},"insurance_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Insurance plan id, from `insurances.list`.","x-description-ar":"رقم خطة التأمين، من `insurances.list`.","example":1},"leave_category_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Leave category id, from `leave_categories.list`.","x-description-ar":"رقم فئة الإجازة، من `leave_categories.list`.","example":7},"leave_policy_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Leave policy id, from `leave_policies.list`.","x-description-ar":"رقم سياسة الإجازة، من `leave_policies.list`.","example":12},"leave_request_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Leave request id, from `leave_requests.list` (your own) or `team_leaves.pending_requests` (your team's).","x-description-ar":"رقم طلب الإجازة، من `leave_requests.list` (طلباتك) أو `team_leaves.pending_requests` (طلبات فريقك).","example":5120},"loan_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Id of one of your own loans, from `loans.list`.","x-description-ar":"رقم إحدى سلفك، من `loans.list`.","example":418},"location_filter_fence_type":{"name":"q[fence_type]","in":"query","required":false,"schema":{"type":"string","enum":["map","ip"]},"description":"`map` fenced by a map pin, `ip` fenced by office networks.","x-description-ar":"`map` سياج بنقطة على الخريطة، `ip` سياج بشبكات المكتب.","example":"map"},"location_filter_geo_fenced":{"name":"q[geo_fenced]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` only locations whose fence is in force, `false` only those without.","x-description-ar":"`true` المواقع التي سياجها مفعّل فقط، `false` التي بلا سياج فقط.","example":true},"location_filter_is_active_eq":{"name":"q[is_active_eq]","in":"query","required":false,"schema":{"type":"boolean"},"description":"`true` active only, `false` inactive only.","x-description-ar":"`true` النشطة فقط، `false` غير النشطة فقط.","example":true},"location_filter_name_cont":{"name":"q[name_cont]","in":"query","required":false,"schema":{"type":"string"},"description":"Name contains, English or Arabic.","x-description-ar":"الاسم يحتوي على، بالعربية أو الإنجليزية.","example":"Riyadh"},"location_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Location id, from `locations.list`.","x-description-ar":"رقم الموقع، من `locations.list`.","example":2},"my_payslip_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Id of one of your own payslips, from `payslips.my_list`.","x-description-ar":"رقم إحدى قسائمك، من `payslips.my_list`.","example":5120},"overtime_date_from_filter":{"name":"q[date_gteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Only requests for this date or later (`YYYY-MM-DD`).","x-description-ar":"الطلبات في هذا التاريخ أو بعده فقط (`YYYY-MM-DD`).","example":"2026-11-01"},"overtime_date_to_filter":{"name":"q[date_lteq]","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Only requests for this date or earlier (`YYYY-MM-DD`).","x-description-ar":"الطلبات في هذا التاريخ أو قبله فقط (`YYYY-MM-DD`).","example":"2026-11-30"},"overtime_employee_filter":{"name":"q[employee_id_eq]","in":"query","required":false,"schema":{"type":"integer"},"description":"Only this employee's requests (id from `employees.list`).","x-description-ar":"طلبات هذا الموظف فقط (الرقم من `employees.list`).","example":1203},"overtime_request_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Overtime request id, from `overtime_requests.list`, `team_overtimes.pending_requests` or `hr_overtimes.requests`.","x-description-ar":"رقم طلب العمل الإضافي، من `overtime_requests.list` أو `team_overtimes.pending_requests` أو `hr_overtimes.requests`.","example":412},"overtime_status_filter":{"name":"q[status_eq]","in":"query","required":false,"schema":{"type":"string","enum":["pending_manager","pending_hr","approved","rejected","cancelled"]},"description":"Only requests in this status.","x-description-ar":"الطلبات بهذه الحالة فقط.","example":"approved"},"page":{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Page number, starting at 1.","x-description-ar":"رقم الصفحة، تبدأ من 1.","example":1},"payroll_component_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Pay component id, from `salaries.components`.","x-description-ar":"رقم مكوّن الراتب، من `salaries.components`.","example":6},"payroll_run_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Payroll run id, from `payroll_runs.list` (`records[].payrolls[].id`).","x-description-ar":"رقم المسيّر، من `payroll_runs.list` (`records[].payrolls[].id`).","example":77},"payslip_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Payslip id, from `payslips.list` (`records[].payslips[].id`).","x-description-ar":"رقم القسيمة، من `payslips.list` (`records[].payslips[].id`).","example":5120},"per_page":{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Records per page. Each list states its maximum.","x-description-ar":"عدد السجلات في الصفحة. تذكر كل قائمة حدها الأقصى.","example":20},"permission_request_from":{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First date of the period (`YYYY-MM-DD`), matched on the permission's date. The first day of the current month when omitted.","x-description-ar":"أول يوم في الفترة (`YYYY-MM-DD`) حسب تاريخ الاستئذان. أول يوم في الشهر الحالي إن لم يُرسل.","example":"2026-11-01"},"permission_request_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Permission request id, from `permission_requests.list`, `permission_requests.team_pending`, `permission_requests.team_decided` or `permission_requests.hr_list`.","x-description-ar":"رقم طلب الاستئذان، من `permission_requests.list` أو `permission_requests.team_pending` أو `permission_requests.team_decided` أو `permission_requests.hr_list`.","example":4812},"permission_request_to":{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last date of the period (`YYYY-MM-DD`), inclusive. The last day of the current month when omitted.","x-description-ar":"آخر يوم في الفترة (`YYYY-MM-DD`) شاملاً. آخر يوم في الشهر الحالي إن لم يُرسل.","example":"2026-11-30"},"role_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Role id, from `roles.list`.","x-description-ar":"رقم الدور، من `roles.list`.","example":7},"role_type":{"name":"role_type","in":"query","required":false,"schema":{"type":"string","enum":["employee","manager","admin"]},"description":"The tier to build the permission template for. Missing or unknown values fall back to `employee`.","x-description-ar":"الفئة التي يُبنى لها قالب الصلاحيات. القيمة الناقصة أو غير المعروفة تُعامل كـ `employee`.","example":"manager"},"salary_employee_id":{"name":"employee_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The employee, from `employees.list` or `employees.search`.","x-description-ar":"الموظف، من `employees.list` أو `employees.search`.","example":1203},"salary_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Salary id, from `salaries.list` or `salaries.active`.","x-description-ar":"رقم الراتب، من `salaries.list` أو `salaries.active`.","example":310},"support_request_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Support request id, from `support_requests.list`.","x-description-ar":"رقم طلب الدعم، من `support_requests.list`.","example":57},"team_leave_employee_id":{"name":"employee_id","in":"query","required":true,"schema":{"type":"integer"},"description":"The direct report's employee id, from `employees.team`. Only your own direct reports who still work here.","x-description-ar":"رقم الموظف المرؤوس، من `employees.team`. مرؤوسوك المباشرون الذين ما زالوا على رأس العمل فقط.","example":1203},"termination_package_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Termination package id, from `termination_packages.list`.","x-description-ar":"رقم تسوية نهاية الخدمة، من `termination_packages.list`.","example":41},"ticket_category_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Request category id, from `ticket_categories.list`.","x-description-ar":"رقم فئة الطلبات، من `ticket_categories.list`.","example":4},"ticket_comment_ticket_id":{"name":"ticket_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Request id, from `tickets.list` or `tickets.show`.","x-description-ar":"رقم الطلب، من `tickets.list` أو `tickets.show`.","example":5012},"ticket_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Request id (`id`, not the `TKT-…` reference), from `tickets.list` or `ticket_approvals.list`.","x-description-ar":"رقم الطلب (`id` وليس المرجع `TKT-…`)، من `tickets.list` أو `ticket_approvals.list`.","example":5012},"ticket_type_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Request type id, from `ticket_types.list`.","x-description-ar":"رقم نوع الطلب، من `ticket_types.list`.","example":12},"time_incident_from":{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"First incident date to include. The first day of the current month when omitted.","x-description-ar":"أول تاريخ مخالفة يُشمل. أول يوم في الشهر الحالي إن لم يُرسل.","example":"2026-08-01"},"time_incident_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Time incident id, from `time_incidents.list` or `time_incidents.team_list` (the employee's own ids come from their attendance history).","x-description-ar":"رقم المخالفة، من `time_incidents.list` أو `time_incidents.team_list` (وأرقام مخالفات الموظف نفسه من سجل حضوره).","example":5120},"time_incident_to":{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Last incident date to include. The last day of the current month when omitted.","x-description-ar":"آخر تاريخ مخالفة يُشمل. آخر يوم في الشهر الحالي إن لم يُرسل.","example":"2026-08-31"},"time_off_employee_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"Employee id, from `employees.list`, `employees.search` or `hr_leaves.employees`.","x-description-ar":"رقم الموظف، من `employees.list` أو `employees.search` أو `hr_leaves.employees`.","example":1203},"time_off_leave_policy_id":{"name":"leave_policy_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Leave policy id, from `time_off.policies` or `time_off.balances` (`id`).","x-description-ar":"رقم سياسة الإجازة، من `time_off.policies` أو `time_off.balances` (`id`).","example":7},"timesheet_payroll_id":{"name":"payroll_id","in":"path","required":true,"schema":{"type":"integer"},"description":"Payroll run id, from `payroll_runs.list`.","x-description-ar":"رقم المسيّر، من `payroll_runs.list`.","example":77},"user_id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"description":"The user's id in this company (the `id` field, not `user_id`), from `users.list`.","x-description-ar":"رقم المستخدم في هذه الشركة (الحقل `id` وليس `user_id`)، من `users.list`.","example":51}},"schemas":{"accounting_connection":{"type":"object","description":"The connection page: status, Qoyod company, settings and readiness.","x-description-ar":"صفحة الربط: الحالة وشركة قيود والإعدادات والجاهزية.","properties":{"accounting_connection":{"type":"object","description":"The connection.","x-description-ar":"الربط.","properties":{"status":{"type":"string","description":"`not_connected`, `connected`, or `needs_reauth` (linked, but an admin must sign in to Qoyod again).","x-description-ar":"`not_connected` غير مربوط، `connected` مربوط، `needs_reauth` مربوط لكن يجب أن يعيد مسؤول الدخول إلى قيود.","enum":["not_connected","connected","needs_reauth"]},"provider":{"type":"string","description":"`qoyod`, or null when not connected.","x-description-ar":"`qoyod`، أو null إن لم يكن مربوطاً.","nullable":true},"provider_available":{"type":"boolean","description":"False when this QHR environment has no Qoyod integration.","x-description-ar":"خطأ إذا لم يكن تكامل قيود متاحاً في بيئة QHR هذه."},"sync_enabled":{"type":"boolean","description":"True when payroll and settlements are sent to Qoyod.","x-description-ar":"صحيح إذا كانت الرواتب والتسويات تُرسل إلى قيود."},"settings":{"type":"object","description":"`cost_centre_dimension` (`department` or `location`), `payer` and `replay_history`.","x-description-ar":"`cost_centre_dimension` (`department` أو `location`) و`payer` و`replay_history`."},"connected_company":{"type":"object","description":"Qoyod company: `id`, `name`, `base_currency`.","x-description-ar":"شركة قيود: `id` و`name` و`base_currency`."},"connected_by":{"type":"object","description":"Who connected it: `id`, `name`, `email`.","x-description-ar":"من أجرى الربط: `id` و`name` و`email`.","nullable":true},"connected_at":{"type":"string","description":"When, UTC ISO 8601.","x-description-ar":"متى، بتوقيت UTC.","nullable":true},"capabilities":{"type":"object","description":"What the Qoyod company supports.","x-description-ar":"ما تدعمه شركة قيود."},"sync_note":{"type":"string","description":"Note left when sync was last switched.","x-description-ar":"ملاحظة آخر تبديل للمزامنة.","nullable":true},"readiness":{"allOf":[{"$ref":"#/components/schemas/accounting_readiness"}],"nullable":true,"description":"Readiness, when connected.","x-description-ar":"الجاهزية عند الربط."},"links":{"type":"object","description":"`mapping_page` in Qoyod.","x-description-ar":"`mapping_page` في قيود."},"available_providers":{"type":"array","description":"Providers that can be connected, when not connected.","x-description-ar":"المزوّدون المتاحون للربط عند عدم الربط.","items":{"type":"object"}},"previous":{"type":"object","description":"The last connection, when disconnected: company, when, by whom, receipts kept.","x-description-ar":"آخر ربط عند الفصل: الشركة ومتى ومن فصله وعدد الإيصالات المحفوظة."}}}}},"accounting_readiness":{"type":"object","description":"Whether Qoyod has an account for every cost type the recent finalised runs used.","x-description-ar":"هل لكل نوع تكلفة استُخدم في المسيّرات المعتمدة الأخيرة حساب في قيود.","properties":{"ready":{"type":"boolean","description":"True when nothing would be held. Null when Qoyod did not answer.","x-description-ar":"صحيح إذا لم يكن هناك ما سيُعلَّق. null إذا لم تُجب قيود.","nullable":true},"runs_checked":{"type":"array","description":"References of the runs checked, newest first.","x-description-ar":"مراجع المسيّرات التي فُحصت، الأحدث أولاً.","items":{"type":"string"}},"cost_types_used":{"type":"integer","description":"Cost types checked.","x-description-ar":"عدد أنواع التكلفة التي فُحصت."},"unmapped_cost_types":{"type":"array","description":"Cost types with no account in Qoyod yet.","x-description-ar":"أنواع تكلفة ليس لها حساب في قيود بعد.","items":{"type":"object","properties":{"code":{"type":"string","description":"Cost type code, e.g. `allowance_housing`.","x-description-ar":"رمز نوع التكلفة، مثل `allowance_housing`."},"name":{"type":"string","description":"Cost type name.","x-description-ar":"اسم نوع التكلفة."},"last_used_in":{"type":"string","description":"Last run that used it.","x-description-ar":"آخر مسيّر استخدمه.","nullable":true},"amount_last_run":{"type":"string","description":"Amount in the newest run, decimal string.","x-description-ar":"المبلغ في أحدث مسيّر، نص عشري.","nullable":true}}}},"mapping_version":{"type":"string","description":"Qoyod's mapping version.","x-description-ar":"إصدار ربط الحسابات في قيود.","nullable":true},"checked_at":{"type":"string","description":"When Qoyod was asked, UTC ISO 8601.","x-description-ar":"وقت سؤال قيود بتوقيت UTC.","format":"date-time"},"links":{"type":"object","description":"`mapping_page`: where to add the missing accounts in Qoyod.","x-description-ar":"`mapping_page`: مكان إضافة الحسابات الناقصة في قيود."},"error":{"type":"string","description":"`provider_unreachable` when Qoyod did not answer (inside `accounting_connection.show` only).","x-description-ar":"`provider_unreachable` إذا لم تُجب قيود (داخل `accounting_connection.show` فقط)."},"message":{"type":"string","description":"Why Qoyod did not answer.","x-description-ar":"سبب عدم رد قيود."}}},"accounting_sync_item":{"type":"object","description":"One thing QHR sent (or will send) to Qoyod.","x-description-ar":"عنصر واحد أرسله QHR (أو سيرسله) إلى قيود.","properties":{"event_type":{"type":"string","description":"What it is: `payroll.finalized`, `termination.settled`, `employees.synced`…","x-description-ar":"نوعه: `payroll.finalized` أو `termination.settled` أو `employees.synced`…"},"reference":{"type":"string","description":"QHR reference, e.g. `PYR-0042`.","x-description-ar":"مرجع QHR، مثل `PYR-0042`."},"state":{"type":"string","description":"`queued`, `sending`, `retrying`, `posted`, `held` (an account is missing in Qoyod), `needs_decision` (the period is closed in Qoyod), `failed`, `rejected` or `reversed`.","x-description-ar":"`queued` بالانتظار، `sending` يُرسل، `retrying` يُعاد، `posted` رُحّل، `held` معلّق لنقص حساب في قيود، `needs_decision` الفترة مغلقة في قيود، `failed` فشل، `rejected` مرفوض، `reversed` عُكس."},"occurred_at":{"type":"string","description":"When it happened in QHR, UTC ISO 8601.","x-description-ar":"وقت حدوثه في QHR بتوقيت UTC."},"title":{"type":"string","description":"Plain-words title, e.g. \"September 2026 payroll\".","x-description-ar":"عنوان واضح، مثل «رواتب سبتمبر ٢٠٢٦»."},"amount":{"type":"string","description":"Net amount, decimal string.","x-description-ar":"المبلغ الصافي، نص عشري.","nullable":true},"currency":{"type":"string","description":"Currency, ISO code.","x-description-ar":"العملة برمز ISO.","nullable":true},"actions":{"type":"array","description":"What fixes it in the web app: `open_mapping`, `retry_now`, `repost`…","x-description-ar":"ما يصلحه في تطبيق الويب: `open_mapping` أو `retry_now` أو `repost`…","items":{"type":"object"}},"accounting":{"type":"object","description":"Delivery detail: `event_id`, `posting_id`, `journal_entry` (`ref`, `url`), `attempts`, `reason_code`, `reason`, `unmapped_cost_types`…","x-description-ar":"تفاصيل التسليم: `event_id` و`posting_id` و`journal_entry` (`ref` و`url`) و`attempts` و`reason_code` و`reason` و`unmapped_cost_types`…"}}},"allocation":{"type":"object","description":"Part of a payment applied to one thing it settles.","x-description-ar":"جزء من دفعة مخصص لبند واحد يسدده.","properties":{"id":{"type":"integer","description":"Allocation id.","x-description-ar":"رقم التخصيص."},"source_id":{"type":"integer","description":"The payment.","x-description-ar":"رقم الدفعة."},"source_type":{"type":"string","description":"Always `EmployeePayment`.","x-description-ar":"دائماً `EmployeePayment`."},"allocatee_id":{"type":"integer","description":"What it settles.","x-description-ar":"رقم البند المسدَّد."},"allocatee_type":{"type":"string","description":"`Payslip`, `Bonus` or `Deduction`.","x-description-ar":"`Payslip` قسيمة، `Bonus` مكافأة، `Deduction` استقطاع."},"amount":{"type":"string","description":"Amount applied.","x-description-ar":"المبلغ المخصص."},"date":{"type":"string","description":"Allocation date.","x-description-ar":"تاريخ التخصيص.","format":"date","nullable":true},"currency":{"type":"string","description":"Currency.","x-description-ar":"العملة."},"allocatee_label":{"type":"string","description":"What it settles, readable (`2026-10 — Sara Ahmed`). On `payments.show` only.","x-description-ar":"البند المسدَّد بصيغة مقروءة (`2026-10 — Sara Ahmed`). في `payments.show` فقط.","nullable":true}}},"attendance_check_in_status":{"type":"object","description":"Where the employee's current work day stands.","x-description-ar":"وضع يوم العمل الحالي للموظف.","required":["checked_in","state","tracks_breaks"],"properties":{"checked_in":{"type":"boolean","description":"True once the employee has checked in for the day.","x-description-ar":"صحيح بعد تسجيل الحضور لليوم."},"check_in_at":{"type":"string","description":"Check-in time, UTC.","x-description-ar":"وقت الحضور بتوقيت UTC.","format":"date-time","nullable":true},"check_out_at":{"type":"string","description":"Check-out time, UTC.","x-description-ar":"وقت الانصراف بتوقيت UTC.","format":"date-time","nullable":true},"already_checked_in_via":{"type":"string","description":"How that side was recorded: `app` (the QHR app or this API), `device` (a fingerprint or face device), `manual` (corrected by a manager or HR); null when there is no time.","x-description-ar":"طريقة تسجيل هذا الطرف: `app` من تطبيق QHR أو هذه الواجهة، `device` من جهاز بصمة أو وجه، `manual` تصحيح من المدير أو الموارد البشرية؛ null إن لم يوجد وقت.","nullable":true,"enum":["app","device","manual",null]},"device_name":{"type":"string","description":"The device that checked the employee in, for a device check-in.","x-description-ar":"الجهاز الذي سجّل الحضور، إن كان الحضور من جهاز.","nullable":true},"geo_fencing":{"type":"object","description":"Where check-in is allowed, when the employee's locations enforce it; null otherwise. `requires_coordinates` true means send `latitude` and `longitude`.","x-description-ar":"أين يُسمح بتسجيل الحضور إن كانت مواقع الموظف تفرض ذلك؛ وإلا null. `requires_coordinates` صحيح يعني أرسل `latitude` و`longitude`.","nullable":true,"properties":{"enabled":{"type":"boolean","description":"Always true when present.","x-description-ar":"صحيح دائماً عند وجوده."},"requires_coordinates":{"type":"boolean","description":"A fenced location checks GPS coordinates.","x-description-ar":"موقع مسيَّج يتحقق من إحداثيات GPS."},"location_name":{"type":"string","description":"The location named in warnings.","x-description-ar":"الموقع المذكور في التنبيهات."},"enforced_on_check_out":{"type":"boolean","description":"Check-out is fenced too.","x-description-ar":"الانصراف مسيَّج أيضاً."},"locations":{"type":"array","description":"Locations where check-in is allowed.","x-description-ar":"المواقع المسموح فيها بالحضور.","items":{"type":"object"}},"check_out_locations":{"type":"array","description":"Locations where check-out is allowed.","x-description-ar":"المواقع المسموح فيها بالانصراف.","items":{"type":"object"}}}},"tracks_breaks":{"type":"boolean","description":"True when the day records breaks; the fields below are then present.","x-description-ar":"صحيح إن كان اليوم يسجّل الاستراحات؛ وعندها تظهر الحقول التالية."},"state":{"type":"string","description":"`not_started`, `working`, `paused` or `ended`.","x-description-ar":"`not_started` لم يبدأ، `working` يعمل، `paused` في استراحة، `ended` انتهى.","enum":["not_started","working","paused","ended"]},"as_of":{"type":"string","description":"Server time the live numbers were computed at, UTC.","x-description-ar":"وقت الخادم الذي حُسبت عنده الأرقام الحية، UTC.","format":"date-time"},"ended_by":{"type":"string","description":"Tracked days: who ended the day.","x-description-ar":"الأيام المتتبَّعة: من أنهى اليوم.","nullable":true},"ended_at":{"type":"string","description":"Tracked days: when the day ended, UTC.","x-description-ar":"الأيام المتتبَّعة: وقت انتهاء اليوم UTC.","nullable":true},"worked_minutes":{"type":"integer","description":"Tracked days: minutes worked so far, net of breaks.","x-description-ar":"الأيام المتتبَّعة: دقائق العمل حتى الآن بعد الاستراحات."},"break_minutes":{"type":"integer","description":"Tracked days: minutes on break so far.","x-description-ar":"الأيام المتتبَّعة: دقائق الاستراحة حتى الآن."},"allowed_break_minutes":{"type":"integer","description":"Tracked days: break minutes the profile allows.","x-description-ar":"الأيام المتتبَّعة: دقائق الاستراحة المسموحة.","nullable":true},"current_period_started_at":{"type":"string","description":"Tracked days: start of the current work period, UTC.","x-description-ar":"الأيام المتتبَّعة: بداية فترة العمل الحالية UTC.","nullable":true},"paused_since":{"type":"string","description":"Tracked days: start of the running break, UTC.","x-description-ar":"الأيام المتتبَّعة: بداية الاستراحة الجارية UTC.","nullable":true},"breaks":{"type":"array","description":"Tracked days: the day's breaks.","x-description-ar":"الأيام المتتبَّعة: استراحات اليوم.","items":{"type":"object","properties":{"started_at":{"type":"string","description":"Break start, UTC.","x-description-ar":"بداية الاستراحة بتوقيت UTC.","format":"date-time"},"ended_at":{"type":"string","description":"Break end, UTC; null while the break is running.","x-description-ar":"نهاية الاستراحة بتوقيت UTC؛ null ما دامت جارية.","format":"date-time","nullable":true},"started_via":{"type":"string","description":"`app` or `device`.","x-description-ar":"`app` أو `device`.","nullable":true},"ended_via":{"type":"string","description":"`app` or `device`.","x-description-ar":"`app` أو `device`.","nullable":true},"started_device_name":{"type":"string","description":"Device that started the break.","x-description-ar":"الجهاز الذي بدأ الاستراحة.","nullable":true},"ended_device_name":{"type":"string","description":"Device that ended the break.","x-description-ar":"الجهاز الذي أنهى الاستراحة.","nullable":true}}}},"last_event":{"type":"object","description":"Tracked days: the last check-in, pause, resume or end: `source`, `device_name`, `at`.","x-description-ar":"الأيام المتتبَّعة: آخر حدث حضور أو استراحة أو استئناف أو إنهاء: `source` و`device_name` و`at`.","nullable":true}}},"attendance_device":{"type":"object","description":"One attendance device.","x-description-ar":"جهاز حضور واحد.","properties":{"id":{"type":"integer","description":"Device id.","x-description-ar":"رقم الجهاز."},"name":{"type":"string","description":"Name HR gave the device.","x-description-ar":"الاسم الذي أعطته الموارد البشرية للجهاز."},"serial_number":{"type":"string","description":"Serial number printed on the device; how QHR recognises it.","x-description-ar":"الرقم التسلسلي المطبوع على الجهاز، وبه يتعرّف QHR عليه."},"usage_mode":{"type":"string","description":"What a scan means: `check_in_only`, `check_out_only`, or `shared` (the device or the time of day decides in or out).","x-description-ar":"معنى البصمة: `check_in_only` حضور فقط، `check_out_only` انصراف فقط، أو `shared` يحدد الجهاز أو وقت اليوم الحضور أو الانصراف.","enum":["check_in_only","check_out_only","shared"]},"usage_mode_effective_from":{"type":"string","description":"Date the current usage mode applies from, in the device's timezone.","x-description-ar":"تاريخ سريان وضع الاستخدام الحالي بتوقيت الجهاز.","format":"date","nullable":true},"timezone":{"type":"string","description":"IANA timezone the device's clock runs in, e.g. `Asia/Riyadh`.","x-description-ar":"المنطقة الزمنية IANA لساعة الجهاز، مثل `Asia/Riyadh`."},"connection_state":{"type":"string","description":"`awaiting_connection` (registered, has never called QHR), `online`, `offline` (silent for over an hour) or `disabled` (switched off on purpose).","x-description-ar":"`awaiting_connection` مسجّل ولم يتصل بـ QHR بعد، `online` متصل، `offline` منقطع منذ أكثر من ساعة، `disabled` معطّل عمداً.","enum":["awaiting_connection","online","offline","disabled"]},"existing_software":{"type":"string","description":"Software the company used with the device before QHR, as typed at setup.","x-description-ar":"البرنامج الذي كانت الشركة تستخدمه مع الجهاز قبل QHR، كما كُتب عند الإعداد.","nullable":true},"manufacturer":{"type":"string","description":"Manufacturer name.","x-description-ar":"اسم الشركة المصنّعة.","nullable":true},"model":{"type":"string","description":"Model name (the name typed at setup for an unlisted model).","x-description-ar":"اسم الطراز (أو الاسم المكتوب عند الإعداد لطراز غير مدرج).","nullable":true},"firmware":{"type":"string","description":"Firmware version name.","x-description-ar":"اسم إصدار البرنامج الثابت.","nullable":true},"verified_combination":{"type":"boolean","description":"True when QHR has tested this model on this firmware, or the device has already connected. False only means \"not tested yet\".","x-description-ar":"صحيح إن كان QHR قد اختبر هذا الطراز على هذا الإصدار أو اتصل الجهاز فعلاً. الخطأ يعني «لم يُختبر بعد» فقط."},"location":{"type":"object","description":"Work location the device stands in: `id` and `name`.","x-description-ar":"موقع العمل الذي فيه الجهاز: `id` و`name`."},"last_contact_at":{"type":"string","description":"Last time the device called QHR, UTC ISO 8601.","x-description-ar":"آخر اتصال للجهاز بـ QHR بتوقيت UTC.","format":"date-time","nullable":true},"last_movement_at":{"type":"string","description":"Time of the latest scan, UTC ISO 8601.","x-description-ar":"وقت آخر بصمة بتوقيت UTC.","format":"date-time","nullable":true},"linked_employees_count":{"type":"integer","description":"Employees currently linked to a number on this device.","x-description-ar":"عدد الموظفين المرتبطين حالياً برقم على هذا الجهاز."},"pending_numbers_count":{"type":"integer","description":"Numbers that scanned on this device and belong to nobody yet.","x-description-ar":"أرقام بصمت على هذا الجهاز ولم تُربط بأي موظف بعد."},"created_by":{"type":"object","description":"Who registered the device: `id` and `name`.","x-description-ar":"من سجّل الجهاز: `id` و`name`.","nullable":true}}},"attendance_device_created":{"allOf":[{"$ref":"#/components/schemas/attendance_device"},{"type":"object","properties":{"setup":{"type":"object","description":"What IT types on the device: `server_address`, `server_port` and numbered `instructions` (`step`, `text`) in the caller's language.","x-description-ar":"ما يُدخله فريق تقنية المعلومات في الجهاز: `server_address` و`server_port` و`instructions` مرقّمة (`step` و`text`) بلغة المستدعي."}}}]},"attendance_device_link":{"type":"object","description":"One device number linked to one employee, for a period.","x-description-ar":"رقم واحد على الجهاز مرتبط بموظف واحد خلال فترة.","properties":{"id":{"type":"integer","description":"Link id.","x-description-ar":"رقم الربط."},"external_employee_no":{"type":"string","description":"The number the employee uses on the device. Leading zeros count: `0123` and `123` are different people.","x-description-ar":"الرقم الذي يستخدمه الموظف على الجهاز. الأصفار في البداية مهمة: `0123` و`123` شخصان مختلفان."},"created_via":{"type":"string","description":"`manual` (one at a time) or `csv` (the location sheet).","x-description-ar":"`manual` يدوياً أو `csv` من ملف الموقع.","enum":["manual","csv"]},"employee":{"type":"object","description":"The employee: `id`, `employee_no`, `full_name`.","x-description-ar":"الموظف: `id` و`employee_no` و`full_name`."},"effective_from":{"type":"string","description":"First day the link counts.","x-description-ar":"أول يوم يسري فيه الربط.","format":"date"},"effective_to":{"type":"string","description":"Last day it counted; null while the link is open.","x-description-ar":"آخر يوم سرى فيه؛ null ما دام الربط قائماً.","format":"date","nullable":true},"movements_count":{"type":"integer","description":"Scans this number made while linked to this employee.","x-description-ar":"عدد البصمات التي سجلها هذا الرقم أثناء ربطه بهذا الموظف."}}},"attendance_device_link_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_device_link"},"description":"The links on this page.","x-description-ar":"الروابط في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_device_movement":{"type":"object","description":"One scan, exactly as the device reported it.","x-description-ar":"بصمة واحدة كما أبلغ عنها الجهاز تماماً.","properties":{"id":{"type":"integer","description":"Movement id.","x-description-ar":"رقم الحركة."},"device":{"type":"object","description":"The device: `id` and `name` (`name` is null once the device was removed).","x-description-ar":"الجهاز: `id` و`name` (يكون `name` فارغاً بعد حذف الجهاز)."},"external_employee_no":{"type":"string","description":"Number the device reported.","x-description-ar":"الرقم الذي أبلغ عنه الجهاز."},"employee":{"type":"object","description":"The linked employee: `id` and `full_name`; null while the number belongs to nobody.","x-description-ar":"الموظف المرتبط: `id` و`full_name`؛ null ما دام الرقم غير مرتبط بأحد.","nullable":true},"occurred_at":{"type":"string","description":"When the person scanned, by the device's clock, UTC ISO 8601.","x-description-ar":"وقت البصمة حسب ساعة الجهاز بتوقيت UTC.","format":"date-time"},"received_at":{"type":"string","description":"When the scan reached QHR, UTC. Far from `occurred_at` when the device was offline.","x-description-ar":"وقت وصول البصمة إلى QHR بتوقيت UTC. يبتعد عن `occurred_at` إن كان الجهاز منقطعاً.","format":"date-time"},"effective_direction":{"type":"string","description":"`in` or `out` after the device's usage mode is applied.","x-description-ar":"`in` حضور أو `out` انصراف بعد تطبيق وضع استخدام الجهاز.","nullable":true},"raw_direction":{"type":"string","description":"Direction code the device itself sent.","x-description-ar":"رمز الاتجاه الذي أرسله الجهاز نفسه.","nullable":true},"verification_method":{"type":"string","description":"`fingerprint`, `card`, `face`, `password`, `fingerprint_password` or `card_fingerprint`.","x-description-ar":"طريقة التحقق: `fingerprint` بصمة، `card` بطاقة، `face` وجه، `password` كلمة مرور، أو مزيج منها.","nullable":true},"processing_state":{"type":"string","description":"`pending_link` (number belongs to nobody), `pending_processing`, `processed` (applied to attendance), `superseded`, `repeat_scan`, `review_required`, `failed` or `after_day_ended`.","x-description-ar":"`pending_link` الرقم غير مرتبط، `pending_processing` بانتظار المعالجة، `processed` طُبّقت على الحضور، `superseded` سبقها وقت أفضل، `repeat_scan` بصمة مكررة، `review_required` تحتاج مراجعة، `failed` فشلت، `after_day_ended` بعد إنهاء الموظف يومه.","enum":["pending_link","pending_processing","processed","superseded","repeat_scan","review_required","failed","after_day_ended"]},"processing_note":{"type":"string","description":"Why the scan stopped where it did, e.g. `day_ended_by_employee`.","x-description-ar":"سبب توقف البصمة عند حالتها، مثل `day_ended_by_employee`.","nullable":true},"attendance_record_id":{"type":"integer","description":"Attendance day this scan produced, when it produced one.","x-description-ar":"يوم الحضور الذي نتج عن هذه البصمة إن وُجد.","nullable":true}}},"attendance_device_movement_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_device_movement"},"description":"The scans on this page, newest first.","x-description-ar":"البصمات في هذه الصفحة، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_device_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_device"},"description":"The devices on this page.","x-description-ar":"الأجهزة في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_device_support_request":{"type":"object","description":"A support request with its details and QHR's messages.","x-description-ar":"طلب دعم بتفاصيله ورسائل QHR.","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"reference":{"type":"string","description":"Reference to quote to QHR, e.g. `DEV-1042`.","x-description-ar":"المرجع الذي تذكره لـ QHR، مثل `DEV-1042`."},"manufacturer":{"type":"string","description":"Manufacturer, as typed.","x-description-ar":"الشركة المصنّعة كما كُتبت."},"model":{"type":"string","description":"Model, as typed.","x-description-ar":"الطراز كما كُتب."},"status":{"type":"string","description":"`submitted`, `reviewed`, `in_progress`, `done` or `rejected`.","x-description-ar":"`submitted` أُرسل، `reviewed` رُوجع، `in_progress` قيد التنفيذ، `done` اكتمل، `rejected` رُفض.","enum":["submitted","reviewed","in_progress","done","rejected"]},"contact_email":{"type":"string","description":"Where QHR replies.","x-description-ar":"البريد الذي يرد عليه QHR."},"created_at":{"type":"string","description":"When it was raised, UTC.","x-description-ar":"وقت إرساله بتوقيت UTC.","format":"date-time"},"updated_at":{"type":"string","description":"Last change, UTC.","x-description-ar":"آخر تغيير بتوقيت UTC.","format":"date-time"},"last_message_at":{"type":"string","description":"When QHR last wrote, UTC; null before any reply.","x-description-ar":"آخر رسالة من QHR بتوقيت UTC؛ null قبل أي رد.","format":"date-time","nullable":true},"firmware":{"type":"string","description":"Firmware, as typed.","x-description-ar":"إصدار البرنامج الثابت كما كُتب.","nullable":true},"existing_software":{"type":"string","description":"Software used with the device today.","x-description-ar":"البرنامج المستخدم مع الجهاز حالياً.","nullable":true},"devices_count":{"type":"integer","description":"How many such devices the company has.","x-description-ar":"عدد هذه الأجهزة لدى الشركة.","nullable":true},"locations_count":{"type":"integer","description":"Across how many locations.","x-description-ar":"في كم موقع.","nullable":true},"notes":{"type":"string","description":"Free text from the company.","x-description-ar":"نص حر من الشركة.","nullable":true},"failure_context":{"type":"object","description":"What the setup wizard knew when it failed (device id, stage, model…).","x-description-ar":"ما كان يعرفه معالج الإعداد عند الفشل (رقم الجهاز، المرحلة، الطراز…)."},"attachments":{"type":"array","description":"Files attached: `id`, `title`, `filename`.","x-description-ar":"الملفات المرفقة: `id` و`title` و`filename`.","items":{"type":"object"}},"messages":{"type":"array","description":"What QHR sent, newest first: `subject`, `body`, `sent_at`.","x-description-ar":"ما أرسله QHR، الأحدث أولاً: `subject` و`body` و`sent_at`.","items":{"type":"object"}}}},"attendance_device_support_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_device_support_request_row"},"description":"The requests on this page, newest first.","x-description-ar":"الطلبات في هذه الصفحة، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_device_support_request_row":{"type":"object","description":"One support request in a list.","x-description-ar":"طلب دعم واحد في قائمة.","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"reference":{"type":"string","description":"Reference to quote to QHR, e.g. `DEV-1042`.","x-description-ar":"المرجع الذي تذكره لـ QHR، مثل `DEV-1042`."},"manufacturer":{"type":"string","description":"Manufacturer, as typed.","x-description-ar":"الشركة المصنّعة كما كُتبت."},"model":{"type":"string","description":"Model, as typed.","x-description-ar":"الطراز كما كُتب."},"status":{"type":"string","description":"`submitted`, `reviewed`, `in_progress`, `done` or `rejected`.","x-description-ar":"`submitted` أُرسل، `reviewed` رُوجع، `in_progress` قيد التنفيذ، `done` اكتمل، `rejected` رُفض.","enum":["submitted","reviewed","in_progress","done","rejected"]},"contact_email":{"type":"string","description":"Where QHR replies.","x-description-ar":"البريد الذي يرد عليه QHR."},"created_at":{"type":"string","description":"When it was raised, UTC.","x-description-ar":"وقت إرساله بتوقيت UTC.","format":"date-time"},"updated_at":{"type":"string","description":"Last change, UTC.","x-description-ar":"آخر تغيير بتوقيت UTC.","format":"date-time"},"last_message_at":{"type":"string","description":"When QHR last wrote, UTC; null before any reply.","x-description-ar":"آخر رسالة من QHR بتوقيت UTC؛ null قبل أي رد.","format":"date-time","nullable":true}}},"attendance_export_columns":{"type":"object","required":["columns"],"properties":{"columns":{"type":"array","description":"The columns, in their default order.","x-description-ar":"الأعمدة بترتيبها الافتراضي.","items":{"type":"object","properties":{"key":{"type":"string","description":"Column key, for `columns[]`.","x-description-ar":"مفتاح العمود، لـ `columns[]`."},"label":{"type":"string","description":"Column heading in the request's language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Ticked by default in the QHR app.","x-description-ar":"محدد افتراضياً في تطبيق QHR."},"type":{"type":"string","description":"`string`, `integer`, `number`, `date`, `datetime` or `enum`.","x-description-ar":"`string` أو `integer` أو `number` أو `date` أو `datetime` أو `enum`."}}}}}},"attendance_export_queued":{"type":"object","properties":{"export":{"type":"object","description":"The queued export; follow it in your exports history.","x-description-ar":"التصدير المنتظر؛ تابعه في سجل تصديراتك.","properties":{"id":{"type":"integer","description":"Export id.","x-description-ar":"رقم التصدير."},"page":{"type":"string","description":"The page exported.","x-description-ar":"الصفحة المصدَّرة."},"format":{"type":"string","description":"`xlsx` or `csv`.","x-description-ar":"`xlsx` أو `csv`."},"status":{"type":"string","description":"`queued`, then `processing`, then `ready`.","x-description-ar":"`queued` ثم `processing` ثم `ready`."},"total_records":{"type":"integer","description":"Records being exported.","x-description-ar":"عدد السجلات الجاري تصديرها."},"filename":{"type":"string","description":"The file's name.","x-description-ar":"اسم الملف."},"download_url":{"type":"string","description":"`/open/v1/exports/{id}/download` (`exports.download`) once `ready`; null before.","x-description-ar":"`/open/v1/exports/{id}/download` (`exports.download`) عند `ready`؛ وnull قبل ذلك.","nullable":true}}}}},"attendance_log_overview":{"type":"object","description":"Row counts per status for the period, and per day.","x-description-ar":"عدد الصفوف لكل حالة في الفترة ولكل يوم.","properties":{"counts":{"type":"object","description":"Rows per status over the whole period; `all` is their sum.","x-description-ar":"عدد الصفوف لكل حالة في الفترة كلها؛ و`all` مجموعها.","properties":{"all":{"type":"integer","description":"Every row.","x-description-ar":"كل الصفوف."},"present":{"type":"integer","description":"Completed on time.","x-description-ar":"يوم مكتمل في الموعد."},"late":{"type":"integer","description":"Late arrival counted.","x-description-ar":"تأخر محتسب."},"early_leave":{"type":"integer","description":"Left early (and not late).","x-description-ar":"خروج مبكر (دون تأخر)."},"working":{"type":"integer","description":"Checked in, day still open.","x-description-ar":"سجّل دخوله واليوم ما زال مفتوحاً."},"missing_check_out":{"type":"integer","description":"Checked in, day over, no check-out.","x-description-ar":"سجّل دخوله وانتهى اليوم دون تسجيل خروج."},"absent":{"type":"integer","description":"Absent.","x-description-ar":"غائب."},"on_leave":{"type":"integer","description":"On leave.","x-description-ar":"في إجازة."}}},"days":{"type":"array","description":"One entry per date that has rows, oldest first, with the same per-status counts.","x-description-ar":"عنصر لكل تاريخ فيه صفوف، الأقدم أولاً، بالأعداد نفسها لكل حالة.","items":{"type":"object","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"present":{"type":"integer","description":"Completed on time.","x-description-ar":"يوم مكتمل في الموعد."},"late":{"type":"integer","description":"Late arrival counted.","x-description-ar":"تأخر محتسب."},"early_leave":{"type":"integer","description":"Left early (and not late).","x-description-ar":"خروج مبكر (دون تأخر)."},"working":{"type":"integer","description":"Checked in, day still open.","x-description-ar":"سجّل دخوله واليوم ما زال مفتوحاً."},"missing_check_out":{"type":"integer","description":"Checked in, day over, no check-out.","x-description-ar":"سجّل دخوله وانتهى اليوم دون تسجيل خروج."},"absent":{"type":"integer","description":"Absent.","x-description-ar":"غائب."},"on_leave":{"type":"integer","description":"On leave.","x-description-ar":"في إجازة."}}}},"rest_days":{"type":"array","description":"Dates in the period on which every recorded employee had a weekend or a holiday.","x-description-ar":"تواريخ الفترة التي كانت عطلة نهاية أسبوع أو عطلة رسمية لكل الموظفين المسجلين.","items":{"type":"string","format":"date"}},"period":{"type":"object","description":"The period used, after defaults.","x-description-ar":"الفترة المستخدمة بعد تطبيق القيم الافتراضية.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"}}},"today":{"type":"string","description":"Today in the company's timezone; today's numbers are still partial.","x-description-ar":"تاريخ اليوم بتوقيت الشركة؛ أرقام اليوم ما زالت جزئية.","format":"date"}}},"attendance_log_page":{"type":"object","required":["timezone","records","pagination"],"properties":{"timezone":{"type":"string","description":"The company's timezone; show the UTC times in it.","x-description-ar":"المنطقة الزمنية للشركة؛ اعرض أوقات UTC بها."},"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_log_row"},"description":"The rows on this page, newest day first.","x-description-ar":"صفوف هذه الصفحة، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_log_row":{"type":"object","description":"One employee's working day.","x-description-ar":"يوم عمل لموظف واحد.","properties":{"id":{"type":"integer","description":"Attendance record id.","x-description-ar":"رقم سجل الحضور."},"date":{"type":"string","description":"The working day, in the company's timezone.","x-description-ar":"يوم العمل بتوقيت الشركة.","format":"date"},"employee":{"type":"object","description":"Who (people who have since left are kept).","x-description-ar":"الموظف (يبقى من غادر لاحقاً).","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل.","nullable":true},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true}}},"check_in":{"type":"object","description":"The check-in.","x-description-ar":"تسجيل الدخول.","properties":{"at":{"type":"string","description":"Time, UTC ISO-8601; null when there is none.","x-description-ar":"الوقت بتوقيت UTC بصيغة ISO-8601؛ null إن لم يوجد.","format":"date-time","nullable":true},"late_minutes":{"type":"integer","description":"Counted minutes late; null when not late.","x-description-ar":"دقائق التأخير المحتسبة؛ null إن لم يتأخر.","nullable":true},"source":{"type":"string","description":"`mobile`, `web`, `app`, `device`, `manual` or `system` (closed automatically); null with no time.","x-description-ar":"`mobile` أو `web` أو `app` أو `device` أو `manual` أو `system` (إغلاق تلقائي)؛ null إن لم يوجد وقت.","nullable":true},"location":{"type":"object","nullable":true,"description":"The location it was attributed to.","x-description-ar":"الموقع الذي نُسب إليه.","properties":{"id":{"type":"integer","description":"Location id.","x-description-ar":"رقم الموقع."},"name":{"type":"string","description":"Location name.","x-description-ar":"اسم الموقع."}}},"remote":{"type":"boolean","description":"True when punched as remote work.","x-description-ar":"صحيح إن سُجّل كعمل عن بُعد.","nullable":true},"distance_m":{"type":"integer","description":"Distance from the location in metres, for information only.","x-description-ar":"المسافة عن الموقع بالأمتار، للعلم فقط.","nullable":true}}},"check_out":{"type":"object","description":"The check-out.","x-description-ar":"تسجيل الخروج.","properties":{"at":{"type":"string","description":"Time, UTC ISO-8601; null when there is none.","x-description-ar":"الوقت بتوقيت UTC بصيغة ISO-8601؛ null إن لم يوجد.","format":"date-time","nullable":true},"early_minutes":{"type":"integer","description":"Counted minutes left early; null when not early.","x-description-ar":"دقائق الخروج المبكر المحتسبة؛ null إن لم يخرج مبكراً.","nullable":true},"source":{"type":"string","description":"`mobile`, `web`, `app`, `device`, `manual` or `system` (closed automatically); null with no time.","x-description-ar":"`mobile` أو `web` أو `app` أو `device` أو `manual` أو `system` (إغلاق تلقائي)؛ null إن لم يوجد وقت.","nullable":true},"location":{"type":"object","nullable":true,"description":"The location it was attributed to.","x-description-ar":"الموقع الذي نُسب إليه.","properties":{"id":{"type":"integer","description":"Location id.","x-description-ar":"رقم الموقع."},"name":{"type":"string","description":"Location name.","x-description-ar":"اسم الموقع."}}},"remote":{"type":"boolean","description":"True when punched as remote work.","x-description-ar":"صحيح إن سُجّل كعمل عن بُعد.","nullable":true},"distance_m":{"type":"integer","description":"Distance from the location in metres, for information only.","x-description-ar":"المسافة عن الموقع بالأمتار، للعلم فقط.","nullable":true}}},"worked_minutes":{"type":"integer","description":"Minutes worked (net of breaks); null until the day has hours.","x-description-ar":"دقائق العمل (بعد خصم الاستراحات)؛ null حتى تُحتسب ساعات اليوم.","nullable":true},"status":{"type":"string","description":"`present`, `late`, `early_leave`, `working`, `missing_check_out`, `absent` or `on_leave`. Late wins over early leave.","x-description-ar":"`present` أو `late` أو `early_leave` أو `working` أو `missing_check_out` أو `absent` أو `on_leave`. التأخر يتقدم على الخروج المبكر."}}},"attendance_log_summary":{"type":"object","description":"Punctuality and punch-source insights over the filtered rows.","x-description-ar":"مؤشرات الانضباط في المواعيد ومصادر التسجيل للصفوف المصفّاة.","properties":{"punctuality":{"type":"object","description":"How many completed days started on time.","x-description-ar":"كم يوماً مكتملاً بدأ في الموعد.","properties":{"completed_check_ins":{"type":"integer","description":"Completed days: status present, early_leave or late (open days and missing check-outs are left out).","x-description-ar":"الأيام المكتملة: الحالة present أو early_leave أو late (تُستبعد الأيام المفتوحة وحالات عدم تسجيل الخروج)."},"on_time":{"type":"integer","description":"Completed days without a counted late arrival.","x-description-ar":"الأيام المكتملة دون تأخر محتسب."},"on_time_rate":{"type":"number","description":"on_time ÷ completed_check_ins × 100, one decimal; null with no completed day.","x-description-ar":"on_time ÷ completed_check_ins × ١٠٠ بمنزلة عشرية واحدة؛ null إن لم يوجد يوم مكتمل.","nullable":true},"median_check_in":{"type":"string","description":"Median check-in time of day, `HH:MM` in the company's timezone; null with no check-in.","x-description-ar":"الوسيط لوقت تسجيل الدخول `HH:MM` بتوقيت الشركة؛ null إن لم يوجد تسجيل دخول.","nullable":true}}},"sources":{"type":"object","description":"How people punched. Counts punches, not days: a day with a check-in and a check-out counts twice.","x-description-ar":"طريقة التسجيل. يعدّ التسجيلات لا الأيام: اليوم الذي فيه دخول وخروج يُعدّ مرتين.","properties":{"total":{"type":"integer","description":"All punches.","x-description-ar":"كل التسجيلات."},"items":{"type":"array","description":"Each source that has punches, most used first.","x-description-ar":"كل مصدر له تسجيلات، الأكثر استخداماً أولاً.","items":{"type":"object","properties":{"source":{"type":"string","description":"`mobile`, `web`, `app`, `device`, `manual` or `system`.","x-description-ar":"`mobile` أو `web` أو `app` أو `device` أو `manual` أو `system`."},"count":{"type":"integer","description":"Punches from it.","x-description-ar":"عدد التسجيلات منه."}}}}}}}},"attendance_profile":{"type":"object","description":"An attendance profile: the working-time rules for the employees on it.","x-description-ar":"ملف حضور: قواعد وقت العمل للموظفين المسجلين عليه.","properties":{"id":{"type":"integer","description":"Profile id; null only for the built-in default of a company with no saved profile.","x-description-ar":"رقم الملف؛ يكون null فقط للملف الافتراضي المدمج لشركة لم تحفظ أي ملف.","nullable":true},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"name_en":{"type":"string","description":"Name in English, unique in the company.","x-description-ar":"الاسم بالإنجليزية، فريد في الشركة."},"name_ar":{"type":"string","description":"Name in Arabic, unique in the company.","x-description-ar":"الاسم بالعربية، فريد في الشركة."},"is_default":{"type":"boolean","description":"True for the company's default profile, used by every employee with no other profile.","x-description-ar":"صحيح للملف الافتراضي للشركة، ويُطبَّق على كل موظف ليس له ملف آخر."},"work_start_time":{"type":"string","description":"Work starts, `HH:MM`, company time.","x-description-ar":"بداية الدوام `HH:MM` بتوقيت الشركة.","nullable":true},"work_end_time":{"type":"string","description":"Work ends, `HH:MM`; earlier than the start means a night shift ending the next day.","x-description-ar":"نهاية الدوام `HH:MM`؛ إن كانت قبل البداية فهي وردية ليلية تنتهي في اليوم التالي.","nullable":true},"daily_target_hours":{"type":"number","description":"Hours owed on a working day.","x-description-ar":"الساعات المطلوبة في يوم العمل."},"weekly_target_hours":{"type":"number","description":"Hours owed in a week, derived from the days off and day shifts.","x-description-ar":"الساعات المطلوبة في الأسبوع، تُحسب من أيام الراحة وورديات الأيام."},"weekly_target_days":{"type":"integer","description":"Working days in a week (7 minus the days off).","x-description-ar":"أيام العمل في الأسبوع (7 ناقص أيام الراحة)."},"days_off":{"type":"array","description":"The profile's days off, 0 (Sunday) to 6 (Saturday).","x-description-ar":"أيام الراحة في الملف، من 0 (الأحد) إلى 6 (السبت).","items":{"type":"integer","minimum":0,"maximum":6}},"correction_requests_enabled":{"type":"boolean","description":"Employees may ask to correct a missed or wrong check-in.","x-description-ar":"يمكن للموظفين طلب تصحيح تسجيل حضور فائت أو خاطئ."},"correction_request_limit_days":{"type":"integer","description":"How many days back a correction may be asked for.","x-description-ar":"عدد الأيام السابقة التي يمكن طلب تصحيحها.","nullable":true},"correction_approved_by":{"type":"string","description":"Who approves correction and permission requests: `manager`, `hr` or `manager_and_hr` (the manager, then HR).","x-description-ar":"من يعتمد طلبات التصحيح والاستئذان: `manager` المدير، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["manager","hr","manager_and_hr"],"nullable":true},"permission_requests_enabled":{"type":"boolean","description":"Employees may ask permission to arrive late or leave early.","x-description-ar":"يمكن للموظفين طلب استئذان للتأخر أو الخروج المبكر."},"grace_period_enabled":{"type":"boolean","description":"A late arrival within the grace period is not counted late.","x-description-ar":"التأخر ضمن فترة السماح لا يُحتسب تأخيراً."},"grace_period_minutes":{"type":"integer","description":"Grace period in minutes.","x-description-ar":"فترة السماح بالدقائق.","nullable":true},"auto_absent_after_minutes":{"type":"integer","description":"Minutes after the start with no check-in before the day is marked absent.","x-description-ar":"الدقائق بعد بداية الدوام دون تسجيل حضور قبل احتساب اليوم غياباً.","nullable":true},"track_breaks":{"type":"boolean","description":"Breaks are recorded and deducted from the hours worked.","x-description-ar":"تُسجَّل الاستراحات وتُخصم من ساعات العمل."},"allowed_break_minutes":{"type":"integer","description":"Break minutes a day allowed when breaks are tracked.","x-description-ar":"دقائق الاستراحة المسموحة يومياً عند تتبع الاستراحات.","nullable":true},"assigned_employees_count":{"type":"integer","description":"Employees on this profile today.","x-description-ar":"عدد الموظفين على هذا الملف اليوم."},"day_shifts":{"type":"array","items":{"$ref":"#/components/schemas/attendance_profile_day_shift"},"description":"Per-weekday shifts; a weekday with none uses the work start and end times.","x-description-ar":"ورديات أيام الأسبوع؛ اليوم الذي ليست له وردية يتبع وقتي بداية الدوام ونهايته."}}},"attendance_profile_assignment_input":{"type":"object","required":["attendance_profile_assignment"],"properties":{"attendance_profile_assignment":{"type":"object","required":["attendance_setting_id","employee_ids"],"description":"Who moves, to which profile, from when.","x-description-ar":"من يُنقل، وإلى أي ملف، ومن أي تاريخ.","properties":{"attendance_setting_id":{"type":"integer","description":"The profile to move to, from `attendance_profiles.list`.","x-description-ar":"الملف المنقول إليه، من `attendance_profiles.list`."},"employee_ids":{"type":"array","description":"Employees to move, 1 to 500, from `employees.list`.","x-description-ar":"الموظفون المراد نقلهم، من 1 إلى 500، من `employees.list`.","items":{"type":"integer"}},"effective_from":{"type":"string","description":"First day on the new profile, tomorrow at the earliest; tomorrow when omitted.","x-description-ar":"أول يوم على الملف الجديد، غداً على الأقرب؛ غداً إن لم يُرسل.","format":"date"}}}}},"attendance_profile_assignment_preview":{"type":"object","description":"What a bulk move would do, per employee.","x-description-ar":"ما سيفعله النقل الجماعي لكل موظف.","properties":{"effective_from":{"type":"string","description":"The date the move would start.","x-description-ar":"التاريخ الذي يبدأ فيه النقل.","format":"date"},"employees":{"type":"array","description":"One row per selected employee, ordered by id.","x-description-ar":"صف لكل موظف محدد، مرتباً حسب الرقم.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"current_profile":{"type":"object","description":"The profile the employee is on today.","x-description-ar":"الملف الذي يتبعه الموظف اليوم.","properties":{"id":{"type":"integer","description":"Profile id; null for the built-in default when the company has saved no profile yet.","x-description-ar":"رقم الملف؛ null للملف الافتراضي المدمج إن لم تحفظ الشركة أي ملف بعد.","nullable":true},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}}},"new_profile":{"type":"object","description":"The profile they would move to.","x-description-ar":"الملف الذي سيُنقل إليه.","properties":{"id":{"type":"integer","description":"Profile id; null for the built-in default when the company has saved no profile yet.","x-description-ar":"رقم الملف؛ null للملف الافتراضي المدمج إن لم تحفظ الشركة أي ملف بعد.","nullable":true},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}}},"replaces_existing_change":{"type":"boolean","description":"True when a change already starts on that date; it would be replaced.","x-description-ar":"صحيح إن كان هناك تغيير يبدأ في التاريخ نفسه؛ وسيُستبدل."},"existing_change":{"type":"object","description":"The profile of the change that would be replaced.","x-description-ar":"ملف التغيير الذي سيُستبدل.","properties":{"id":{"type":"integer","description":"Profile id; null for the built-in default when the company has saved no profile yet.","x-description-ar":"رقم الملف؛ null للملف الافتراضي المدمج إن لم تحفظ الشركة أي ملف بعد.","nullable":true},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}},"nullable":true}}}}}},"attendance_profile_assignment_result":{"type":"object","description":"The employees moved.","x-description-ar":"الموظفون الذين نُقلوا.","properties":{"employees":{"type":"array","description":"One row per employee, ordered by id.","x-description-ar":"صف لكل موظف، مرتباً حسب الرقم.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"assignment_id":{"type":"integer","description":"Id of the saved profile change.","x-description-ar":"رقم تغيير الملف المحفوظ."},"effective_from":{"type":"string","description":"First day on the new profile.","x-description-ar":"أول يوم على الملف الجديد.","format":"date"},"changed":{"type":"boolean","description":"False when the employee was already on that profile on that date.","x-description-ar":"خطأ إن كان الموظف على هذا الملف أصلاً في ذلك التاريخ."}}}}}},"attendance_profile_day_shift":{"type":"object","description":"The shift of one weekday. A `rigid` shift starts at `start_time` and lasts the daily target; a `flexible` one has hours only, no start time.","x-description-ar":"وردية يوم واحد من الأسبوع. الوردية `rigid` تبدأ في `start_time` وتستمر الساعات اليومية المستهدفة؛ أما `flexible` فلها ساعات فقط بلا وقت بداية.","properties":{"id":{"type":"integer","description":"Day shift id; send it back to change or remove this shift.","x-description-ar":"رقم الوردية؛ أرسله لتعديلها أو حذفها."},"name":{"type":"string","description":"Shift name, e.g. `Morning`.","x-description-ar":"اسم الوردية، مثل `Morning`."},"day_of_week":{"type":"integer","description":"Weekday, 0 (Sunday) to 6 (Saturday).","x-description-ar":"اليوم من 0 (الأحد) إلى 6 (السبت).","minimum":0,"maximum":6},"kind":{"type":"string","description":"`rigid` (fixed start) or `flexible` (hours only).","x-description-ar":"`rigid` بداية ثابتة أو `flexible` ساعات فقط.","enum":["rigid","flexible"]},"start_time":{"type":"string","description":"Start, `HH:MM`, company time; null on a flexible day.","x-description-ar":"وقت البداية `HH:MM` بتوقيت الشركة؛ null في اليوم المرن.","nullable":true},"required_hours":{"type":"number","description":"Hours the day lasts.","x-description-ar":"عدد ساعات اليوم."},"location_id":{"type":"integer","description":"Location the shift is worked at, if any.","x-description-ar":"موقع العمل في هذه الوردية إن وُجد.","nullable":true},"location_name":{"type":"string","description":"That location's name.","x-description-ar":"اسم ذلك الموقع.","nullable":true}}},"attendance_profile_employee_profile":{"type":"object","description":"The profile an employee is on today, and the change scheduled for later, if any.","x-description-ar":"الملف الذي يتبعه الموظف اليوم، والتغيير المجدول لاحقاً إن وُجد.","properties":{"current":{"$ref":"#/components/schemas/attendance_profile"},"effective_from":{"type":"string","description":"Date the current profile started; null when the employee was never moved and is on their contract's profile or the company default.","x-description-ar":"تاريخ بدء الملف الحالي؛ null إن لم يُنقل الموظف قط وكان على ملف عقده أو الملف الافتراضي.","format":"date","nullable":true},"scheduled":{"type":"object","description":"The next scheduled change, or null.","x-description-ar":"التغيير المجدول التالي، أو null.","nullable":true,"properties":{"attendance_profile":{"$ref":"#/components/schemas/attendance_profile"},"effective_from":{"type":"string","description":"Date the change starts.","x-description-ar":"تاريخ بدء التغيير.","format":"date"}}}}},"attendance_profile_input":{"type":"object","description":"The profile's fields. On update, send only what changes.","x-description-ar":"حقول الملف. عند التعديل أرسل ما يتغير فقط.","properties":{"name_en":{"type":"string","description":"Name in English, unique in the company.","x-description-ar":"الاسم بالإنجليزية، فريد في الشركة."},"name_ar":{"type":"string","description":"Name in Arabic, unique in the company.","x-description-ar":"الاسم بالعربية، فريد في الشركة."},"is_default":{"type":"boolean","description":"Make this the company's default profile (the previous default stops being one). Cannot be turned off directly: make another profile the default instead.","x-description-ar":"اجعل هذا الملف الافتراضي للشركة (ويتوقف الافتراضي السابق عن ذلك). لا يمكن إلغاؤه مباشرة: اجعل ملفاً آخر هو الافتراضي."},"work_start_time":{"type":"string","description":"Work starts, `HH:MM`, company time.","x-description-ar":"بداية الدوام `HH:MM` بتوقيت الشركة."},"work_end_time":{"type":"string","description":"Work ends, `HH:MM`; must differ from the start. An end before the start is a night shift, whose length must equal `daily_target_hours`.","x-description-ar":"نهاية الدوام `HH:MM`، ويجب أن تختلف عن البداية. النهاية قبل البداية وردية ليلية يجب أن يساوي طولها `daily_target_hours`."},"daily_target_hours":{"type":"number","description":"Hours owed on a working day, 1 to 24.","x-description-ar":"الساعات المطلوبة في يوم العمل، من 1 إلى 24."},"days_off":{"type":"array","description":"Days off, 0 (Sunday) to 6 (Saturday); at least one working day must remain. Omitted on create: no day off. Omitted on update: unchanged.","x-description-ar":"أيام الراحة من 0 (الأحد) إلى 6 (السبت)، ويجب أن يبقى يوم عمل واحد على الأقل. إن لم تُرسل عند الإنشاء فلا يوم راحة، وعند التعديل تبقى كما هي.","items":{"type":"integer","minimum":0,"maximum":6}},"correction_requests_enabled":{"type":"boolean","description":"Allow correction requests.","x-description-ar":"السماح بطلبات التصحيح."},"correction_request_limit_days":{"type":"integer","description":"Days back a correction may be asked for, 1 to 90.","x-description-ar":"عدد الأيام السابقة الممكن طلب تصحيحها، من 1 إلى 90."},"correction_approved_by":{"type":"string","description":"Who approves correction and permission requests: `manager`, `hr` or `manager_and_hr` (the manager, then HR).","x-description-ar":"من يعتمد طلبات التصحيح والاستئذان: `manager` المدير، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["manager","hr","manager_and_hr"]},"permission_requests_enabled":{"type":"boolean","description":"Allow permission (late arrival / early leave) requests.","x-description-ar":"السماح بطلبات الاستئذان (تأخر أو خروج مبكر)."},"grace_period_enabled":{"type":"boolean","description":"Use a grace period for late arrivals.","x-description-ar":"تفعيل فترة السماح للتأخر."},"grace_period_minutes":{"type":"integer","description":"Grace period, 0 to 120 minutes.","x-description-ar":"فترة السماح من 0 إلى 120 دقيقة."},"auto_absent_after_minutes":{"type":"integer","description":"Mark absent after this many minutes with no check-in, 1 to 720; more than the grace period.","x-description-ar":"احتساب الغياب بعد هذا العدد من الدقائق دون تسجيل حضور، من 1 إلى 720، وأكثر من فترة السماح."},"track_breaks":{"type":"boolean","description":"Record breaks and deduct them from hours worked.","x-description-ar":"تسجيل الاستراحات وخصمها من ساعات العمل."},"allowed_break_minutes":{"type":"integer","description":"Allowed break a day, 0 to 480 minutes, shorter than the working day.","x-description-ar":"الاستراحة المسموحة يومياً من 0 إلى 480 دقيقة، وأقصر من يوم العمل."},"day_shifts_attributes":{"type":"array","description":"Day shifts to add, change (with `id`) or remove (`id` + `_destroy: true`). One per weekday, never on a day off.","x-description-ar":"ورديات الأيام للإضافة، أو التعديل (مع `id`)، أو الحذف (`id` مع `_destroy: true`). وردية واحدة لكل يوم، وليست في يوم راحة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Existing day shift id, to change or remove it.","x-description-ar":"رقم وردية موجودة لتعديلها أو حذفها."},"name":{"type":"string","description":"Shift name.","x-description-ar":"اسم الوردية."},"day_of_week":{"type":"integer","description":"Weekday, 0 (Sunday) to 6 (Saturday).","x-description-ar":"اليوم من 0 (الأحد) إلى 6 (السبت)."},"kind":{"type":"string","description":"`rigid` or `flexible`.","x-description-ar":"`rigid` ثابتة أو `flexible` مرنة.","enum":["rigid","flexible"]},"start_time":{"type":"string","description":"Start, `HH:MM`; required on a rigid day, ignored on a flexible one.","x-description-ar":"وقت البداية `HH:MM`؛ مطلوب في اليوم الثابت ويُتجاهل في المرن."},"required_hours":{"type":"number","description":"Hours; on a rigid day it must equal `daily_target_hours`.","x-description-ar":"عدد الساعات؛ في اليوم الثابت يجب أن يساوي `daily_target_hours`."},"location_id":{"type":"integer","description":"Location of the shift, from `employees.meta_data` (`locations`).","x-description-ar":"موقع الوردية، من `employees.meta_data` (`locations`)."},"_destroy":{"type":"boolean","description":"True to remove this shift.","x-description-ar":"صحيح لحذف هذه الوردية."}}}}}},"attendance_profile_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_profile"},"description":"The profiles on this page, newest first.","x-description-ar":"الملفات في هذه الصفحة، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_profile_schedule":{"type":"object","required":["week_start","records","pagination"],"description":"One page of active employees across one week, Sunday first.","x-description-ar":"صفحة من الموظفين النشطين على مدى أسبوع واحد، يبدأ بالأحد.","properties":{"week_start":{"type":"string","description":"The Sunday the week starts on.","x-description-ar":"يوم الأحد الذي يبدأ به الأسبوع.","format":"date"},"records":{"type":"array","description":"One row per employee, ordered by name.","x-description-ar":"صف لكل موظف، مرتباً حسب الاسم.","items":{"type":"object","properties":{"employee":{"type":"object","description":"The employee: `id`, `name`, `employee_no`.","x-description-ar":"الموظف: `id` و`name` و`employee_no`."},"cells":{"type":"array","items":{"type":"object","description":"One employee on one day.","x-description-ar":"موظف واحد في يوم واحد.","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"profile":{"type":"object","description":"The profile in force that day (`id`, `name`).","x-description-ar":"الملف المطبق في ذلك اليوم (`id` و`name`)."},"kind":{"type":"string","description":"`working`, `day_off`, `holiday` or `leave` (approved leave).","x-description-ar":"`working` يوم عمل، `day_off` راحة، `holiday` عطلة رسمية، `leave` إجازة معتمدة.","enum":["working","day_off","holiday","leave"]},"window":{"type":"object","description":"Shift window `{ start, end }` (`HH:MM`, company time); null on a non-working or flexible day.","x-description-ar":"نافذة الوردية `{ start, end }` (`HH:MM` بتوقيت الشركة)؛ null في غير أيام العمل أو اليوم المرن.","nullable":true},"shift_kind":{"type":"string","description":"`rigid` or `flexible` when the weekday has a day shift; null otherwise.","x-description-ar":"`rigid` أو `flexible` إن كانت لليوم وردية؛ وإلا null.","nullable":true},"scheduled_hours":{"type":"number","description":"Hours scheduled; null when the day owes none.","x-description-ar":"الساعات المجدولة؛ null إن لم يُطلب فيه شيء.","nullable":true},"location_id":{"type":"integer","description":"Location of the day shift, if any.","x-description-ar":"موقع وردية اليوم إن وُجد.","nullable":true},"locked":{"type":"boolean","description":"True for today, past days and days of approved leave: they can no longer change.","x-description-ar":"صحيح لليوم الحالي والأيام الماضية وأيام الإجازة المعتمدة: لم يعد تغييرها ممكناً."},"required_hours":{"type":"number","description":"Hours owed at work (hours permission only).","x-description-ar":"الساعات المطلوبة في العمل (بصلاحية الساعات فقط)."},"worked_hours":{"type":"number","description":"Hours worked; so far for today; null for future days (hours permission only).","x-description-ar":"الساعات المعمولة، وحتى الآن لليوم؛ null للأيام القادمة (بصلاحية الساعات فقط).","nullable":true},"status":{"type":"string","description":"Attendance status of the day, e.g. `present`, `late`, `absent`, `incomplete`, `not_started` (hours permission only).","x-description-ar":"حالة الحضور في اليوم، مثل `present` و`late` و`absent` و`incomplete` و`not_started` (بصلاحية الساعات فقط).","nullable":true},"met":{"type":"boolean","description":"Whether the required hours were met; null for today and future days (hours permission only).","x-description-ar":"هل اكتملت الساعات المطلوبة؛ null لليوم والأيام القادمة (بصلاحية الساعات فقط).","nullable":true}}},"description":"Seven days, Sunday to Saturday.","x-description-ar":"سبعة أيام من الأحد إلى السبت."},"hours":{"type":"object","description":"Week totals over completed days: `worked_hours`, `required_hours`, `full_week_required_hours`, `percent`, `status` (`under`, `met`, `over`). Only with the hours permission.","x-description-ar":"مجاميع الأسبوع للأيام المكتملة: `worked_hours` و`required_hours` و`full_week_required_hours` و`percent` و`status` (`under` أو `met` أو `over`). مع صلاحية الساعات فقط."}}}},"page_summary":{"type":"object","description":"This page's totals: `worked_hours`, `required_hours`, `percent`. Only with the hours permission.","x-description-ar":"مجاميع هذه الصفحة: `worked_hours` و`required_hours` و`percent`. مع صلاحية الساعات فقط."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_record":{"type":"object","description":"One employee's attendance on one work date.","x-description-ar":"حضور موظف واحد في تاريخ عمل واحد.","required":["id","date","status"],"properties":{"id":{"type":"integer","description":"Attendance record id.","x-description-ar":"رقم سجل الحضور."},"date":{"type":"string","description":"Work date, in the company's timezone. A night shift belongs to the date it started.","x-description-ar":"تاريخ العمل بتوقيت الشركة. الوردية الليلية تتبع تاريخ بدايتها.","format":"date"},"status":{"type":"string","description":"`present`, `late` (arrived after the start plus the grace period), `incomplete` (checked in, not out), `absent`, `on_leave`, `holiday` or `weekend`. An early leave stays `present`; it shows in `incidents`.","x-description-ar":"`present` حاضر، `late` متأخر (بعد بداية الدوام وفترة السماح)، `incomplete` سجّل حضوراً دون انصراف، `absent` غائب، `on_leave` في إجازة، `holiday` عطلة رسمية، `weekend` عطلة أسبوعية. الخروج المبكر يبقى `present` ويظهر في `incidents`.","enum":["present","late","incomplete","absent","on_leave","holiday","weekend"]},"check_in_at":{"type":"string","description":"Check-in time, UTC.","x-description-ar":"وقت الحضور بتوقيت UTC.","format":"date-time","nullable":true},"check_out_at":{"type":"string","description":"Check-out time, UTC.","x-description-ar":"وقت الانصراف بتوقيت UTC.","format":"date-time","nullable":true},"hours_worked":{"type":"number","description":"Hours worked, net of breaks on a day that tracks breaks; null until the day is closed.","x-description-ar":"ساعات العمل، بعد خصم الاستراحات في الأيام التي تتبعها؛ null حتى يُغلق اليوم.","nullable":true},"check_in_source":{"type":"string","description":"How that side was recorded: `app` (the QHR app or this API), `device` (a fingerprint or face device), `manual` (corrected by a manager or HR); null when there is no time.","x-description-ar":"طريقة تسجيل هذا الطرف: `app` من تطبيق QHR أو هذه الواجهة، `device` من جهاز بصمة أو وجه، `manual` تصحيح من المدير أو الموارد البشرية؛ null إن لم يوجد وقت.","nullable":true,"enum":["app","device","manual",null]},"check_out_source":{"type":"string","description":"How that side was recorded: `app` (the QHR app or this API), `device` (a fingerprint or face device), `manual` (corrected by a manager or HR); null when there is no time.","x-description-ar":"طريقة تسجيل هذا الطرف: `app` من تطبيق QHR أو هذه الواجهة، `device` من جهاز بصمة أو وجه، `manual` تصحيح من المدير أو الموارد البشرية؛ null إن لم يوجد وقت.","nullable":true,"enum":["app","device","manual",null]},"check_in_device":{"type":"object","description":"The device scan behind that side, when it came from a device.","x-description-ar":"مسح الجهاز وراء هذا الطرف، إن جاء من جهاز.","nullable":true,"properties":{"name":{"type":"string","description":"Device name.","x-description-ar":"اسم الجهاز.","nullable":true},"external_employee_no":{"type":"string","description":"The employee's number on the device.","x-description-ar":"رقم الموظف على الجهاز."}}},"check_out_device":{"type":"object","description":"The device scan behind that side, when it came from a device.","x-description-ar":"مسح الجهاز وراء هذا الطرف، إن جاء من جهاز.","nullable":true,"properties":{"name":{"type":"string","description":"Device name.","x-description-ar":"اسم الجهاز.","nullable":true},"external_employee_no":{"type":"string","description":"The employee's number on the device.","x-description-ar":"رقم الموظف على الجهاز."}}},"incidents":{"type":"array","description":"Deductions this day produced (late arrival, early leave…), and whether the employee has explained each. Details with `attendances.justification_context`.","x-description-ar":"الخصومات التي نتجت عن هذا اليوم (تأخير، خروج مبكر…) وهل قدّم الموظف مبرراً لكل منها. التفاصيل عبر `attendances.justification_context`.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Time incident id.","x-description-ar":"رقم المخالفة."},"kind":{"type":"string","description":"`absence`, `late`, `early_leave`, `short_hours` or `incomplete`.","x-description-ar":"`absence` غياب، `late` تأخير، `early_leave` خروج مبكر، `short_hours` ساعات ناقصة، `incomplete` يوم غير مكتمل."},"status":{"type":"string","description":"`pending` (under review), `deducted` or `ignored`.","x-description-ar":"`pending` قيد المراجعة، `deducted` خُصم، `ignored` تم تجاهله."},"justification_state":{"type":"string","description":"`submitted` or `none`.","x-description-ar":"`submitted` قُدّم مبرر، `none` لا يوجد."}}}},"permissions":{"type":"array","description":"Approved and pending hourly permissions on this day (history only).","x-description-ar":"طلبات الاستئذان المعتمدة والمعلقة في هذا اليوم (في السجل فقط).","items":{"type":"object","properties":{"id":{"type":"integer","description":"Permission request id.","x-description-ar":"رقم طلب الاستئذان."},"kind":{"type":"string","description":"Permission kind, e.g. `late_arrival`, `early_leave`.","x-description-ar":"نوع الاستئذان، مثل `late_arrival`."},"status":{"type":"string","description":"`approved` or `pending`.","x-description-ar":"`approved` معتمد أو `pending` معلق."},"start_time":{"type":"string","description":"Start, `HH:MM` local.","x-description-ar":"البداية `HH:MM` بالتوقيت المحلي."},"end_time":{"type":"string","description":"End, `HH:MM` local.","x-description-ar":"النهاية `HH:MM` بالتوقيت المحلي."}}}},"tracks_breaks":{"type":"boolean","description":"True when this day records breaks (pause / resume).","x-description-ar":"صحيح إن كان اليوم يسجّل الاستراحات."},"day_state":{"type":"string","description":"On a day that tracks breaks: `working`, `paused` or `ended`; null otherwise.","x-description-ar":"في يوم يتتبع الاستراحات: `working` يعمل، `paused` في استراحة، `ended` انتهى؛ وإلا null.","nullable":true},"ended_by":{"type":"string","description":"Who ended a tracked day: `employee` (from the app or a device) or `system` (closed automatically).","x-description-ar":"من أنهى اليوم المتتبَّع: `employee` الموظف (من التطبيق أو جهاز) أو `system` أُغلق تلقائياً.","nullable":true},"break_minutes":{"type":"integer","description":"Minutes on break.","x-description-ar":"دقائق الاستراحة.","nullable":true},"breaks":{"type":"array","description":"The day's breaks; empty when breaks are not tracked.","x-description-ar":"استراحات اليوم؛ فارغة إن لم تُتتبع.","items":{"type":"object","properties":{"started_at":{"type":"string","description":"Break start, UTC.","x-description-ar":"بداية الاستراحة بتوقيت UTC.","format":"date-time"},"ended_at":{"type":"string","description":"Break end, UTC; null while the break is running.","x-description-ar":"نهاية الاستراحة بتوقيت UTC؛ null ما دامت جارية.","format":"date-time","nullable":true},"started_via":{"type":"string","description":"`app` or `device`.","x-description-ar":"`app` أو `device`.","nullable":true},"ended_via":{"type":"string","description":"`app` or `device`.","x-description-ar":"`app` أو `device`.","nullable":true},"started_device_name":{"type":"string","description":"Device that started the break.","x-description-ar":"الجهاز الذي بدأ الاستراحة.","nullable":true},"ended_device_name":{"type":"string","description":"Device that ended the break.","x-description-ar":"الجهاز الذي أنهى الاستراحة.","nullable":true}}}}}},"attendance_record_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_record"},"description":"The days on this page.","x-description-ar":"الأيام في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_report_employee_detail":{"type":"object","description":"One employee's totals over the period and the exact days behind them.","x-description-ar":"مجاميع موظف واحد خلال الفترة والأيام التي تقف خلفها.","properties":{"employee":{"type":"object","description":"Who.","x-description-ar":"الموظف.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the request's language when available.","x-description-ar":"الاسم الكامل بلغة الطلب إن توفر."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"employment_status":{"type":"string","description":"`active`, `notice_period` or `inactive`.","x-description-ar":"`active` نشط، `notice_period` في فترة الإشعار، `inactive` غادر."}}},"period":{"type":"object","description":"The period used, after defaults.","x-description-ar":"الفترة المستخدمة بعد تطبيق القيم الافتراضية.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"}}},"summary":{"type":"object","description":"The same totals as the employee's row in the list.","x-description-ar":"المجاميع نفسها التي في صف الموظف في القائمة.","properties":{"attendance_days":{"type":"integer","description":"Days attended in the period: days with a check-in (on time, late, or without a check-out yet). A check-in on a weekend or holiday counts too.","x-description-ar":"أيام الحضور في الفترة: أيام فيها تسجيل دخول (في الموعد أو متأخر أو دون تسجيل خروج بعد). ويُحتسب تسجيل الدخول في عطلة نهاية الأسبوع أو العطلة الرسمية أيضاً."},"absent_days":{"type":"integer","description":"Working days with no check-in and no approved leave. Written each night for the previous day, so today never counts. Weekends, holidays and leave days are never absences.","x-description-ar":"أيام عمل دون تسجيل دخول ودون إجازة معتمدة. تُسجَّل كل ليلة عن اليوم السابق، فلا يُحتسب اليوم الحالي أبداً. عطل نهاية الأسبوع والعطل الرسمية وأيام الإجازة ليست غياباً."},"delay_days":{"type":"integer","description":"Days with a late arrival (still waiting on a manager or HR, or deducted). Lates HR excused (`ignored`) are not counted.","x-description-ar":"أيام فيها تأخير في الحضور (بانتظار المدير أو الموارد البشرية، أو خُصم). لا يُحتسب التأخير الذي عذرته الموارد البشرية (`ignored`)."},"delay_hours":{"type":"number","description":"Total minutes late on those days, in hours (2 decimals).","x-description-ar":"مجموع دقائق التأخير في تلك الأيام بالساعات (منزلتان عشريتان)."},"overtime_hours":{"type":"number","description":"Approved overtime in the period, in hours.","x-description-ar":"العمل الإضافي المعتمد في الفترة بالساعات."},"permission_hours":{"type":"number","description":"Approved permissions (short time off during the day) in the period, in hours.","x-description-ar":"الاستئذانات المعتمدة (خروج قصير أثناء الدوام) في الفترة بالساعات."},"commitment_percentage":{"type":"number","description":"Attendance rate: attendance_days ÷ (attendance_days + absent_days) × 100, one decimal. Leave, weekends and holidays are outside the ratio. Null when the employee had no expected day (e.g. a new hire).","x-description-ar":"نسبة الالتزام: أيام الحضور ÷ (أيام الحضور + أيام الغياب) × ١٠٠، بمنزلة عشرية واحدة. الإجازات وعطل نهاية الأسبوع والعطل الرسمية خارج النسبة. null إن لم يكن للموظف أي يوم مطلوب (موظف جديد مثلاً).","nullable":true}}},"absent_days":{"type":"array","description":"Each absent day, oldest first. `excused` is true only when HR excused the absence.","x-description-ar":"كل يوم غياب، الأقدم أولاً. `excused` صحيح فقط إن عذرت الموارد البشرية الغياب.","items":{"type":"object","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"excused":{"type":"boolean","description":"True when HR excused (ignored) the absence.","x-description-ar":"صحيح إن عذرت الموارد البشرية الغياب."}}}},"delay_days":{"type":"array","description":"Each late day counted in `delay_days`, oldest first.","x-description-ar":"كل يوم تأخير محتسب في `delay_days`، الأقدم أولاً.","items":{"type":"object","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"check_in_at":{"type":"string","description":"Check-in time, UTC ISO-8601 with milliseconds.","x-description-ar":"وقت تسجيل الدخول بتوقيت UTC بصيغة ISO-8601 مع أجزاء الثانية.","format":"date-time","nullable":true},"minutes_late":{"type":"integer","description":"Minutes late counted.","x-description-ar":"دقائق التأخير المحتسبة."}}}},"overtime_days":{"type":"array","description":"Each approved overtime, oldest first.","x-description-ar":"كل عمل إضافي معتمد، الأقدم أولاً.","items":{"type":"object","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"start_time":{"type":"string","description":"Start, `HH:MM` local time.","x-description-ar":"البداية `HH:MM` بالتوقيت المحلي."},"end_time":{"type":"string","description":"End, `HH:MM` local time.","x-description-ar":"النهاية `HH:MM` بالتوقيت المحلي."},"hours":{"type":"number","description":"Hours approved.","x-description-ar":"الساعات المعتمدة."}}}},"total_overtime_hours":{"type":"number","description":"Sum of the approved overtime hours.","x-description-ar":"مجموع ساعات العمل الإضافي المعتمدة."}}},"attendance_report_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/attendance_report_row"},"description":"The employees on this page.","x-description-ar":"الموظفون في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"attendance_report_row":{"type":"object","description":"One employee's totals over the period.","x-description-ar":"مجاميع موظف واحد خلال الفترة.","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the request's language when available.","x-description-ar":"الاسم الكامل بلغة الطلب إن توفر."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"attendance_days":{"type":"integer","description":"Days attended in the period: days with a check-in (on time, late, or without a check-out yet). A check-in on a weekend or holiday counts too.","x-description-ar":"أيام الحضور في الفترة: أيام فيها تسجيل دخول (في الموعد أو متأخر أو دون تسجيل خروج بعد). ويُحتسب تسجيل الدخول في عطلة نهاية الأسبوع أو العطلة الرسمية أيضاً."},"absent_days":{"type":"integer","description":"Working days with no check-in and no approved leave. Written each night for the previous day, so today never counts. Weekends, holidays and leave days are never absences.","x-description-ar":"أيام عمل دون تسجيل دخول ودون إجازة معتمدة. تُسجَّل كل ليلة عن اليوم السابق، فلا يُحتسب اليوم الحالي أبداً. عطل نهاية الأسبوع والعطل الرسمية وأيام الإجازة ليست غياباً."},"delay_days":{"type":"integer","description":"Days with a late arrival (still waiting on a manager or HR, or deducted). Lates HR excused (`ignored`) are not counted.","x-description-ar":"أيام فيها تأخير في الحضور (بانتظار المدير أو الموارد البشرية، أو خُصم). لا يُحتسب التأخير الذي عذرته الموارد البشرية (`ignored`)."},"delay_hours":{"type":"number","description":"Total minutes late on those days, in hours (2 decimals).","x-description-ar":"مجموع دقائق التأخير في تلك الأيام بالساعات (منزلتان عشريتان)."},"overtime_hours":{"type":"number","description":"Approved overtime in the period, in hours.","x-description-ar":"العمل الإضافي المعتمد في الفترة بالساعات."},"permission_hours":{"type":"number","description":"Approved permissions (short time off during the day) in the period, in hours.","x-description-ar":"الاستئذانات المعتمدة (خروج قصير أثناء الدوام) في الفترة بالساعات."},"commitment_percentage":{"type":"number","description":"Attendance rate: attendance_days ÷ (attendance_days + absent_days) × 100, one decimal. Leave, weekends and holidays are outside the ratio. Null when the employee had no expected day (e.g. a new hire).","x-description-ar":"نسبة الالتزام: أيام الحضور ÷ (أيام الحضور + أيام الغياب) × ١٠٠، بمنزلة عشرية واحدة. الإجازات وعطل نهاية الأسبوع والعطل الرسمية خارج النسبة. null إن لم يكن للموظف أي يوم مطلوب (موظف جديد مثلاً).","nullable":true}}},"attendance_report_stat_cards":{"type":"object","description":"Today's headcount, in the company's timezone. The categories never overlap (a check-in wins over a day off, a day off over a holiday, a holiday over leave), so present + on_leave + absent + not_yet_due + on_holiday + on_day_off = total_employees on a working day.","x-description-ar":"أعداد اليوم بتوقيت الشركة. لا تتداخل الفئات (تسجيل الدخول يتقدم على يوم الراحة، ويوم الراحة على العطلة، والعطلة على الإجازة)، فمجموع present وon_leave وabsent وnot_yet_due وon_holiday وon_day_off يساوي total_employees في يوم العمل.","required":["total_employees","present","on_leave","absent","not_yet_due","on_holiday","on_day_off","working_day"],"properties":{"total_employees":{"type":"integer","description":"Active employees in scope (people who have left or are in their notice period are not counted).","x-description-ar":"الموظفون النشطون ضمن النطاق (لا يُحتسب من غادر أو في فترة الإشعار)."},"present":{"type":"integer","description":"Checked in today (also on a day off or holiday).","x-description-ar":"سجّلوا دخولهم اليوم (ولو في يوم راحة أو عطلة)."},"on_leave":{"type":"integer","description":"On approved leave today and not checked in.","x-description-ar":"في إجازة معتمدة اليوم ولم يسجلوا دخولهم."},"absent":{"type":"integer","description":"Due in today, not checked in, and past their own shift start plus the company's auto-absent delay. Live, not the nightly absence record.","x-description-ar":"مطلوب حضورهم اليوم ولم يسجلوا دخولهم وتجاوز الوقت بداية ورديتهم مضافاً إليها مهلة الغياب التلقائي في الشركة. رقم مباشر، لا سجل الغياب الليلي."},"not_yet_due":{"type":"integer","description":"Due in today, not checked in, and still inside that delay.","x-description-ar":"مطلوب حضورهم اليوم ولم يسجلوا دخولهم وما زالوا ضمن تلك المهلة."},"on_holiday":{"type":"integer","description":"On a public holiday of their country of residence.","x-description-ar":"في عطلة رسمية لبلد إقامتهم."},"on_day_off":{"type":"integer","description":"Today is off in their own attendance profile (weekend).","x-description-ar":"اليوم راحة في ملف الحضور الخاص بهم (عطلة نهاية الأسبوع)."},"working_day":{"type":"boolean","description":"False when nobody in scope is due in today; every card except `total_employees` is then 0.","x-description-ar":"خطأ عندما لا يُطلب حضور أحد ضمن النطاق اليوم؛ وتكون حينها كل البطاقات عدا `total_employees` صفراً."}}},"bonus":{"type":"object","description":"A bonus.","x-description-ar":"مكافأة.","properties":{"id":{"type":"integer","description":"Bonus id.","x-description-ar":"رقم المكافأة."},"reference":{"type":"string","description":"Reference, e.g. `BNS-0042`.","x-description-ar":"المرجع، مثل `BNS-0042`."},"kind":{"type":"string","description":"`other` (a general bonus), `commission` or `grant`.","x-description-ar":"`other` مكافأة عامة، `commission` عمولة، `grant` منحة.","enum":["other","commission","grant"]},"amount":{"type":"string","description":"Amount, decimal string.","x-description-ar":"المبلغ، نص عشري."},"status":{"type":"string","description":"`draft` (waiting for HR), `with_accounting` (approved, waiting for the accountant in Qoyod), `not_paid` (approved, the next payroll run pays it), `partially_paid`, `paid`, or `rejected`.","x-description-ar":"`draft` بانتظار الموارد البشرية، `with_accounting` معتمدة وبانتظار المحاسب في قيود، `not_paid` معتمدة ويصرفها المسيّر التالي، `partially_paid` مصروفة جزئياً، `paid` مصروفة، `rejected` مرفوضة.","enum":["draft","with_accounting","not_paid","partially_paid","paid","rejected"]},"date":{"type":"string","description":"Date of the bonus.","x-description-ar":"تاريخ المكافأة.","format":"date","nullable":true},"description":{"type":"string","description":"Free-text description; also the payslip line label.","x-description-ar":"وصف حر، وهو أيضاً وصف البند في القسيمة.","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف.","nullable":true},"submitted_by":{"type":"object","nullable":true,"description":"The manager who proposed it; null when HR added it.","x-description-ar":"المدير الذي اقترحها؛ null إن أضافتها الموارد البشرية.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"rejected_by":{"type":"object","nullable":true,"description":"Who in HR rejected it; null when the accountant declined it or it was not rejected.","x-description-ar":"من رفضها في الموارد البشرية؛ null إن رفضها المحاسب أو لم تُرفض.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"rejected_at":{"type":"string","description":"When it was rejected, UTC ISO 8601.","x-description-ar":"وقت الرفض بتوقيت UTC بصيغة ISO 8601.","nullable":true},"rejection_reason":{"type":"string","description":"Why it was rejected.","x-description-ar":"سبب الرفض.","nullable":true}}},"bonus_detail":{"type":"object","description":"A bonus, with what accounting said about it.","x-description-ar":"مكافأة مع رأي المحاسبة فيها.","allOf":[{"$ref":"#/components/schemas/bonus"}],"properties":{"accounting":{"type":"object","nullable":true,"description":"The accountant's latest answer in Qoyod; null when the bonus never went to accounting.","x-description-ar":"آخر رد للمحاسب في قيود؛ null إن لم تُرسل المكافأة إلى المحاسبة.","properties":{"state":{"type":"string","description":"Delivery or decision state, e.g. `sending`, `pending`, `approved`, `declined`.","x-description-ar":"حالة الإرسال أو القرار، مثل `sending` و`pending` و`approved` و`declined`."},"reason":{"type":"string","description":"The accountant's reason, if any.","x-description-ar":"سبب المحاسب إن وُجد.","nullable":true},"reason_code":{"type":"string","description":"Machine code of the reason.","x-description-ar":"رمز السبب.","nullable":true},"decided_by":{"type":"string","description":"Email of the accountant who decided.","x-description-ar":"بريد المحاسب الذي قرر.","nullable":true},"decided_at":{"type":"string","description":"When they decided, UTC ISO 8601.","x-description-ar":"وقت القرار بتوقيت UTC.","nullable":true}}}}},"bonus_input":{"type":"object","description":"The bonus's fields.","x-description-ar":"حقول المكافأة.","properties":{"kind":{"type":"string","description":"`other` (a general bonus), `commission` or `grant`.","x-description-ar":"`other` مكافأة عامة، `commission` عمولة، `grant` منحة.","enum":["other","commission","grant"]},"amount":{"type":"string","description":"Amount, decimal string, more than zero.","x-description-ar":"المبلغ، نص عشري أكبر من صفر."},"date":{"type":"string","description":"Date of the bonus.","x-description-ar":"تاريخ المكافأة.","format":"date"},"description":{"type":"string","description":"Free-text description, shown on the payslip.","x-description-ar":"وصف حر يظهر في القسيمة."}}},"custody_category":{"type":"object","description":"A custody category with its items.","x-description-ar":"فئة عهد مع أصنافها.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name":{"type":"string","description":"Name in the request language, falling back to the other.","x-description-ar":"الاسم بلغة الطلب، وإلا باللغة الأخرى."},"name_en":{"type":"string","description":"English name.","x-description-ar":"الاسم بالإنجليزية.","nullable":true},"name_ar":{"type":"string","description":"Arabic name.","x-description-ar":"الاسم بالعربية.","nullable":true},"icon":{"type":"string","description":"Icon key, one of `icons`.","x-description-ar":"مفتاح الأيقونة، أحد قيم `icons`."},"is_default":{"type":"boolean","description":"One of the three categories QHR creates for every company. Edited and deleted like any other.","x-description-ar":"إحدى الفئات الثلاث التي ينشئها QHR لكل شركة. تُعدَّل وتُحذف كغيرها."},"department":{"type":"object","nullable":true,"description":"Department responsible for these assets (information only).","x-description-ar":"القسم المسؤول عن هذه الأصول (للعلم فقط).","properties":{"id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم."}}},"items_count":{"type":"integer","description":"Number of items listed.","x-description-ar":"عدد الأصناف المعروضة."},"items":{"type":"array","items":{"$ref":"#/components/schemas/custody_item"},"description":"Its items, by name.","x-description-ar":"أصنافها مرتبة بالاسم."}}},"custody_category_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/custody_category"}}},"custody_deleted_record":{"type":"object","required":["record"],"properties":{"record":{"type":"object","description":"What was deleted.","x-description-ar":"ما حُذف.","properties":{"id":{"type":"integer","description":"Id of the deleted record.","x-description-ar":"رقم السجل المحذوف."}}}}},"custody_detail":{"type":"object","description":"One custody record in full.","x-description-ar":"سجل عهدة كاملاً.","properties":{"id":{"type":"integer","description":"Custody id.","x-description-ar":"رقم العهدة."},"reference":{"type":"string","description":"Custody reference, e.g. `CUS-0042`.","x-description-ar":"مرجع العهدة، مثل `CUS-0042`."},"employee":{"$ref":"#/components/schemas/custody_employee"},"category":{"type":"object","description":"Category as it was named when handed over.","x-description-ar":"الفئة كما كانت تسميتها وقت التسليم.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name":{"type":"string","description":"Category name.","x-description-ar":"اسم الفئة."},"icon":{"type":"string","description":"Category icon key.","x-description-ar":"مفتاح أيقونة الفئة.","nullable":true}}},"item":{"type":"object","description":"Item as it was named when handed over.","x-description-ar":"الصنف كما كان اسمه وقت التسليم.","properties":{"id":{"type":"integer","description":"Item id.","x-description-ar":"رقم الصنف."},"name":{"type":"string","description":"Item name.","x-description-ar":"اسم الصنف."}}},"serial":{"type":"string","description":"Serial number of the unit handed over.","x-description-ar":"الرقم التسلسلي للوحدة المسلَّمة.","nullable":true},"value":{"type":"string","description":"Value of the asset, 2 decimals.","x-description-ar":"قيمة الأصل بخانتين عشريتين."},"currency":{"type":"string","description":"Currency of the money fields (the holder's pay currency).","x-description-ar":"عملة المبالغ (عملة راتب الحامل)."},"assigned_on":{"type":"string","description":"Date it was first handed over.","x-description-ar":"تاريخ التسليم الأول.","format":"date"},"held_since":{"type":"string","description":"Date the current holder received it.","x-description-ar":"تاريخ استلام الحامل الحالي له.","format":"date","nullable":true},"status":{"type":"string","description":"`held` (with the employee), `returned` (back with the company), `deducting` (returned damaged or lost, the employee repaying it from salary) or `deducted` (fully recovered or settled).","x-description-ar":"`held` في عهدة الموظف، `returned` أُعيد إلى الشركة، `deducting` أُعيد تالفاً أو مفقوداً ويُسترد من راتب الموظف، `deducted` اكتمل استرداده أو سُوّي.","enum":["held","returned","deducting","deducted"]},"installments_paid":{"type":"integer","description":"Salary deductions already paid; 0 when none.","x-description-ar":"عدد الاستقطاعات المدفوعة من الراتب؛ 0 إن لم يوجد."},"installments_count":{"type":"integer","description":"Number of salary deductions scheduled; null when the employee pays nothing.","x-description-ar":"عدد الاستقطاعات المجدولة من الراتب؛ null إن لم يكن على الموظف شيء.","nullable":true},"returned_on":{"type":"string","description":"Return date; null while held.","x-description-ar":"تاريخ الإعادة؛ null ما دام في العهدة.","format":"date","nullable":true},"condition":{"type":"string","description":"Condition at return: `intact`, `damaged` or `lost`; null until returned.","x-description-ar":"الحالة عند الإعادة: `intact` سليم، `damaged` تالف، `lost` مفقود؛ null قبل الإعادة.","enum":["intact","damaged","lost",null],"nullable":true},"compensation_amount":{"type":"string","description":"Cost of the damage or loss; null for an intact return.","x-description-ar":"تكلفة التلف أو الفقد؛ null عند الإعادة سليماً.","nullable":true},"borne_by":{"type":"string","description":"Who pays that cost: `company` or `employee`.","x-description-ar":"من يتحمل التكلفة: `company` الشركة أو `employee` الموظف.","enum":["company","employee",null],"nullable":true},"labor_law_cap":{"type":"boolean","description":"True when the deductions were limited to five days' wage a month (labour law).","x-description-ar":"صحيح إن حُدّ الاستقطاع الشهري بأجر خمسة أيام (نظام العمل).","nullable":true},"amount_repaid":{"type":"string","description":"Already recovered from salary; null unless the employee pays.","x-description-ar":"ما استُرد من الراتب حتى الآن؛ null إن لم يكن على الموظف شيء.","nullable":true},"outstanding":{"type":"string","description":"Still to recover; null unless the employee pays.","x-description-ar":"المتبقي للاسترداد؛ null إن لم يكن على الموظف شيء.","nullable":true},"settlement":{"type":"object","nullable":true,"description":"How the balance was closed (cash, or a termination package); null until settled.","x-description-ar":"كيف أُغلق الرصيد (نقداً أو بمخالصة نهاية الخدمة)؛ null قبل التسوية.","properties":{"amount":{"type":"string","description":"Amount settled.","x-description-ar":"المبلغ المسوّى.","nullable":true},"date":{"type":"string","description":"Settlement date.","x-description-ar":"تاريخ التسوية.","format":"date"},"source":{"type":"string","description":"`cash` or `termination_package`.","x-description-ar":"`cash` نقداً أو `termination_package` مخالصة نهاية الخدمة."},"reason":{"type":"string","description":"HR's reason, for a cash settlement.","x-description-ar":"سبب الموارد البشرية في التسوية النقدية.","nullable":true},"termination_package":{"type":"object","nullable":true,"description":"The termination package that settled it.","x-description-ar":"مخالصة نهاية الخدمة التي سوّته.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}}}},"installments":{"type":"array","description":"The salary-deduction schedule, oldest first; empty unless the employee pays.","x-description-ar":"جدول الاستقطاع من الراتب، الأقدم أولاً؛ فارغ إن لم يكن على الموظف شيء.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Installment id.","x-description-ar":"رقم القسط."},"sequence":{"type":"integer","description":"Position in the schedule, from 1.","x-description-ar":"ترتيبه في الجدول، يبدأ من 1."},"due_on":{"type":"string","description":"First day of the month whose payroll deducts it.","x-description-ar":"أول يوم من الشهر الذي يُستقطع في مسير رواتبه.","format":"date"},"amount":{"type":"string","description":"Amount.","x-description-ar":"المبلغ."},"currency":{"type":"string","description":"Currency.","x-description-ar":"العملة."},"status":{"type":"string","description":"`paid` once the payslip carrying it was paid, `due` until then.","x-description-ar":"`paid` بعد دفع قسيمة الراتب التي تحمله، و`due` قبل ذلك.","enum":["paid","due"]},"payroll":{"type":"object","nullable":true,"description":"The payroll run that deducted it.","x-description-ar":"مسير الرواتب الذي استقطعه.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}}}}},"timeline":{"type":"array","description":"What happened to the asset, newest first.","x-description-ar":"ما جرى على الأصل، الأحدث أولاً.","items":{"type":"object","properties":{"kind":{"type":"string","description":"`assigned`, `transferred`, `auto_transferred` (moved to HR when a leaver's package was paid), `returned`, `installment_deducted`, `settled` or `package_settled`.","x-description-ar":"`assigned` تسليم، `transferred` نقل، `auto_transferred` نُقل تلقائياً إلى الموارد البشرية عند دفع مخالصة موظف مغادر، `returned` إعادة، `installment_deducted` استقطاع قسط، `settled` تسوية نقدية، `package_settled` تسوية بالمخالصة."},"occurred_on":{"type":"string","description":"Date.","x-description-ar":"التاريخ.","format":"date"},"actor":{"type":"object","nullable":true,"description":"Who did it; null for a system action.","x-description-ar":"من قام به؛ null للإجراء الآلي.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"from_employee":{"type":"object","nullable":true,"description":"Previous holder, for a transfer.","x-description-ar":"الحامل السابق في النقل.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"to_employee":{"type":"object","nullable":true,"description":"New holder, for an assignment or transfer.","x-description-ar":"الحامل الجديد في التسليم أو النقل.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"amount":{"type":"string","description":"Money involved, when any.","x-description-ar":"المبلغ المعني إن وُجد.","nullable":true},"note":{"type":"string","description":"Settlement reason.","x-description-ar":"سبب التسوية.","nullable":true},"condition":{"type":"string","description":"Condition, for a return.","x-description-ar":"الحالة عند الإعادة.","nullable":true},"termination_package":{"type":"object","nullable":true,"description":"Related termination package.","x-description-ar":"مخالصة نهاية الخدمة المعنية.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}},"payroll":{"type":"object","nullable":true,"description":"Payroll run, for a deduction.","x-description-ar":"مسير الرواتب في الاستقطاع.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}},"installment":{"type":"object","nullable":true,"description":"Which installment, for a deduction.","x-description-ar":"أي قسط، في الاستقطاع.","properties":{"sequence":{"type":"integer","description":"Installment number.","x-description-ar":"رقم القسط."},"count":{"type":"integer","description":"Installments in total.","x-description-ar":"إجمالي الأقساط.","nullable":true}}},"document":{"type":"object","nullable":true,"description":"The signed handover PDF.","x-description-ar":"نموذج التسليم الموقَّع (PDF).","properties":{"url":{"type":"string","description":"Temporary download link.","x-description-ar":"رابط تنزيل مؤقت."},"filename":{"type":"string","description":"File name.","x-description-ar":"اسم الملف."}}}}}},"can_return":{"type":"boolean","description":"True when the caller may take it back now.","x-description-ar":"صحيح إن كان للمستدعي استلامه الآن."},"can_transfer":{"type":"boolean","description":"True when the caller may move it to another employee now.","x-description-ar":"صحيح إن كان للمستدعي نقله إلى موظف آخر الآن."},"can_settle":{"type":"boolean","description":"True when the caller may settle the balance in cash now.","x-description-ar":"صحيح إن كان للمستدعي تسوية الرصيد نقداً الآن."},"settlement_blocker":{"type":"object","nullable":true,"description":"Why the balance cannot be settled in cash, while deducting: `claimed_by_package`, `nothing_outstanding` or `installment_in_flight`.","x-description-ar":"سبب تعذّر تسوية الرصيد نقداً أثناء الاستقطاع: `claimed_by_package` أو `nothing_outstanding` أو `installment_in_flight`.","properties":{"code":{"type":"string","description":"Reason code.","x-description-ar":"رمز السبب."},"message":{"type":"string","description":"Explanation.","x-description-ar":"الشرح."}}},"accounting_connected":{"type":"boolean","description":"True when the company is connected to Qoyod accounting (a cash settlement is then booked there by hand).","x-description-ar":"صحيح إن كانت الشركة مرتبطة بمحاسبة قيود (وتُقيَّد التسوية النقدية هناك يدوياً)."},"employee_termination_package":{"type":"object","nullable":true,"description":"The holder's open termination package, which blocks moving the asset.","x-description-ar":"مخالصة نهاية الخدمة المفتوحة للحامل، والتي تمنع تحريك الأصل.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}}}},"custody_employee":{"type":"object","nullable":true,"description":"The employee holding the asset.","x-description-ar":"الموظف الذي يحمل الأصل.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"department":{"type":"object","nullable":true,"description":"The holder's department.","x-description-ar":"قسم حامل العهدة.","properties":{"id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم."}}}}},"custody_export_columns":{"type":"object","properties":{"columns":{"type":"array","description":"Columns the caller may export.","x-description-ar":"الأعمدة التي يستطيع المستدعي تصديرها.","items":{"type":"object","properties":{"key":{"type":"string","description":"Column key.","x-description-ar":"مفتاح العمود."},"label":{"type":"string","description":"Column heading, in the request language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"Included when no columns are chosen.","x-description-ar":"يُضمَّن عند عدم اختيار أعمدة."},"type":{"type":"string","description":"Value type: `string`, `date`, `money`, `enum`…","x-description-ar":"نوع القيمة: `string` و`date` و`money` و`enum`…"}}}}}},"custody_item":{"type":"object","description":"A kind of asset HR hands out.","x-description-ar":"نوع من الأصول تسلّمه الموارد البشرية.","properties":{"id":{"type":"integer","description":"Item id.","x-description-ar":"رقم الصنف."},"custody_category_id":{"type":"integer","description":"Its category.","x-description-ar":"فئته."},"name":{"type":"string","description":"Item name, unique in the category.","x-description-ar":"اسم الصنف، فريد داخل الفئة."},"serial_required":{"type":"boolean","description":"A serial number must be given when it is handed over.","x-description-ar":"يلزم إدخال رقم تسلسلي عند تسليمه."},"available":{"type":"boolean","description":"Can be handed out now; false hides it from new assignments.","x-description-ar":"متاح للتسليم الآن؛ القيمة false تخفيه عن التسليمات الجديدة."},"default_value":{"type":"string","description":"Value proposed when it is handed over, 2 decimals.","x-description-ar":"القيمة المقترحة عند التسليم، بخانتين عشريتين."},"currency":{"type":"string","description":"Currency of the value (the company default).","x-description-ar":"عملة القيمة (العملة الافتراضية للشركة)."},"in_use":{"type":"boolean","description":"True once any custody names it; it can then only be made unavailable, not deleted.","x-description-ar":"صحيح إن ورد في أي عهدة؛ وعندها يمكن إيقافه فقط لا حذفه."},"held_custody_count":{"type":"integer","description":"How many of it employees hold right now.","x-description-ar":"عدد ما يحمله الموظفون منه الآن."}}},"custody_item_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/custody_item"}}},"custody_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/custody_row"},"description":"The custody on this page.","x-description-ar":"العهد في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"custody_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/custody_detail"}}},"custody_row":{"type":"object","description":"One custody record in HR's list.","x-description-ar":"سجل عهدة واحد في قائمة الموارد البشرية.","properties":{"id":{"type":"integer","description":"Custody id.","x-description-ar":"رقم العهدة."},"reference":{"type":"string","description":"Custody reference, e.g. `CUS-0042`.","x-description-ar":"مرجع العهدة، مثل `CUS-0042`."},"employee":{"$ref":"#/components/schemas/custody_employee"},"category":{"type":"object","description":"Category as it was named when handed over.","x-description-ar":"الفئة كما كانت تسميتها وقت التسليم.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name":{"type":"string","description":"Category name.","x-description-ar":"اسم الفئة."},"icon":{"type":"string","description":"Category icon key.","x-description-ar":"مفتاح أيقونة الفئة.","nullable":true}}},"item":{"type":"object","description":"Item as it was named when handed over.","x-description-ar":"الصنف كما كان اسمه وقت التسليم.","properties":{"id":{"type":"integer","description":"Item id.","x-description-ar":"رقم الصنف."},"name":{"type":"string","description":"Item name.","x-description-ar":"اسم الصنف."}}},"serial":{"type":"string","description":"Serial number of the unit handed over.","x-description-ar":"الرقم التسلسلي للوحدة المسلَّمة.","nullable":true},"value":{"type":"string","description":"Value of the asset, 2 decimals.","x-description-ar":"قيمة الأصل بخانتين عشريتين."},"currency":{"type":"string","description":"Currency of the money fields (the holder's pay currency).","x-description-ar":"عملة المبالغ (عملة راتب الحامل)."},"assigned_on":{"type":"string","description":"Date it was first handed over.","x-description-ar":"تاريخ التسليم الأول.","format":"date"},"held_since":{"type":"string","description":"Date the current holder received it.","x-description-ar":"تاريخ استلام الحامل الحالي له.","format":"date","nullable":true},"status":{"type":"string","description":"`held` (with the employee), `returned` (back with the company), `deducting` (returned damaged or lost, the employee repaying it from salary) or `deducted` (fully recovered or settled).","x-description-ar":"`held` في عهدة الموظف، `returned` أُعيد إلى الشركة، `deducting` أُعيد تالفاً أو مفقوداً ويُسترد من راتب الموظف، `deducted` اكتمل استرداده أو سُوّي.","enum":["held","returned","deducting","deducted"]},"installments_paid":{"type":"integer","description":"Salary deductions already paid; 0 when none.","x-description-ar":"عدد الاستقطاعات المدفوعة من الراتب؛ 0 إن لم يوجد."},"installments_count":{"type":"integer","description":"Number of salary deductions scheduled; null when the employee pays nothing.","x-description-ar":"عدد الاستقطاعات المجدولة من الراتب؛ null إن لم يكن على الموظف شيء.","nullable":true},"returned_on":{"type":"string","description":"Return date; null while held.","x-description-ar":"تاريخ الإعادة؛ null ما دام في العهدة.","format":"date","nullable":true},"condition":{"type":"string","description":"Condition at return: `intact`, `damaged` or `lost`; null until returned.","x-description-ar":"الحالة عند الإعادة: `intact` سليم، `damaged` تالف، `lost` مفقود؛ null قبل الإعادة.","enum":["intact","damaged","lost",null],"nullable":true}}},"custody_stat_cards":{"type":"object","properties":{"held_count":{"type":"integer","description":"Assets with employees right now.","x-description-ar":"الأصول التي في عهدة الموظفين الآن."},"held_value":{"type":"string","description":"Their total value.","x-description-ar":"قيمتها الإجمالية."},"held_employees_count":{"type":"integer","description":"Employees holding at least one.","x-description-ar":"عدد الموظفين الذين يحملون أصلاً واحداً على الأقل."},"deducting_count":{"type":"integer","description":"Custody being recovered from salary.","x-description-ar":"العهد التي يجري استردادها من الراتب."},"remaining_deduction":{"type":"string","description":"What those still owe.","x-description-ar":"ما تبقى عليها."},"currency":{"type":"string","description":"Currency of the amounts (the company default).","x-description-ar":"عملة المبالغ (العملة الافتراضية للشركة)."}}},"dashboard_holiday":{"type":"object","description":"A public holiday.","x-description-ar":"عطلة رسمية.","required":["id","name","name_en","name_ar","start_date","end_date","country","country_name"],"properties":{"id":{"type":"integer","description":"Holiday id.","x-description-ar":"رقم العطلة."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"country":{"type":"string","description":"Country code (ISO 3166, e.g. `SA`).","x-description-ar":"رمز الدولة (ISO 3166، مثل `SA`)."},"country_name":{"type":"string","description":"Country name in the requested language.","x-description-ar":"اسم الدولة بلغة الطلب.","nullable":true},"show_on_dashboard_for_assigned_users":{"type":"boolean","description":"Shown on the dashboard; always `true` here.","x-description-ar":"يظهر في لوحة المعلومات؛ `true` دائماً هنا."}}},"dashboard_holiday_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/dashboard_holiday"},"description":"The holidays on this page.","x-description-ar":"العطل في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"dashboard_pending_approval":{"type":"object","description":"A leave request waiting for the caller's decision.","x-description-ar":"طلب إجازة ينتظر قرار صاحب الرمز.","required":["id","employee_id","employee_name","start_date","end_date","balance","status","leave_type_name","pending_cancellation","current_stage","days_pending","days_at_current_stage"],"properties":{"id":{"type":"integer","description":"Leave request id, as in `leave_requests.show`.","x-description-ar":"رقم طلب الإجازة، كما في `leave_requests.show`."},"employee_id":{"type":"integer","description":"The employee's id.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"The employee's full name.","x-description-ar":"اسم الموظف الكامل."},"employee_image":{"type":"string","description":"Always empty; kept for the web app.","x-description-ar":"فارغ دائماً؛ مُبقى لتطبيق الويب.","nullable":true},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Days of leave charged, as a decimal string.","x-description-ar":"عدد أيام الإجازة المحتسبة، كنص عشري."},"status":{"type":"string","description":"Request status: `pending`, `approved`, `rejected`, `cancelled` or `revoked`.","x-description-ar":"حالة الطلب: `pending` (معلّق) أو `approved` (معتمد) أو `rejected` (مرفوض) أو `cancelled` (ملغى) أو `revoked` (مسحوب)."},"leave_type_name":{"type":"string","description":"Leave type, in the requested language.","x-description-ar":"نوع الإجازة بلغة الطلب."},"pending_cancellation":{"type":"boolean","description":"`true` when the employee asked to cancel an approved leave and the cancellation is what awaits a decision.","x-description-ar":"`true` إن طلب الموظف إلغاء إجازة معتمدة، فيكون الإلغاء هو ما ينتظر القرار."},"current_stage":{"type":"string","description":"Where the request stands: `awaiting_manager`, `awaiting_hr` or `cancellation_review`.","x-description-ar":"مرحلة الطلب: `awaiting_manager` (لدى المدير) أو `awaiting_hr` (لدى الموارد البشرية) أو `cancellation_review` (مراجعة إلغاء)."},"current_approver_name":{"type":"string","description":"Who holds the decision now (a manager's name, or HR).","x-description-ar":"من بيده القرار الآن (اسم المدير أو الموارد البشرية).","nullable":true},"escalated":{"type":"boolean","description":"`true` when it skipped the direct manager because they are on leave today.","x-description-ar":"`true` إن تجاوز الطلب المدير المباشر لأنه في إجازة اليوم.","nullable":true},"escalated_from_name":{"type":"string","description":"The direct manager it skipped, when escalated.","x-description-ar":"المدير المباشر الذي تجاوزه الطلب عند التصعيد.","nullable":true},"escalated_to_hr":{"type":"boolean","description":"`true` when every manager up the chain is away, so it went to HR.","x-description-ar":"`true` إن كان كل المديرين في السلسلة غائبين فانتقل الطلب إلى الموارد البشرية.","nullable":true},"days_pending":{"type":"integer","description":"Days since the request was submitted.","x-description-ar":"الأيام منذ تقديم الطلب."},"days_at_current_stage":{"type":"integer","description":"Days at the current stage.","x-description-ar":"الأيام في المرحلة الحالية."}}},"dashboard_people_on_leave_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/dashboard_person_on_leave"},"description":"The people on this page.","x-description-ar":"الأشخاص في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"dashboard_person_on_leave":{"type":"object","description":"Someone on approved leave. Nothing says why: no leave type, reason or balance.","x-description-ar":"شخص في إجازة معتمدة، دون ذكر السبب: لا نوع إجازة ولا سبب ولا رصيد.","required":["id","employee_id","employee_name","start_date","end_date","back_on"],"properties":{"id":{"type":"integer","description":"Leave request id, as in `leave_requests.show`.","x-description-ar":"رقم طلب الإجازة، كما في `leave_requests.show`."},"employee_id":{"type":"integer","description":"The employee's id.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"The employee's full name.","x-description-ar":"اسم الموظف الكامل."},"employee_image":{"type":"string","description":"Always empty; kept for the web app.","x-description-ar":"فارغ دائماً؛ مُبقى لتطبيق الويب.","nullable":true},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"back_on":{"type":"string","description":"The day after the leave ends (it may fall on a weekend).","x-description-ar":"اليوم التالي لنهاية الإجازة (وقد يوافق عطلة نهاية الأسبوع).","format":"date"}}},"dashboard_resolved_approval":{"type":"object","description":"A leave request that has been decided.","x-description-ar":"طلب إجازة بُتّ فيه.","required":["id","employee_id","employee_name","start_date","end_date","balance","status","leave_type_name","resolved_at"],"properties":{"id":{"type":"integer","description":"Leave request id, as in `leave_requests.show`.","x-description-ar":"رقم طلب الإجازة، كما في `leave_requests.show`."},"employee_id":{"type":"integer","description":"The employee's id.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"The employee's full name.","x-description-ar":"اسم الموظف الكامل."},"employee_image":{"type":"string","description":"Always empty; kept for the web app.","x-description-ar":"فارغ دائماً؛ مُبقى لتطبيق الويب.","nullable":true},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Days of leave charged, as a decimal string.","x-description-ar":"عدد أيام الإجازة المحتسبة، كنص عشري."},"status":{"type":"string","description":"Request status: `pending`, `approved`, `rejected`, `cancelled` or `revoked`.","x-description-ar":"حالة الطلب: `pending` (معلّق) أو `approved` (معتمد) أو `rejected` (مرفوض) أو `cancelled` (ملغى) أو `revoked` (مسحوب)."},"leave_type_name":{"type":"string","description":"Leave type, in the requested language.","x-description-ar":"نوع الإجازة بلغة الطلب."},"resolved_at":{"type":"string","description":"When the last action on the request was taken, in UTC (`YYYY-MM-DD HH:MM:SS UTC`).","x-description-ar":"وقت آخر إجراء على الطلب بالتوقيت العالمي (`YYYY-MM-DD HH:MM:SS UTC`).","nullable":true}}},"dashboard_resolved_approval_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/dashboard_resolved_approval"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"dashboard_update":{"type":"object","description":"A team milestone.","x-description-ar":"مناسبة في الفريق.","required":["id","event_type","created_at","employee_id","employee_name","text"],"properties":{"id":{"type":"integer","description":"Update id.","x-description-ar":"رقم الخبر."},"event_type":{"type":"string","description":"`new_joiner` or `work_anniversary`.","x-description-ar":"`new_joiner` (منضم جديد) أو `work_anniversary` (ذكرى سنوات العمل)."},"created_at":{"type":"string","description":"When it was posted, in UTC (`YYYY-MM-DD HH:MM:SS UTC`).","x-description-ar":"وقت نشره بالتوقيت العالمي (`YYYY-MM-DD HH:MM:SS UTC`)."},"employee_id":{"type":"integer","description":"The employee it is about.","x-description-ar":"رقم الموظف الذي يخصه."},"employee_name":{"type":"string","description":"The employee's full name.","x-description-ar":"اسم الموظف الكامل."},"employee_image":{"type":"string","description":"Always empty; kept for the web app.","x-description-ar":"فارغ دائماً؛ مُبقى لتطبيق الويب.","nullable":true},"text":{"type":"string","description":"The announcement, in the requested language.","x-description-ar":"نص الخبر بلغة الطلب."}}},"dashboard_update_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/dashboard_update"},"description":"The updates on this page.","x-description-ar":"الأخبار في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"data_export":{"type":"object","description":"One export the token's owner started.","x-description-ar":"تصدير بدأه صاحب الرمز.","properties":{"id":{"type":"integer","description":"Export id.","x-description-ar":"رقم التصدير."},"page":{"type":"string","description":"The list it was exported from, e.g. `employees`, `payslips`, `hr_loans`.","x-description-ar":"القائمة التي صُدّر منها، مثل `employees` و`payslips` و`hr_loans`."},"format":{"type":"string","description":"`xlsx` or `csv`.","x-description-ar":"`xlsx` أو `csv`."},"status":{"type":"string","description":"`queued`, `processing`, `ready`, `downloaded`, `failed` or `expired` (file deleted after 7 days).","x-description-ar":"`queued` بالانتظار، `processing` قيد الإعداد، `ready` جاهز، `downloaded` نُزّل، `failed` فشل، `expired` حُذف الملف بعد ٧ أيام.","enum":["queued","processing","ready","downloaded","failed","expired"]},"total_records":{"type":"integer","description":"Records the export covers.","x-description-ar":"عدد السجلات التي يشملها التصدير.","nullable":true},"total_rows":{"type":"integer","description":"Rows in the file.","x-description-ar":"عدد الصفوف في الملف.","nullable":true},"processed_rows":{"type":"integer","description":"Rows written so far.","x-description-ar":"الصفوف المكتوبة حتى الآن.","nullable":true},"filename":{"type":"string","description":"File name.","x-description-ar":"اسم الملف.","nullable":true},"error_code":{"type":"string","description":"Why it failed: `generation_failed`, `forbidden`, `too_large`…","x-description-ar":"سبب الفشل: `generation_failed` أو `forbidden` أو `too_large`…","nullable":true},"created_at":{"type":"string","description":"When it was started, UTC ISO 8601.","x-description-ar":"وقت البدء بتوقيت UTC."},"snapshot_at":{"type":"string","description":"Moment the data was read.","x-description-ar":"لحظة قراءة البيانات.","nullable":true},"finished_at":{"type":"string","description":"When the file was ready or the export failed.","x-description-ar":"وقت جاهزية الملف أو فشل التصدير.","nullable":true},"expires_at":{"type":"string","description":"When the file will be deleted.","x-description-ar":"وقت حذف الملف.","nullable":true},"download_url":{"type":"string","description":"Path of `exports.download` for this export (`/open/v1/exports/{id}/download`) while the file is kept; null before it is ready and after it expires.","x-description-ar":"مسار `exports.download` لهذا التصدير (`/open/v1/exports/{id}/download`) ما دام الملف محفوظاً؛ وnull قبل جاهزيته وبعد انتهائه.","nullable":true}}},"deduction":{"type":"object","description":"A deduction.","x-description-ar":"استقطاع.","properties":{"id":{"type":"integer","description":"Deduction id.","x-description-ar":"رقم الاستقطاع."},"reference":{"type":"string","description":"Reference, e.g. `DCN-0017`.","x-description-ar":"المرجع، مثل `DCN-0017`."},"kind":{"type":"string","description":"`other` (a general deduction), `policy_violation` (a penalty), `loan_repayment` or `reimbursement` (money the employee owes back). Managers may only use `other` and `policy_violation`.","x-description-ar":"`other` استقطاع عام، `policy_violation` جزاء مخالفة، `loan_repayment` سداد سلفة، `reimbursement` مبلغ مستحق الاسترداد من الموظف. لا يستخدم المديرون إلا `other` و`policy_violation`.","enum":["other","policy_violation","loan_repayment","reimbursement"]},"amount":{"type":"string","description":"Amount, decimal string.","x-description-ar":"المبلغ، نص عشري."},"status":{"type":"string","description":"`draft` (waiting for HR), `with_accounting` (approved, waiting for the accountant in Qoyod), `not_paid` (approved, the next payroll run deducts it), `partially_paid`, `paid` (deducted), or `rejected`.","x-description-ar":"`draft` بانتظار الموارد البشرية، `with_accounting` معتمد وبانتظار المحاسب في قيود، `not_paid` معتمد ويستقطعه المسيّر التالي، `partially_paid` مستقطع جزئياً، `paid` مستقطع، `rejected` مرفوض.","enum":["draft","with_accounting","not_paid","partially_paid","paid","rejected"]},"date":{"type":"string","description":"Date of the deduction.","x-description-ar":"تاريخ الاستقطاع.","format":"date","nullable":true},"description":{"type":"string","description":"Free-text description; also the payslip line label.","x-description-ar":"وصف حر، وهو أيضاً وصف البند في القسيمة.","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف.","nullable":true},"submitted_by":{"type":"object","nullable":true,"description":"The manager who proposed it; null when HR added it.","x-description-ar":"المدير الذي اقترحه؛ null إن أضافته الموارد البشرية.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"rejected_by":{"type":"object","nullable":true,"description":"Who in HR rejected it; null when the accountant declined it or it was not rejected.","x-description-ar":"من رفضه في الموارد البشرية؛ null إن رفضه المحاسب أو لم يُرفض.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"rejected_at":{"type":"string","description":"When it was rejected, UTC ISO 8601.","x-description-ar":"وقت الرفض بتوقيت UTC بصيغة ISO 8601.","nullable":true},"rejection_reason":{"type":"string","description":"Why it was rejected.","x-description-ar":"سبب الرفض.","nullable":true}}},"deduction_detail":{"type":"object","description":"A deduction, with what accounting said about it.","x-description-ar":"استقطاع مع رأي المحاسبة فيه.","allOf":[{"$ref":"#/components/schemas/deduction"}],"properties":{"accounting":{"type":"object","nullable":true,"description":"The accountant's latest answer in Qoyod; null when the deduction never went to accounting.","x-description-ar":"آخر رد للمحاسب في قيود؛ null إن لم يُرسل الاستقطاع إلى المحاسبة.","properties":{"state":{"type":"string","description":"Delivery or decision state, e.g. `sending`, `pending`, `approved`, `declined`.","x-description-ar":"حالة الإرسال أو القرار، مثل `sending` و`pending` و`approved` و`declined`."},"reason":{"type":"string","description":"The accountant's reason, if any.","x-description-ar":"سبب المحاسب إن وُجد.","nullable":true},"reason_code":{"type":"string","description":"Machine code of the reason.","x-description-ar":"رمز السبب.","nullable":true},"decided_by":{"type":"string","description":"Email of the accountant who decided.","x-description-ar":"بريد المحاسب الذي قرر.","nullable":true},"decided_at":{"type":"string","description":"When they decided, UTC ISO 8601.","x-description-ar":"وقت القرار بتوقيت UTC.","nullable":true}}}}},"deduction_input":{"type":"object","description":"The deduction's fields.","x-description-ar":"حقول الاستقطاع.","properties":{"kind":{"type":"string","description":"`other` (a general deduction), `policy_violation` (a penalty), `loan_repayment` or `reimbursement` (money the employee owes back). Managers may only use `other` and `policy_violation`.","x-description-ar":"`other` استقطاع عام، `policy_violation` جزاء مخالفة، `loan_repayment` سداد سلفة، `reimbursement` مبلغ مستحق الاسترداد من الموظف. لا يستخدم المديرون إلا `other` و`policy_violation`.","enum":["other","policy_violation","loan_repayment","reimbursement"]},"amount":{"type":"string","description":"Amount, decimal string, more than zero.","x-description-ar":"المبلغ، نص عشري أكبر من صفر."},"date":{"type":"string","description":"Date of the deduction.","x-description-ar":"تاريخ الاستقطاع.","format":"date"},"description":{"type":"string","description":"Free-text description, shown on the payslip.","x-description-ar":"وصف حر يظهر في القسيمة."}}},"department":{"type":"object","description":"A department.","x-description-ar":"قسم.","required":["id","name_en","name_ar","name","active_employee_count"],"properties":{"id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"active_employee_count":{"type":"integer","description":"Employees in the department who still work here (active or on notice).","x-description-ar":"عدد موظفي القسم الذين ما زالوا على رأس العمل (نشطون أو في فترة الإشعار)."}}},"department_create_input":{"type":"object","required":["department"],"properties":{"department":{"type":"object","required":["name_en","name_ar"],"description":"The department's names. Both are required, and each must be unique in the company.","x-description-ar":"اسما القسم. كلاهما مطلوب، ويجب أن يكون كل منهما فريداً في الشركة.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}}}}},"department_input":{"type":"object","required":["department"],"properties":{"department":{"type":"object","description":"The names to change; send either or both. Each must be unique in the company.","x-description-ar":"الاسمان المراد تغييرهما؛ أرسل أحدهما أو كليهما. يجب أن يكون كل منهما فريداً في الشركة.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}}}}},"department_ticket_assignees":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"Employed members of the department, by name.","x-description-ar":"الموظفون على رأس العمل في القسم مرتبين بالاسم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id; send it as `assignee_id`.","x-description-ar":"رقم الموظف؛ أرسله في `assignee_id`."},"name":{"type":"string","description":"Full name in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم."},"label":{"type":"string","description":"`\u003cname\u003e - \u003cdepartment\u003e`, ready to show.","x-description-ar":"`\u003cالاسم\u003e - \u003cالقسم\u003e` جاهز للعرض."}}}}}},"department_ticket_bulk_result":{"type":"object","required":["succeeded","failed"],"description":"What happened to each request. Each one is done on its own: a failure never undoes the others.","x-description-ar":"ما حدث لكل طلب. يُنفَّذ كل طلب وحده، وفشل أحدها لا يلغي ما نجح من غيره.","properties":{"succeeded":{"type":"array","items":{"type":"integer"},"description":"Ids done.","x-description-ar":"أرقام الطلبات التي نُفّذت."},"failed":{"type":"array","description":"Ids not done, each with the reason (not found, not allowed, already taken…).","x-description-ar":"أرقام الطلبات التي لم تُنفَّذ مع السبب (غير موجود، غير مسموح، استُلم مسبقاً…).","items":{"type":"object","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"error":{"type":"string","description":"Why, in the requested language.","x-description-ar":"السبب بلغة الطلب."}}}}}},"department_ticket_ids":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","items":{"type":"integer"},"minItems":1,"maxItems":50,"description":"Request ids, 1 to 50, from the list.","x-description-ar":"أرقام الطلبات، من ١ إلى ٥٠، من القائمة."}}},"department_ticket_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/department_ticket_row"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"department_ticket_row":{"type":"object","description":"One request in a list.","x-description-ar":"طلب واحد في قائمة.","properties":{"id":{"type":"integer","description":"Request id; use it with `tickets.show` and the other request operations.","x-description-ar":"رقم الطلب؛ استخدمه مع `tickets.show` وبقية عمليات الطلب."},"reference":{"type":"string","description":"Reference shown to people, e.g. `TKT-000215`.","x-description-ar":"المرجع الظاهر للناس، مثل `TKT-000215`."},"subject":{"type":"string","description":"Subject the requester wrote.","x-description-ar":"الموضوع الذي كتبه مقدّم الطلب."},"status":{"type":"string","description":"Where the request is: `pending_manager` / `pending_hr` (waiting for approval), `open` (approved, nobody on it yet), `assigned` (given to someone, not accepted yet), `in_progress`, `in_review` (done, waiting for the requester), `closed`, `rejected` or `cancelled`.","x-description-ar":"مرحلة الطلب: `pending_manager` / `pending_hr` بانتظار الاعتماد، `open` معتمد ولم يستلمه أحد، `assigned` أُسند لشخص ولم يقبله بعد، `in_progress` قيد التنفيذ، `in_review` أُنجز وينتظر مراجعة مقدّم الطلب، `closed` مغلق، `rejected` مرفوض، `cancelled` ملغى.","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]},"priority":{"type":"string","description":"Priority: `low`, `medium`, `high` or `highest`.","x-description-ar":"الأولوية: `low` أو `medium` أو `high` أو `highest`.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department had to finish, from approval.","x-description-ar":"عدد الأيام المتاحة للقسم للإنجاز بعد الاعتماد."},"type":{"type":"object","description":"Request type.","x-description-ar":"نوع الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"category":{"type":"object","description":"Request category, with its `icon` and `color`.","x-description-ar":"فئة الطلب مع `icon` و`color`.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة."},"color":{"type":"string","description":"Colour key.","x-description-ar":"مفتاح اللون.","nullable":true}}},"department":{"type":"object","description":"Department handling the request.","x-description-ar":"القسم الذي ينفّذ الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"requester":{"type":"object","nullable":false,"description":"Who asked.","x-description-ar":"مقدّم الطلب.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"assignee":{"type":"object","nullable":true,"description":"Who is working on it; null while nobody is.","x-description-ar":"من يعمل عليه؛ null ما دام لم يُسند لأحد.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"due_on":{"type":"string","description":"Due date (`YYYY-MM-DD`), set at approval from the target days; null before.","x-description-ar":"تاريخ الاستحقاق (`YYYY-MM-DD`)، يُحدَّد عند الاعتماد من عدد الأيام المستهدف؛ null قبل ذلك.","format":"date","nullable":true},"overdue":{"type":"boolean","description":"Past its due date and still open, assigned or in progress.","x-description-ar":"تجاوز تاريخ استحقاقه وما زال مفتوحاً أو مسنداً أو قيد التنفيذ."},"last_activity_at":{"type":"string","description":"Last change or comment, UTC.","x-description-ar":"آخر تغيير أو تعليق، بتوقيت UTC.","format":"date-time","nullable":true},"created_at":{"type":"string","description":"Submitted at, UTC.","x-description-ar":"وقت التقديم، بتوقيت UTC.","format":"date-time"},"available_actions":{"type":"array","items":{"type":"string","enum":["approve","reject","take","assign","accept","reject_work","send_for_review","send_back","close","cancel","priority","due_date"]},"description":"What the token owner may do on this request now; each is a `tickets.\u003caction\u003e` operation (`take` → `tickets.take`, `due_date` → `tickets.due_date`).","x-description-ar":"ما يستطيع صاحب الرمز فعله على هذا الطلب الآن؛ لكل إجراء عملية `tickets.\u003caction\u003e` (`take` ← `tickets.take`، `due_date` ← `tickets.due_date`)."}}},"department_ticket_stat_cards":{"type":"object","description":"Request counts over the department's approved requests. Filters never apply.","x-description-ar":"أعداد الطلبات المعتمدة للقسم. لا تتأثر بأي تصفية.","properties":{"open":{"type":"integer","description":"Approved and not finished (not closed, rejected or cancelled).","x-description-ar":"معتمدة ولم تنتهِ (غير مغلقة ولا مرفوضة ولا ملغاة)."},"unassigned":{"type":"integer","description":"Open, nobody on them yet.","x-description-ar":"مفتوحة ولم يستلمها أحد بعد."},"overdue":{"type":"integer","description":"Open, assigned or in progress past their due date.","x-description-ar":"مفتوحة أو مسندة أو قيد التنفيذ وتجاوزت تاريخ استحقاقها."},"resolved_this_week":{"type":"integer","description":"Sent for review or closed since the start of this week.","x-description-ar":"أُرسلت للمراجعة أو أُغلقت منذ بداية هذا الأسبوع."}}},"document":{"type":"object","description":"A document: one file on an employee's profile, with its expiry and verification status.","x-description-ar":"مستند: ملف واحد في ملف الموظف، مع حالة انتهائه والتحقق منه.","required":["id","title","verified","version_number","current_version","reminders_enabled","expiry_state"],"properties":{"id":{"type":"integer","description":"Document id. Each version has its own id.","x-description-ar":"رقم المستند. لكل إصدار رقمه الخاص."},"title":{"type":"string","description":"The document's name, e.g. \"Iqama\" or \"Employment contract\".","x-description-ar":"اسم المستند، مثل «الإقامة» أو «عقد العمل»."},"expiry_date":{"type":"string","description":"When the document expires (YYYY-MM-DD); null when it does not expire.","x-description-ar":"تاريخ انتهاء المستند (YYYY-MM-DD)؛ فارغ إن كان لا ينتهي.","format":"date","nullable":true},"expiry_state":{"type":"string","description":"`valid`, `expiring_soon` (within the window set in `document_settings.show`) or `expired`. A document with no expiry date is always `valid`.","x-description-ar":"`valid` (ساري) أو `expiring_soon` (ينتهي قريباً، ضمن المدة المحددة في `document_settings.show`) أو `expired` (منتهٍ). المستند بلا تاريخ انتهاء يكون دائماً `valid`.","enum":["valid","expiring_soon","expired"]},"verified":{"type":"boolean","description":"HR has checked the file. Uploaded by HR: verified; uploaded by the employee to their own folder: not verified until HR marks it.","x-description-ar":"تحققت الموارد البشرية من الملف. ما ترفعه الموارد البشرية يكون متحققاً منه؛ وما يرفعه الموظف في مجلده يبقى غير متحقق منه حتى تعتمده الموارد البشرية."},"reminders_enabled":{"type":"boolean","description":"Expiry reminders are on. `false` means muted for every version of the document.","x-description-ar":"تذكيرات الانتهاء مفعّلة. `false` تعني أنها مكتومة لكل إصدارات المستند."},"version_number":{"type":"integer","description":"1 for the first upload; each renewal adds one.","x-description-ar":"1 للرفع الأول؛ ويزيد واحداً مع كل تجديد."},"current_version":{"type":"boolean","description":"This is the latest version. Older versions are kept for history only.","x-description-ar":"هذا أحدث إصدار. الإصدارات الأقدم محفوظة للسجل فقط."},"attachable_type":{"type":"string","description":"`Folder` when the document is filed in a folder.","x-description-ar":"`Folder` إذا كان المستند في مجلد.","nullable":true},"attachable_id":{"type":"integer","description":"The folder's id (see `folders.list`).","x-description-ar":"رقم المجلد (انظر `folders.list`).","nullable":true},"employee":{"type":"object","nullable":true,"description":"The employee whose folder holds the document.","x-description-ar":"الموظف الذي يضم مجلده المستند.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"First and last name.","x-description-ar":"الاسم الأول واسم العائلة."}}},"file_name":{"type":"string","description":"The uploaded file's name.","x-description-ar":"اسم الملف المرفوع.","nullable":true},"file_size":{"type":"integer","description":"File size in bytes.","x-description-ar":"حجم الملف بالبايت.","nullable":true},"content_type":{"type":"string","description":"`application/pdf`, `image/jpeg` or `image/png`.","x-description-ar":"`application/pdf` أو `image/jpeg` أو `image/png`.","nullable":true},"file_url":{"type":"string","description":"A link to download the file. It is temporary: fetch the document again for a fresh one.","x-description-ar":"رابط لتنزيل الملف. الرابط مؤقت: اطلب المستند مجدداً للحصول على رابط جديد.","nullable":true},"created_at":{"type":"string","description":"When this version was uploaded, in UTC (`YYYY-MM-DD HH:MM:SS UTC`).","x-description-ar":"وقت رفع هذا الإصدار بتوقيت UTC (`YYYY-MM-DD HH:MM:SS UTC`).","example":"2027-02-10 06:15:00 UTC"},"updated_at":{"type":"string","description":"When this version last changed, in UTC.","x-description-ar":"آخر تعديل على هذا الإصدار بتوقيت UTC.","example":"2027-02-10 06:15:00 UTC"}}},"document_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/document"},"description":"The documents on this page.","x-description-ar":"المستندات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"document_setting":{"type":"object","description":"The company's document-expiry settings.","x-description-ar":"إعدادات انتهاء المستندات في الشركة.","required":["id","expiring_soon_window_days","reminder_frequency_days","automatic_reminders_enabled"],"properties":{"id":{"type":"integer","description":"Settings record id (one per company).","x-description-ar":"رقم سجل الإعدادات (سجل واحد لكل شركة)."},"expiring_soon_window_days":{"type":"integer","description":"How many days before its expiry date a document counts as expiring soon.","x-description-ar":"عدد الأيام قبل تاريخ الانتهاء التي يُعدّ فيها المستند قريب الانتهاء."},"reminder_frequency_days":{"type":"integer","description":"With automatic reminders, how many days apart reminders are repeated.","x-description-ar":"مع التذكيرات التلقائية، عدد الأيام بين كل تذكير والذي يليه."},"automatic_reminders_enabled":{"type":"boolean","description":"QHR emails employees every morning about their documents that are expiring soon.","x-description-ar":"يرسل QHR كل صباح بريداً للموظفين عن مستنداتهم القريبة من الانتهاء."}}},"employee":{"type":"object","description":"An employee's full record.","x-description-ar":"السجل الكامل للموظف.","required":["id","first_name","last_name"],"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_no_locked":{"type":"boolean","description":"True when the employee number can no longer change (linked to Qoyod accounting).","x-description-ar":"صحيح عندما لا يمكن تغيير الرقم الوظيفي (مرتبط بمحاسبة قيود)."},"first_name":{"type":"string","description":"First name in English.","x-description-ar":"الاسم الأول بالإنجليزية."},"last_name":{"type":"string","description":"Last name in English.","x-description-ar":"اسم العائلة بالإنجليزية."},"first_name_ar":{"type":"string","description":"First name in Arabic.","x-description-ar":"الاسم الأول بالعربية.","nullable":true},"last_name_ar":{"type":"string","description":"Last name in Arabic.","x-description-ar":"اسم العائلة بالعربية.","nullable":true},"full_name":{"type":"string","description":"Full name in English.","x-description-ar":"الاسم الكامل بالإنجليزية."},"gender":{"type":"string","description":"`male` or `female`.","x-description-ar":"`male` ذكر أو `female` أنثى.","nullable":true},"date_of_birth":{"type":"string","description":"Date of birth.","x-description-ar":"تاريخ الميلاد.","format":"date","nullable":true},"marital_status":{"type":"string","description":"`single`, `married`, `divorced` or `widowed`.","x-description-ar":"`single` أعزب، `married` متزوج، `divorced` مطلق، `widowed` أرمل.","nullable":true},"nationality":{"type":"string","description":"Nationality, ISO country code.","x-description-ar":"الجنسية برمز الدولة ISO.","nullable":true},"residence_country":{"type":"string","description":"Country of residence, ISO country code.","x-description-ar":"بلد الإقامة برمز الدولة ISO.","nullable":true},"national_id_number":{"type":"string","description":"National ID or Iqama number.","x-description-ar":"رقم الهوية الوطنية أو الإقامة.","nullable":true},"national_id_issued_date":{"type":"string","description":"ID issue date.","x-description-ar":"تاريخ إصدار الهوية.","format":"date","nullable":true},"national_id_expiry_date":{"type":"string","description":"ID expiry date.","x-description-ar":"تاريخ انتهاء الهوية.","format":"date","nullable":true},"email":{"type":"string","description":"Personal email; also the QHR login once invited.","x-description-ar":"البريد الشخصي؛ وهو بريد الدخول إلى QHR بعد الدعوة.","nullable":true},"work_email":{"type":"string","description":"Work email.","x-description-ar":"بريد العمل.","nullable":true},"work_phone_number":{"type":"string","description":"Work phone, international format.","x-description-ar":"هاتف العمل بالصيغة الدولية.","nullable":true},"home_phone_number":{"type":"string","description":"Home phone.","x-description-ar":"هاتف المنزل.","nullable":true},"address":{"type":"string","description":"Home address.","x-description-ar":"عنوان السكن.","nullable":true},"emergency_contact_name":{"type":"string","description":"Emergency contact's name.","x-description-ar":"اسم جهة الاتصال للطوارئ.","nullable":true},"emergency_contact_relationship":{"type":"string","description":"Relationship to the employee.","x-description-ar":"صلة القرابة بالموظف.","nullable":true},"emergency_contact_home_phone_number":{"type":"string","description":"Emergency contact's home phone.","x-description-ar":"هاتف منزل جهة الطوارئ.","nullable":true},"emergency_contact_mobile_phone_number":{"type":"string","description":"Emergency contact's mobile.","x-description-ar":"جوال جهة الطوارئ.","nullable":true},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي.","nullable":true},"department_id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم.","nullable":true},"manager_id":{"type":"integer","description":"Id of the employee this one reports to.","x-description-ar":"رقم الموظف الذي يتبع له.","nullable":true},"manager_name":{"type":"string","description":"Manager's full name.","x-description-ar":"الاسم الكامل للمدير.","nullable":true},"location_id":{"type":"integer","description":"Main work location id.","x-description-ar":"رقم موقع العمل الرئيسي.","nullable":true},"location_name":{"type":"string","description":"Main work location name.","x-description-ar":"اسم موقع العمل الرئيسي.","nullable":true},"additional_locations":{"type":"array","description":"Other check-in locations.","x-description-ar":"مواقع تسجيل حضور إضافية.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Location id.","x-description-ar":"رقم الموقع."},"name":{"type":"string","description":"Location name.","x-description-ar":"اسم الموقع."},"is_active":{"type":"boolean","description":"False when the location was switched off.","x-description-ar":"خطأ إن كان الموقع معطّلاً."}}}},"last_working_day":{"type":"string","description":"Last working day, once the employee is leaving.","x-description-ar":"آخر يوم عمل عند مغادرة الموظف.","format":"date","nullable":true},"employment_status":{"type":"string","description":"Employment status, translated.","x-description-ar":"حالة التوظيف مترجمة.","nullable":true},"employment_status_key":{"type":"string","description":"Employment status key: `active`, `notice_period` (resigned, still working) or `inactive` (left).","x-description-ar":"مفتاح حالة التوظيف: `active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر.","enum":["active","notice_period","inactive"],"nullable":true},"portal_access":{"type":"string","description":"QHR login status, translated.","x-description-ar":"حالة الدخول إلى QHR مترجمة.","nullable":true},"portal_access_key":{"type":"string","description":"QHR login status key: `not_invited`, `pending` (invited, not accepted), `activated`, `cancelled` or `expired`.","x-description-ar":"مفتاح حالة الدخول إلى QHR: `not_invited` لم يُدعَ، `pending` دُعي ولم يقبل، `activated` مفعّل، `cancelled` ملغى، `expired` انتهت الدعوة.","nullable":true},"has_portal_access":{"type":"boolean","description":"True when the employee can sign in to QHR.","x-description-ar":"صحيح إن كان الموظف يستطيع الدخول إلى QHR."},"attendance_profile":{"type":"object","description":"Today's working schedule: profile, shift times and target hours.","x-description-ar":"جدول العمل لليوم: الملف وأوقات الوردية والساعات المستهدفة.","nullable":true},"employment_detail":{"type":"object","description":"Contract and bank data: `join_date`, `contract_type`, `employment_type_id`, `iban`…","x-description-ar":"بيانات العقد والبنك: `join_date` و`contract_type` و`employment_type_id` و`iban`…","nullable":true},"salary":{"type":"object","description":"Current salary: `basic_salary_amount`, `pay_frequency`, `currency`, benefits and deductions. Present only when the caller may see salaries.","x-description-ar":"الراتب الحالي: `basic_salary_amount` و`pay_frequency` و`currency` والبدلات والاستقطاعات. يظهر فقط إن كان للمستدعي حق رؤية الرواتب.","nullable":true},"documents":{"type":"array","description":"The employee's documents (id, title, expiry, file).","x-description-ar":"مستندات الموظف (الرقم، العنوان، الانتهاء، الملف).","items":{"type":"object"}},"created_at":{"type":"string","description":"When the record was created, in UTC (`2024-02-20 06:30:00 UTC`).","x-description-ar":"وقت إنشاء السجل بتوقيت UTC (`2024-02-20 06:30:00 UTC`)."},"updated_at":{"type":"string","description":"When the record last changed, in UTC.","x-description-ar":"وقت آخر تعديل على السجل بتوقيت UTC."}}},"employee_bulk_update_status":{"type":"object","description":"A bulk edit: its preview before confirmation, or its outcome after.","x-description-ar":"تعديل جماعي: معاينته قبل التأكيد، أو نتيجته بعده.","required":["id","status","progress","summary","results"],"properties":{"id":{"type":"integer","description":"Bulk update id.","x-description-ar":"رقم التعديل الجماعي."},"status":{"type":"string","description":"`pending` (preview being built), `awaiting_confirmation` (preview ready), `processing` (being applied), `completed`, `failed` or `cancelled`.","x-description-ar":"`pending` تُبنى المعاينة، `awaiting_confirmation` المعاينة جاهزة، `processing` قيد التطبيق، `completed` اكتمل، `failed` فشل، `cancelled` أُلغي.","enum":["pending","awaiting_confirmation","processing","completed","failed","cancelled"]},"progress":{"type":"object","description":"Rows processed so far out of the rows in the file.","x-description-ar":"عدد الصفوف التي عولجت حتى الآن من صفوف الملف.","properties":{"processed":{"type":"integer","description":"Rows processed.","x-description-ar":"الصفوف المعالجة."},"total":{"type":"integer","description":"Rows in the file.","x-description-ar":"صفوف الملف."}}},"expires_at":{"type":"string","description":"When an unconfirmed preview lapses (24 hours after the upload), UTC; null in any other status.","x-description-ar":"متى تنتهي صلاحية المعاينة غير المؤكدة (بعد ٢٤ ساعة من الرفع) بتوقيت UTC؛ null في أي حالة أخرى.","format":"date-time","nullable":true},"summary":{"type":"object","description":"Before confirmation: `changed`, `unchanged`, `invalid` and `status_changes` (rows changing employment status). After: `applied`, `failed` and `skipped`.","x-description-ar":"قبل التأكيد: `changed` و`unchanged` و`invalid` و`status_changes` (صفوف تغيّر حالة التوظيف). بعده: `applied` و`failed` و`skipped`."},"column_labels":{"type":"object","description":"Sheet column =\u003e its name in the requested language, for showing the changes.","x-description-ar":"عمود الملف =\u003e اسمه بلغة الطلب، لعرض التغييرات."},"results":{"type":"array","description":"One entry per row: `row`, `employee_id`, `employee_no`, `name`, `status` (`changed`, `unchanged`, `invalid`; after confirmation `applied`, `failed`, `skipped`), `changes` (column =\u003e `from` / `to`), `errors` and `warnings`. Salary and allowance changes are left out for a caller who may not see salaries.","x-description-ar":"عنصر لكل صف: `row` و`employee_id` و`employee_no` و`name` و`status` (`changed` أو `unchanged` أو `invalid`، وبعد التأكيد `applied` أو `failed` أو `skipped`) و`changes` (العمود =\u003e `from` / `to`) و`errors` و`warnings`. تُحذف تغييرات الراتب والبدلات لمن لا يحق له رؤية الرواتب.","items":{"type":"object"}},"error":{"type":"string","description":"Why the whole run failed (an unexpected error); null otherwise.","x-description-ar":"سبب فشل العملية كاملة (خطأ غير متوقع)؛ وإلا null.","nullable":true}}},"employee_earning":{"type":"object","description":"One line of a payslip: an amount the employee earns (`income`) or that is taken off (`deduction`).","x-description-ar":"بند واحد في القسيمة: مبلغ يستحقه الموظف (`income`) أو يُستقطع منه (`deduction`).","properties":{"id":{"type":"integer","description":"Line id.","x-description-ar":"رقم البند."},"earnable_type":{"type":"string","description":"What produced the line: `Salary` (basic pay), `Benefit` (allowance), `SalaryDeduction`, `Timesheet` (overtime, absence, unpaid leave), `Bonus`, `Deduction`, `InsuranceDeduction`, `Loan`, `LoanInstallment` or `CustodyInstallment`.","x-description-ar":"مصدر البند: `Salary` الراتب الأساسي، `Benefit` بدل، `SalaryDeduction` استقطاع ثابت، `Timesheet` الإضافي والغياب والإجازة غير المدفوعة، `Bonus` مكافأة، `Deduction` استقطاع، `InsuranceDeduction` تأمين، `Loan` سلفة، `LoanInstallment` قسط سلفة، `CustodyInstallment` قسط عهدة."},"earnable_id":{"type":"integer","description":"Id of that source record.","x-description-ar":"رقم سجل المصدر."},"kind":{"type":"string","description":"`income` adds to the net, `deduction` takes from it.","x-description-ar":"`income` يضاف إلى الصافي، `deduction` يُطرح منه.","enum":["income","deduction"]},"amount":{"type":"string","description":"Amount, decimal string.","x-description-ar":"المبلغ، نص عشري."},"applies":{"type":"boolean","description":"False when the line is switched off and does not count in the totals.","x-description-ar":"خطأ إن كان البند معطّلاً ولا يدخل في الإجماليات."},"flag":{"type":"boolean","description":"On an insurance line, true for the employee's share (deducted from pay) and false for the employer's share (shown, never deducted).","x-description-ar":"في بند التأمين: صحيح لحصة الموظف (تُستقطع من الراتب) وخطأ لحصة المنشأة (تُعرض ولا تُستقطع)."},"description_en":{"type":"string","description":"Line label in English.","x-description-ar":"وصف البند بالإنجليزية.","nullable":true},"description_ar":{"type":"string","description":"Line label in Arabic.","x-description-ar":"وصف البند بالعربية.","nullable":true},"auto_deferred":{"type":"boolean","description":"True when QHR switched the line off because the net could not carry it (moved to next month).","x-description-ar":"صحيح إن عطّل QHR البند لأن الصافي لا يكفي له (رُحّل إلى الشهر التالي)."},"applies_overridden":{"type":"boolean","description":"True once someone switched the line on or off by hand.","x-description-ar":"صحيح إن شغّل أحدهم البند أو عطّله يدوياً."},"currency":{"type":"string","description":"Currency of the amount, ISO code.","x-description-ar":"عملة المبلغ برمز ISO."}}},"employee_employment_detail_create":{"type":"object","description":"Contract and bank data.","x-description-ar":"بيانات العقد والبنك.","properties":{"join_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","format":"date"},"employment_type_id":{"type":"integer","description":"Employment type, from `employees.meta_data` (`employment_types`).","x-description-ar":"نوع التوظيف، من `employees.meta_data` (`employment_types`)."},"attendance_setting_id":{"type":"integer","description":"Attendance profile, from `employees.meta_data` (`attendance_settings`).","x-description-ar":"ملف الحضور، من `employees.meta_data` (`attendance_settings`)."},"contract_type":{"type":"string","description":"`definite` (fixed term) or `indefinite`. Saudi nationals cannot be on `definite` with no end date, and non-Saudis cannot be `indefinite`.","x-description-ar":"`definite` محدد المدة أو `indefinite` غير محدد. لا يكون غير السعودي على عقد `indefinite`.","enum":["definite","indefinite"]},"contract_end_date":{"type":"string","description":"Contract end date, for `definite` contracts.","x-description-ar":"تاريخ نهاية العقد للعقود المحددة.","format":"date"},"iban":{"type":"string","description":"IBAN for salary transfers.","x-description-ar":"رقم الآيبان لتحويل الراتب."},"bank_name":{"type":"string","description":"Bank name.","x-description-ar":"اسم البنك."},"bank_code":{"type":"string","description":"Bank code from `employees.meta_data` (`banks`), e.g. `RJHI`.","x-description-ar":"رمز البنك من `employees.meta_data` (`banks`)، مثل `RJHI`."}},"required":["join_date","contract_type","employment_type_id"]},"employee_employment_detail_input":{"type":"object","description":"Contract and bank data.","x-description-ar":"بيانات العقد والبنك.","properties":{"join_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","format":"date"},"employment_type_id":{"type":"integer","description":"Employment type, from `employees.meta_data` (`employment_types`).","x-description-ar":"نوع التوظيف، من `employees.meta_data` (`employment_types`)."},"attendance_setting_id":{"type":"integer","description":"Attendance profile, from `employees.meta_data` (`attendance_settings`).","x-description-ar":"ملف الحضور، من `employees.meta_data` (`attendance_settings`)."},"contract_type":{"type":"string","description":"`definite` (fixed term) or `indefinite`. Saudi nationals cannot be on `definite` with no end date, and non-Saudis cannot be `indefinite`.","x-description-ar":"`definite` محدد المدة أو `indefinite` غير محدد. لا يكون غير السعودي على عقد `indefinite`.","enum":["definite","indefinite"]},"contract_end_date":{"type":"string","description":"Contract end date, for `definite` contracts.","x-description-ar":"تاريخ نهاية العقد للعقود المحددة.","format":"date"},"iban":{"type":"string","description":"IBAN for salary transfers.","x-description-ar":"رقم الآيبان لتحويل الراتب."},"bank_name":{"type":"string","description":"Bank name.","x-description-ar":"اسم البنك."},"bank_code":{"type":"string","description":"Bank code from `employees.meta_data` (`banks`), e.g. `RJHI`.","x-description-ar":"رمز البنك من `employees.meta_data` (`banks`)، مثل `RJHI`."}}},"employee_import_status":{"type":"object","description":"An employee import: where it is and what happened to each row.","x-description-ar":"عملية استيراد موظفين: أين وصلت وما الذي حدث لكل صف.","required":["id","status","progress","summary","results"],"properties":{"id":{"type":"integer","description":"Import id.","x-description-ar":"رقم الاستيراد."},"status":{"type":"string","description":"`pending` (queued), `processing`, `completed` or `failed`.","x-description-ar":"`pending` في الانتظار، `processing` قيد المعالجة، `completed` اكتمل، `failed` فشل.","enum":["pending","processing","completed","failed"]},"progress":{"type":"object","description":"Rows processed so far out of the rows in the file.","x-description-ar":"عدد الصفوف التي عولجت حتى الآن من صفوف الملف.","properties":{"processed":{"type":"integer","description":"Rows processed.","x-description-ar":"الصفوف المعالجة."},"total":{"type":"integer","description":"Rows in the file.","x-description-ar":"صفوف الملف."}}},"summary":{"type":"object","description":"Employees created and rows that failed.","x-description-ar":"الموظفون الذين أُضيفوا والصفوف التي فشلت.","properties":{"created":{"type":"integer","description":"Employees created.","x-description-ar":"الموظفون المضافون."},"failed":{"type":"integer","description":"Rows refused.","x-description-ar":"الصفوف المرفوضة."}}},"results":{"type":"array","description":"One entry per processed row: `row` (sheet row number), `employee_no`, `name`, `status` (`created` or `failed`), `employee_id` (when created), `errors` and `warnings` (messages).","x-description-ar":"عنصر لكل صف عولج: `row` رقم الصف في الملف، و`employee_no`، و`name`، و`status` (`created` أو `failed`)، و`employee_id` (عند الإضافة)، و`errors` و`warnings` (رسائل).","items":{"type":"object"}},"error":{"type":"string","description":"Why the whole run failed (an unexpected error); null otherwise.","x-description-ar":"سبب فشل العملية كاملة (خطأ غير متوقع)؛ وإلا null.","nullable":true}}},"employee_invitation_message":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Confirmation, in the requested language.","x-description-ar":"رسالة تأكيد بلغة الطلب."}}},"employee_invitation_row":{"type":"object","description":"One employee and their QHR login status.","x-description-ar":"موظف واحد وحالة دخوله إلى QHR.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"invited_on":{"type":"string","description":"Day of the last invitation, `DD/MM/YYYY`; null when never invited.","x-description-ar":"يوم آخر دعوة بالشكل `DD/MM/YYYY`؛ null إن لم يُدعَ قط.","nullable":true},"employee_name":{"type":"string","description":"Full name in English.","x-description-ar":"الاسم الكامل بالإنجليزية."},"employee_email":{"type":"string","description":"Personal email, where the invitation is sent.","x-description-ar":"البريد الشخصي الذي تُرسل إليه الدعوة.","nullable":true},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"portal_access":{"type":"string","description":"QHR login status, translated.","x-description-ar":"حالة الدخول إلى QHR مترجمة.","nullable":true},"portal_access_key":{"type":"string","description":"QHR login status key: `not_invited`, `pending` (invited, not accepted), `activated`, `cancelled` or `expired`.","x-description-ar":"مفتاح حالة الدخول إلى QHR: `not_invited` لم يُدعَ، `pending` دُعي ولم يقبل، `activated` مفعّل، `cancelled` ملغى، `expired` انتهت الدعوة.","nullable":true}}},"employee_leave_policy_balance_card":{"type":"object","description":"One of the caller's leave policies with its balance. `available_balance` = `entitled_days` − `taken_days` − `pending_days`.","x-description-ar":"إحدى سياسات إجازة المستدعي مع رصيدها. `available_balance` = `entitled_days` − `taken_days` − `pending_days`.","properties":{"id":{"type":"integer","description":"Leave policy id — the `leave_policy_id` to request leave against.","x-description-ar":"رقم سياسة الإجازة — وهو `leave_policy_id` الذي يُطلب عليه الإجازة."},"name":{"type":"string","description":"Policy name in the language of the request.","x-description-ar":"اسم السياسة بلغة الطلب."},"duration":{"type":"number","description":"The policy's yearly (or one-time) entitlement in days.","x-description-ar":"استحقاق السياسة السنوي (أو لمرة واحدة) بالأيام."},"available_balance":{"type":"number","description":"Days that can still be requested now. May be negative where the policy allows it.","x-description-ar":"الأيام التي يمكن طلبها الآن. قد تكون سالبة إن سمحت السياسة بذلك."},"requires_document":{"type":"boolean","description":"Requests must attach a supporting document.","x-description-ar":"يجب إرفاق مستند داعم بالطلب."},"allow_past_dates":{"type":"boolean","description":"Leave may be requested for past dates.","x-description-ar":"يجوز طلب إجازة لتواريخ مضت."},"show_used_balance":{"type":"boolean","description":"The company shows employees their used days.","x-description-ar":"تُظهر الشركة للموظف الأيام المستخدمة."},"total_balance":{"type":"number","description":"Deprecated: same as `accrued_days`; use `entitled_days`.","x-description-ar":"قديم: يساوي `accrued_days`؛ استخدم `entitled_days`."},"days_used":{"type":"number","description":"Deprecated: taken plus pending; use `taken_days` and `pending_days`.","x-description-ar":"قديم: المأخوذ مع المعلق؛ استخدم `taken_days` و`pending_days`."},"accrued_days":{"type":"number","description":"Days granted this year by accrual (and manual adjustments).","x-description-ar":"الأيام الممنوحة هذه السنة بالاستحقاق (والتعديلات اليدوية)."},"carryover_days":{"type":"number","description":"Days carried over from last year.","x-description-ar":"الأيام المرحَّلة من السنة الماضية."},"carryover_usable":{"type":"boolean","description":"Carried-over days may be taken. When false they are not counted in `entitled_days` but are paid out when the employee leaves.","x-description-ar":"يجوز أخذ الأيام المرحَّلة. وإن كان خطأ فلا تُحسب في `entitled_days` لكنها تُصرف مقابلاً مالياً عند ترك الموظف للشركة."},"entitled_days":{"type":"number","description":"`accrued_days` plus usable `carryover_days`.","x-description-ar":"`accrued_days` مع `carryover_days` القابلة للاستخدام."},"taken_days":{"type":"number","description":"Days of approved leave charged to this year.","x-description-ar":"أيام الإجازات المعتمدة المحسوبة على هذه السنة."},"pending_days":{"type":"number","description":"Days reserved by requests still waiting for approval.","x-description-ar":"الأيام المحجوزة لطلبات ما زالت بانتظار الاعتماد."},"accrued_per":{"type":"string","description":"`per_year`, `one_time_only` or `per_event`. A `per_event` policy has no balance: a zero or negative `available_balance` does not stop a request.","x-description-ar":"`per_year` أو `one_time_only` أو `per_event`. سياسة `per_event` بلا رصيد: الرصيد الصفري أو السالب لا يمنع الطلب."},"allow_negative_balance":{"type":"boolean","description":"Requests may go beyond the available balance.","x-description-ar":"يجوز أن تتجاوز الطلبات الرصيد المتاح."}}},"employee_leave_policy_eligible_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"Employees who can be given the policy.","x-description-ar":"الموظفون الذين يمكن تعيين السياسة لهم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true},"residence_country":{"type":"string","description":"Country of residence, translated.","x-description-ar":"بلد الإقامة مترجماً.","nullable":true},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}},"employee_leave_policy_holder_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"Employees holding the policy, most recently assigned first.","x-description-ar":"الموظفون الذين يحملون السياسة، الأحدث تعييناً أولاً.","items":{"type":"object","properties":{"employee_id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true},"residence_country":{"type":"string","description":"Country of residence, translated.","x-description-ar":"بلد الإقامة مترجماً.","nullable":true},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"balance_used":{"type":"number","description":"Days of approved leave taken this year.","x-description-ar":"أيام الإجازات المعتمدة المأخوذة هذه السنة."},"balance_entitled":{"type":"number","description":"Days granted this year plus usable carry-over.","x-description-ar":"الأيام الممنوحة هذه السنة مع المرحَّل القابل للاستخدام."},"balance_available":{"type":"number","description":"Days still available (entitled − taken − pending).","x-description-ar":"الأيام المتاحة (المستحق − المأخوذ − المعلق)."},"pending_requests_count":{"type":"integer","description":"Requests on this policy waiting for approval this year.","x-description-ar":"طلبات هذه السياسة بانتظار الاعتماد هذه السنة."},"approved_future_requests_count":{"type":"integer","description":"Approved requests on this policy starting today or later.","x-description-ar":"طلبات هذه السياسة المعتمدة التي تبدأ اليوم أو بعده."}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}},"employee_leave_policy_statement":{"type":"object","description":"A balance statement: every movement of one policy's balance in one year, oldest first, with a running total.","x-description-ar":"كشف رصيد: كل حركة على رصيد سياسة واحدة في سنة واحدة، الأقدم أولاً، مع الرصيد الجاري.","properties":{"fiscal_year":{"type":"integer","description":"Calendar year of the statement.","x-description-ar":"السنة الميلادية للكشف."},"policy":{"type":"object","description":"The policy.","x-description-ar":"السياسة.","properties":{"id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Policy name.","x-description-ar":"اسم السياسة."}}},"unassigned_on":{"type":"string","description":"Date the policy was removed from the employee; null while they hold it.","x-description-ar":"تاريخ إزالة السياسة من الموظف؛ null ما دام يحملها.","format":"date","nullable":true},"summary":{"type":"object","description":"The year's totals; `available_days` equals the last entry's `running_total`.","x-description-ar":"مجاميع السنة؛ `available_days` يساوي `running_total` في آخر حركة.","properties":{"accrued_days":{"type":"number","description":"Days granted this year by accrual (and manual adjustments).","x-description-ar":"الأيام الممنوحة هذه السنة بالاستحقاق (والتعديلات اليدوية)."},"carryover_days":{"type":"number","description":"Days carried over from last year.","x-description-ar":"الأيام المرحَّلة من السنة الماضية."},"carryover_usable":{"type":"boolean","description":"Carried-over days may be taken. When false they are not counted in `entitled_days` but are paid out when the employee leaves.","x-description-ar":"يجوز أخذ الأيام المرحَّلة. وإن كان خطأ فلا تُحسب في `entitled_days` لكنها تُصرف مقابلاً مالياً عند ترك الموظف للشركة."},"entitled_days":{"type":"number","description":"`accrued_days` plus usable `carryover_days`.","x-description-ar":"`accrued_days` مع `carryover_days` القابلة للاستخدام."},"taken_days":{"type":"number","description":"Days of approved leave charged to this year.","x-description-ar":"أيام الإجازات المعتمدة المحسوبة على هذه السنة."},"pending_days":{"type":"number","description":"Days reserved by requests still waiting for approval.","x-description-ar":"الأيام المحجوزة لطلبات ما زالت بانتظار الاعتماد."},"available_days":{"type":"number","description":"Days still available.","x-description-ar":"الأيام المتاحة."}}},"entries":{"type":"array","description":"The movements, oldest first.","x-description-ar":"الحركات، الأقدم أولاً.","items":{"type":"object","properties":{"event_type":{"type":"string","description":"`assignment`, `carryover`, `accrual`, `hire_date_corrected`, `manual_adjustment`, `carryover_expiration` or `deduction` (a leave request).","x-description-ar":"`assignment` تعيين، `carryover` ترحيل، `accrual` استحقاق، `hire_date_corrected` تصحيح تاريخ الالتحاق، `manual_adjustment` تعديل يدوي، `carryover_expiration` انتهاء المرحَّل، `deduction` طلب إجازة."},"effective_date":{"type":"string","description":"Date of the movement.","x-description-ar":"تاريخ الحركة.","format":"date"},"amount":{"type":"number","description":"Days added (positive) or deducted (negative).","x-description-ar":"الأيام المضافة (موجب) أو المخصومة (سالب)."},"counted":{"type":"boolean","description":"False when the row does not move the total: a rejected or cancelled request, or carry-over that cannot be taken.","x-description-ar":"خطأ إن كانت الحركة لا تغيّر الرصيد: طلب مرفوض أو ملغى، أو ترحيل لا يمكن استخدامه."},"description":{"type":"string","description":"What happened, in the language of the request.","x-description-ar":"ما حدث، بلغة الطلب.","nullable":true},"actor":{"type":"string","description":"Who made a manual adjustment.","x-description-ar":"من أجرى التعديل اليدوي.","nullable":true},"leave_request_id":{"type":"integer","description":"The leave request, for `deduction` rows.","x-description-ar":"طلب الإجازة، لحركات `deduction`.","nullable":true},"status":{"type":"string","description":"The request's status, for `deduction` rows.","x-description-ar":"حالة الطلب، لحركات `deduction`.","nullable":true},"running_total":{"type":"number","description":"Balance after this row.","x-description-ar":"الرصيد بعد هذه الحركة."}}}}}},"employee_option_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","description":"Matching employees.","x-description-ar":"الموظفون المطابقون.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name in English.","x-description-ar":"الاسم الكامل بالإنجليزية."},"email":{"type":"string","description":"Personal email.","x-description-ar":"البريد الشخصي.","nullable":true}}}},"pagination":{"$ref":"#/components/schemas/pagination"}}},"employee_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/employee_row"},"description":"The employees on this page.","x-description-ar":"الموظفون في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"employee_payment":{"type":"object","description":"A payment to or from an employee.","x-description-ar":"دفعة للموظف أو منه.","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Reference, e.g. `EPY-0910`.","x-description-ar":"المرجع، مثل `EPY-0910`."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"Employee's name.","x-description-ar":"اسم الموظف.","nullable":true},"kind":{"type":"string","description":"`paid` (money to the employee) or `received` (money back from them).","x-description-ar":"`paid` مبلغ للموظف، أو `received` مبلغ مستلم منه.","enum":["paid","received"]},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date"},"amount":{"type":"string","description":"Amount.","x-description-ar":"المبلغ."},"allocated":{"type":"string","description":"Part already applied to payslips, bonuses or deductions.","x-description-ar":"الجزء المخصص للقسائم أو المكافآت أو الاستقطاعات."},"unallocated":{"type":"string","description":"Part not applied yet.","x-description-ar":"الجزء غير المخصص بعد."},"currency":{"type":"string","description":"The employee's pay currency.","x-description-ar":"عملة راتب الموظف."},"account_ref":{"type":"string","description":"Bank or cash account reference.","x-description-ar":"مرجع الحساب البنكي أو النقدي.","nullable":true},"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر.","nullable":true},"created_at":{"type":"string","description":"When it was recorded, UTC ISO 8601.","x-description-ar":"وقت التسجيل بتوقيت UTC بصيغة ISO 8601."}}},"employee_payment_detail":{"type":"object","description":"A payment with its allocations.","x-description-ar":"دفعة مع تخصيصاتها.","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Reference, e.g. `EPY-0910`.","x-description-ar":"المرجع، مثل `EPY-0910`."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"رقم الموظف."},"employee_name":{"type":"string","description":"Employee's name.","x-description-ar":"اسم الموظف.","nullable":true},"kind":{"type":"string","description":"`paid` (money to the employee) or `received` (money back from them).","x-description-ar":"`paid` مبلغ للموظف، أو `received` مبلغ مستلم منه.","enum":["paid","received"]},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date"},"amount":{"type":"string","description":"Amount.","x-description-ar":"المبلغ."},"allocated":{"type":"string","description":"Part already applied to payslips, bonuses or deductions.","x-description-ar":"الجزء المخصص للقسائم أو المكافآت أو الاستقطاعات."},"unallocated":{"type":"string","description":"Part not applied yet.","x-description-ar":"الجزء غير المخصص بعد."},"currency":{"type":"string","description":"The employee's pay currency.","x-description-ar":"عملة راتب الموظف."},"account_ref":{"type":"string","description":"Bank or cash account reference.","x-description-ar":"مرجع الحساب البنكي أو النقدي.","nullable":true},"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر.","nullable":true},"created_at":{"type":"string","description":"When it was recorded, UTC ISO 8601.","x-description-ar":"وقت التسجيل بتوقيت UTC بصيغة ISO 8601."},"allocations":{"type":"array","items":{"$ref":"#/components/schemas/allocation"},"description":"What the payment settles.","x-description-ar":"ما تسدده الدفعة."}}},"employee_personal_info":{"type":"object","required":["first_name","last_name","first_name_ar","last_name_ar","gender","date_of_birth","marital_status","nationality","residence_country","national_id_number","national_id_issued_date","national_id_expiry_date","employment_status","work_phone_number","job_title","email","department_id"],"description":"Personal, contact and job fields.","x-description-ar":"الحقول الشخصية وبيانات الاتصال والوظيفة.","properties":{"first_name":{"type":"string","description":"First name in English (letters only, up to 100).","x-description-ar":"الاسم الأول بالإنجليزية (حروف فقط، حتى ١٠٠)."},"last_name":{"type":"string","description":"Last name in English.","x-description-ar":"اسم العائلة بالإنجليزية."},"first_name_ar":{"type":"string","description":"First name in Arabic.","x-description-ar":"الاسم الأول بالعربية."},"last_name_ar":{"type":"string","description":"Last name in Arabic.","x-description-ar":"اسم العائلة بالعربية."},"email":{"type":"string","description":"Personal email; must be unused in the company. Create only — change it later with `employees.update_email`.","x-description-ar":"البريد الشخصي، ويجب ألا يكون مستخدماً في الشركة. عند الإنشاء فقط — غيّره لاحقاً عبر `employees.update_email`.","format":"email"},"gender":{"type":"string","description":"`male` or `female`.","x-description-ar":"`male` ذكر أو `female` أنثى.","enum":["male","female"]},"date_of_birth":{"type":"string","description":"Date of birth.","x-description-ar":"تاريخ الميلاد.","format":"date"},"marital_status":{"type":"string","description":"Marital status.","x-description-ar":"الحالة الاجتماعية.","enum":["single","married","divorced","widowed"]},"nationality":{"type":"string","description":"ISO country code, e.g. `SA`.","x-description-ar":"رمز الدولة ISO، مثل `SA`."},"residence_country":{"type":"string","description":"ISO country code of residence.","x-description-ar":"رمز دولة الإقامة ISO."},"national_id_number":{"type":"string","description":"National ID or Iqama number.","x-description-ar":"رقم الهوية الوطنية أو الإقامة."},"national_id_issued_date":{"type":"string","description":"ID issue date.","x-description-ar":"تاريخ إصدار الهوية.","format":"date"},"national_id_expiry_date":{"type":"string","description":"ID expiry date.","x-description-ar":"تاريخ انتهاء الهوية.","format":"date"},"work_email":{"type":"string","description":"Work email.","x-description-ar":"بريد العمل.","format":"email"},"work_phone_number":{"type":"string","description":"Work phone, international format, e.g. `+966501234567`.","x-description-ar":"هاتف العمل بالصيغة الدولية، مثل `+966501234567`."},"home_phone_number":{"type":"string","description":"Home phone.","x-description-ar":"هاتف المنزل."},"address":{"type":"string","description":"Home address.","x-description-ar":"عنوان السكن."},"emergency_contact_name":{"type":"string","description":"Emergency contact's name.","x-description-ar":"اسم جهة الطوارئ."},"emergency_contact_relationship":{"type":"string","description":"Relationship to the employee.","x-description-ar":"صلة القرابة."},"emergency_contact_home_phone_number":{"type":"string","description":"Emergency contact's home phone.","x-description-ar":"هاتف منزل جهة الطوارئ."},"emergency_contact_mobile_phone_number":{"type":"string","description":"Emergency contact's mobile.","x-description-ar":"جوال جهة الطوارئ."},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي."},"employment_status":{"type":"string","description":"Employment status key: `active`, `notice_period` (resigned, still working) or `inactive` (left).","x-description-ar":"مفتاح حالة التوظيف: `active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر.","enum":["active","notice_period","inactive"]},"department_id":{"type":"integer","description":"Department id, from `employees.meta_data` (`departments`).","x-description-ar":"رقم القسم، من `employees.meta_data` (`departments`)."},"manager_id":{"type":"integer","description":"Manager's employee id, from `employees.managers`.","x-description-ar":"رقم موظف المدير، من `employees.managers`."},"location_id":{"type":"integer","description":"Main work location id, from `employees.meta_data` (`locations`).","x-description-ar":"رقم موقع العمل، من `employees.meta_data` (`locations`)."}}},"employee_personal_info_update":{"type":"object","description":"Personal, contact and job fields to change. The email is changed with `employees.update_email`.","x-description-ar":"الحقول الشخصية وبيانات الاتصال والوظيفة المراد تعديلها. يُغيَّر البريد عبر `employees.update_email`.","properties":{"first_name":{"type":"string","description":"First name in English (letters only, up to 100).","x-description-ar":"الاسم الأول بالإنجليزية (حروف فقط، حتى ١٠٠)."},"last_name":{"type":"string","description":"Last name in English.","x-description-ar":"اسم العائلة بالإنجليزية."},"first_name_ar":{"type":"string","description":"First name in Arabic.","x-description-ar":"الاسم الأول بالعربية."},"last_name_ar":{"type":"string","description":"Last name in Arabic.","x-description-ar":"اسم العائلة بالعربية."},"gender":{"type":"string","description":"`male` or `female`.","x-description-ar":"`male` ذكر أو `female` أنثى.","enum":["male","female"]},"date_of_birth":{"type":"string","description":"Date of birth.","x-description-ar":"تاريخ الميلاد.","format":"date"},"marital_status":{"type":"string","description":"Marital status.","x-description-ar":"الحالة الاجتماعية.","enum":["single","married","divorced","widowed"]},"nationality":{"type":"string","description":"ISO country code, e.g. `SA`.","x-description-ar":"رمز الدولة ISO، مثل `SA`."},"residence_country":{"type":"string","description":"ISO country code of residence.","x-description-ar":"رمز دولة الإقامة ISO."},"national_id_number":{"type":"string","description":"National ID or Iqama number.","x-description-ar":"رقم الهوية الوطنية أو الإقامة."},"national_id_issued_date":{"type":"string","description":"ID issue date.","x-description-ar":"تاريخ إصدار الهوية.","format":"date"},"national_id_expiry_date":{"type":"string","description":"ID expiry date.","x-description-ar":"تاريخ انتهاء الهوية.","format":"date"},"work_email":{"type":"string","description":"Work email.","x-description-ar":"بريد العمل.","format":"email"},"work_phone_number":{"type":"string","description":"Work phone, international format, e.g. `+966501234567`.","x-description-ar":"هاتف العمل بالصيغة الدولية، مثل `+966501234567`."},"home_phone_number":{"type":"string","description":"Home phone.","x-description-ar":"هاتف المنزل."},"address":{"type":"string","description":"Home address.","x-description-ar":"عنوان السكن."},"emergency_contact_name":{"type":"string","description":"Emergency contact's name.","x-description-ar":"اسم جهة الطوارئ."},"emergency_contact_relationship":{"type":"string","description":"Relationship to the employee.","x-description-ar":"صلة القرابة."},"emergency_contact_home_phone_number":{"type":"string","description":"Emergency contact's home phone.","x-description-ar":"هاتف منزل جهة الطوارئ."},"emergency_contact_mobile_phone_number":{"type":"string","description":"Emergency contact's mobile.","x-description-ar":"جوال جهة الطوارئ."},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي."},"employment_status":{"type":"string","description":"Employment status key: `active`, `notice_period` (resigned, still working) or `inactive` (left).","x-description-ar":"مفتاح حالة التوظيف: `active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر.","enum":["active","notice_period","inactive"]},"department_id":{"type":"integer","description":"Department id, from `employees.meta_data` (`departments`).","x-description-ar":"رقم القسم، من `employees.meta_data` (`departments`)."},"manager_id":{"type":"integer","description":"Manager's employee id, from `employees.managers`.","x-description-ar":"رقم موظف المدير، من `employees.managers`."},"employee_no":{"type":"string","description":"Employee number. Needs \"Edit other profiles\"; refused once the employee is linked to Qoyod accounting (`employee_no_locked`).","x-description-ar":"الرقم الوظيفي. يحتاج «تعديل ملفات الآخرين»، ويُرفض بعد ربط الموظف بمحاسبة قيود (`employee_no_locked`)."},"additional_location_ids":{"type":"array","description":"Every location the employee may check in at besides the main one; replaces the current list. Location ids from `employees.meta_data` (`locations`).","x-description-ar":"كل المواقع التي يمكن للموظف تسجيل الحضور فيها غير الموقع الرئيسي، وتحل محل القائمة الحالية. أرقام المواقع من `employees.meta_data` (`locations`).","items":{"type":"integer"}},"location_id":{"type":"integer","description":"Main work location id, from `employees.meta_data` (`locations`).","x-description-ar":"رقم موقع العمل، من `employees.meta_data` (`locations`)."}}},"employee_row":{"type":"object","description":"One employee in a list.","x-description-ar":"موظف واحد في قائمة.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number, unique in the company.","x-description-ar":"الرقم الوظيفي، فريد في الشركة.","nullable":true},"employee_name":{"type":"string","description":"Full name in English.","x-description-ar":"الاسم الكامل بالإنجليزية."},"employee_email":{"type":"string","description":"Personal email.","x-description-ar":"البريد الشخصي.","nullable":true},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي.","nullable":true},"department":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true},"employment_type":{"type":"string","description":"Employment type name (full-time, part-time…).","x-description-ar":"اسم نوع التوظيف (دوام كامل، جزئي…).","nullable":true},"manager_id":{"type":"integer","description":"Id of the employee this one reports to.","x-description-ar":"رقم الموظف الذي يتبع له.","nullable":true},"status":{"type":"string","description":"Employment status, translated.","x-description-ar":"حالة التوظيف مترجمة.","nullable":true},"status_key":{"type":"string","description":"Employment status key: `active`, `notice_period` (resigned, still working) or `inactive` (left).","x-description-ar":"مفتاح حالة التوظيف: `active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر.","enum":["active","notice_period","inactive"],"nullable":true},"portal_access":{"type":"string","description":"QHR login status, translated.","x-description-ar":"حالة الدخول إلى QHR مترجمة.","nullable":true},"portal_access_key":{"type":"string","description":"QHR login status key: `not_invited`, `pending` (invited, not accepted), `activated`, `cancelled` or `expired`.","x-description-ar":"مفتاح حالة الدخول إلى QHR: `not_invited` لم يُدعَ، `pending` دُعي ولم يقبل، `activated` مفعّل، `cancelled` ملغى، `expired` انتهت الدعوة.","nullable":true},"start_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","format":"date","nullable":true},"residence_country":{"type":"string","description":"Country of residence, translated.","x-description-ar":"بلد الإقامة مترجماً.","nullable":true},"location_id":{"type":"integer","description":"Main work location id.","x-description-ar":"رقم موقع العمل الرئيسي.","nullable":true},"location":{"type":"string","description":"Main work location name.","x-description-ar":"اسم موقع العمل الرئيسي.","nullable":true},"additional_locations":{"type":"array","description":"Other locations the employee may check in at.","x-description-ar":"مواقع أخرى يمكن للموظف تسجيل الحضور فيها.","items":{"type":"string"}},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true}}},"employee_salary_input":{"type":"object","description":"The starting salary. Needs the salary permission.","x-description-ar":"الراتب عند البداية. يحتاج صلاحية الرواتب.","properties":{"basic_salary_amount":{"type":"string","description":"Basic salary, as a decimal string, e.g. `\"5000.00\"`.","x-description-ar":"الراتب الأساسي كنص عشري، مثل `\"5000.00\"`."},"basic_salary_kind":{"type":"string","description":"`fixed` (a monthly amount) or `hourly`.","x-description-ar":"`fixed` مبلغ ثابت أو `hourly` بالساعة.","enum":["fixed","hourly"]},"pay_frequency":{"type":"string","description":"`monthly`, `weekly` or `daily`.","x-description-ar":"`monthly` شهري، `weekly` أسبوعي، `daily` يومي.","enum":["monthly","weekly","daily"]},"start_date":{"type":"string","description":"Date the salary applies from.","x-description-ar":"تاريخ بدء سريان الراتب.","format":"date"}}},"employee_sheet_upload":{"type":"object","required":["file"],"properties":{"file":{"type":"string","description":"The spreadsheet, sent as the multipart field `file`, at most 5 MB and 500 rows.","x-description-ar":"ملف الجدول، يُرسل في الحقل `file` من النموذج متعدد الأجزاء، بحد أقصى ٥ ميغابايت و٥٠٠ صف.","format":"binary"}}},"error":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Message for people, in the requested language.","x-description-ar":"رسالة للقارئ بلغة الطلب."},"code":{"type":"string","description":"Stable code to branch on.","x-description-ar":"رمز ثابت تعتمد عليه في منطقك."},"errors":{"description":"Field errors, on some validation failures.","x-description-ar":"أخطاء الحقول في بعض حالات التحقق."},"reason":{"type":"string","description":"Why a feature is blocked (`entitlement_blocked` only).","x-description-ar":"سبب حجب الميزة (مع `entitlement_blocked` فقط)."}}},"folder":{"type":"object","description":"A folder on an employee's profile, with the documents in it.","x-description-ar":"مجلد في ملف الموظف، مع المستندات التي فيه.","required":["id","name_en","name_ar","hidden","attachments"],"properties":{"id":{"type":"integer","description":"Folder id.","x-description-ar":"رقم المجلد."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"hidden":{"type":"boolean","description":"Hidden folders are left out of the list unless `include_hidden=true`.","x-description-ar":"المجلدات المخفية لا تظهر في القائمة إلا مع `include_hidden=true`."},"created_at":{"type":"string","description":"When the folder was created, in UTC (`YYYY-MM-DD HH:MM:SS UTC`).","x-description-ar":"وقت إنشاء المجلد بتوقيت UTC (`YYYY-MM-DD HH:MM:SS UTC`).","example":"2027-02-10 06:15:00 UTC"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/document"},"description":"Every document in the folder, old versions included (`current_version`).","x-description-ar":"كل المستندات في المجلد، ومنها الإصدارات القديمة (`current_version`)."}}},"folder_create_input":{"type":"object","required":["folder"],"properties":{"folder":{"type":"object","required":["name_en","name_ar"],"description":"The new folder. Both names are required, and each must be unique among this employee's folders.","x-description-ar":"المجلد الجديد. الاسمان مطلوبان، ويجب أن يكون كل منهما فريداً بين مجلدات هذا الموظف.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"hidden":{"type":"boolean","description":"Create it hidden from the default list.","x-description-ar":"إنشاؤه مخفياً من القائمة الافتراضية."}}}}},"folder_input":{"type":"object","required":["folder"],"properties":{"folder":{"type":"object","description":"The fields to change; send only those. Each name must be unique among this employee's folders.","x-description-ar":"الحقول المراد تغييرها فقط. يجب أن يكون كل اسم فريداً بين مجلدات هذا الموظف.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"hidden":{"type":"boolean","description":"Hide the folder from the default list.","x-description-ar":"إخفاء المجلد من القائمة الافتراضية."}}}}},"gosi_compliance_summary":{"type":"object","description":"Wage Protection System (Mudad) compliance, month by month.","x-description-ar":"الالتزام بنظام حماية الأجور (مدد) شهراً بشهر.","properties":{"establishment_name":{"type":"string","description":"Establishment name as GOSI holds it.","x-description-ar":"اسم المنشأة كما لدى التأمينات.","nullable":true},"periods":{"type":"array","description":"One entry per month, newest as GOSI returns them.","x-description-ar":"مدخل لكل شهر بالترتيب الذي تعيده التأمينات.","items":{"type":"object","properties":{"period":{"type":"string","description":"The month, as GOSI writes it.","x-description-ar":"الشهر كما تكتبه التأمينات."},"compliant":{"type":"boolean","description":"True when the establishment complied that month.","x-description-ar":"صحيح إذا التزمت المنشأة في ذلك الشهر."}}}}}},"gosi_contributor_info":{"type":"object","description":"Where a person is registered with GOSI.","x-description-ar":"أين الشخص مسجل لدى التأمينات.","properties":{"contributor_info":{"type":"array","description":"One entry per establishment the person contributes through.","x-description-ar":"مدخل لكل منشأة يشترك الشخص عن طريقها.","items":{"type":"object","properties":{"establishment_name_ar":{"type":"string","description":"Establishment, Arabic.","x-description-ar":"المنشأة بالعربية.","nullable":true},"establishment_name_en":{"type":"string","description":"Establishment, English.","x-description-ar":"المنشأة بالإنجليزية.","nullable":true},"job_title_ar":{"type":"string","description":"Registered job title, Arabic.","x-description-ar":"المسمى المسجل بالعربية.","nullable":true},"job_title_en":{"type":"string","description":"Registered job title, English.","x-description-ar":"المسمى المسجل بالإنجليزية.","nullable":true},"full_wage":{"type":"number","description":"Registered monthly wage, SAR.","x-description-ar":"الأجر الشهري المسجل بالريال.","nullable":true}}}}}},"gosi_employment_validation":{"type":"object","description":"Whether GOSI shows the employee as active at this establishment.","x-description-ar":"هل يظهر الموظف نشطاً لدى هذه المنشأة في التأمينات.","properties":{"employee_active":{"type":"boolean","description":"True when GOSI has an active employment relationship.","x-description-ar":"صحيح إذا كانت لدى التأمينات علاقة عمل نشطة."}}},"gosi_establishment_breakdown":{"type":"object","description":"Head count and wages GOSI holds for the establishment.","x-description-ar":"عدد الموظفين والأجور المسجلة للمنشأة لدى التأمينات.","properties":{"wage":{"type":"object","description":"Registered wages.","x-description-ar":"الأجور المسجلة.","properties":{"total":{"type":"number","description":"All employees.","x-description-ar":"كل الموظفين.","nullable":true},"saudis":{"type":"number","description":"Saudi employees.","x-description-ar":"الموظفون السعوديون.","nullable":true},"non_saudis":{"type":"number","description":"Non-Saudi employees.","x-description-ar":"الموظفون غير السعوديين.","nullable":true}}},"employees":{"type":"object","description":"Registered employees.","x-description-ar":"الموظفون المسجلون.","properties":{"total":{"type":"integer","description":"All employees.","x-description-ar":"كل الموظفين.","nullable":true},"saudis":{"type":"object","description":"Saudis, by gender.","x-description-ar":"السعوديون حسب الجنس.","properties":{"total":{"type":"integer","description":"Total.","x-description-ar":"الإجمالي.","nullable":true},"male":{"type":"integer","description":"Men.","x-description-ar":"الذكور.","nullable":true},"female":{"type":"integer","description":"Women.","x-description-ar":"الإناث.","nullable":true}}},"non_saudis":{"type":"object","description":"Non-Saudis.","x-description-ar":"غير السعوديين.","properties":{"total":{"type":"integer","description":"Total.","x-description-ar":"الإجمالي.","nullable":true}}}}},"compliance_records":{"type":"array","description":"Compliance by period.","x-description-ar":"الالتزام حسب الفترة.","items":{"type":"object","properties":{"period":{"type":"string","description":"The period, as GOSI writes it.","x-description-ar":"الفترة كما تكتبها التأمينات."},"compliant":{"type":"boolean","description":"True when compliant.","x-description-ar":"صحيح عند الالتزام."},"compliance_percentage":{"type":"number","description":"Compliance percentage.","x-description-ar":"نسبة الالتزام.","nullable":true}}}}}},"gosi_iban_verification":{"type":"object","description":"Whether the IBAN on the employee's record belongs to them.","x-description-ar":"هل الآيبان المسجل للموظف يعود إليه.","properties":{"iban_valid":{"type":"boolean","description":"True when the bank confirms the IBAN belongs to the employee's ID.","x-description-ar":"صحيح إذا أكد البنك أن الآيبان يعود لهوية الموظف."},"account_status":{"type":"string","description":"Account status the bank reports.","x-description-ar":"حالة الحساب كما يذكرها البنك.","nullable":true},"bank_name_ar":{"type":"string","description":"Bank, Arabic.","x-description-ar":"البنك بالعربية.","nullable":true},"bank_name_en":{"type":"string","description":"Bank, English.","x-description-ar":"البنك بالإنجليزية.","nullable":true},"failure_code":{"type":"string","description":"The bank's reason when not valid.","x-description-ar":"سبب البنك عند عدم الصحة.","nullable":true}}},"gosi_settings":{"type":"object","description":"The company's GOSI connection.","x-description-ar":"ربط الشركة بالتأمينات الاجتماعية.","properties":{"gosi_unified_id":{"type":"string","description":"The establishment's unified number (10 digits starting 70) once approved; null otherwise.","x-description-ar":"الرقم الموحد للمنشأة (١٠ أرقام تبدأ بـ 70) بعد الموافقة؛ null غير ذلك.","nullable":true},"gosi_connected":{"type":"boolean","description":"True when the GOSI checks can run.","x-description-ar":"صحيح إذا كانت فحوصات التأمينات متاحة."},"connection_status":{"type":"string","description":"`not_connected`, `pending` (submitted, Qoyod is verifying ownership), `approved` or `rejected`.","x-description-ar":"`not_connected` غير مربوط، `pending` أُرسل وتتحقق قيود من ملكية المنشأة، `approved` مقبول، `rejected` مرفوض.","enum":["not_connected","pending","approved","rejected"]},"pending_unified_id":{"type":"string","description":"The number waiting for verification.","x-description-ar":"الرقم بانتظار التحقق.","nullable":true},"rejection_reason":{"type":"string","description":"Why the last request was rejected, while not connected.","x-description-ar":"سبب رفض آخر طلب، ما دامت الشركة غير مربوطة.","nullable":true}}},"gosi_wage_verification":{"type":"object","description":"Whether the employee's basic salary in QHR matches the wage GOSI holds.","x-description-ar":"هل يطابق الراتب الأساسي للموظف في QHR الأجر المسجل لدى التأمينات.","properties":{"wage_valid":{"type":"boolean","description":"True when the wages match.","x-description-ar":"صحيح عند التطابق."},"wage":{"type":"string","description":"The basic salary QHR checked, SAR.","x-description-ar":"الراتب الأساسي الذي فُحص في QHR بالريال."}}},"holiday":{"type":"object","description":"A public holiday with both names.","x-description-ar":"عطلة رسمية بالاسمين.","required":["id","name_en","name_ar","start_date","end_date","country"],"properties":{"id":{"type":"integer","description":"Holiday id.","x-description-ar":"رقم العطلة."},"name":{"type":"string","description":"Name in the requested language (English when the Arabic name is empty).","x-description-ar":"الاسم بلغة الطلب (بالإنجليزية إن كان الاسم العربي فارغاً)."},"start_date":{"type":"string","description":"First day of the holiday.","x-description-ar":"أول أيام العطلة.","format":"date"},"end_date":{"type":"string","description":"Last day of the holiday, inclusive.","x-description-ar":"آخر أيام العطلة، ضمناً.","format":"date"},"country":{"type":"string","description":"Country that observes it, ISO code (`SA`, `AE`…). Applies to employees whose country of residence is this one.","x-description-ar":"الدولة التي تعطّل فيها، برمز ISO (`SA`، `AE`…). تنطبق على الموظفين المقيمين في هذه الدولة."},"country_name":{"type":"string","description":"Country name in the requested language.","x-description-ar":"اسم الدولة بلغة الطلب.","nullable":true},"show_on_dashboard_for_assigned_users":{"type":"boolean","description":"Shown in the upcoming-holidays card of the employees it applies to.","x-description-ar":"تظهر في بطاقة العطل القادمة لدى الموظفين الذين تنطبق عليهم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."}}},"holiday_input":{"type":"object","description":"The holiday's fields.","x-description-ar":"حقول العطلة.","properties":{"name_en":{"type":"string","description":"Name in English, up to 100 characters.","x-description-ar":"الاسم بالإنجليزية، حتى ١٠٠ حرف.","maxLength":100},"name_ar":{"type":"string","description":"Name in Arabic, up to 100 characters.","x-description-ar":"الاسم بالعربية، حتى ١٠٠ حرف.","maxLength":100},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day, on or after `start_date`. Same as `start_date` for a one-day holiday.","x-description-ar":"آخر يوم، في `start_date` أو بعده. يساوي `start_date` لعطلة يوم واحد.","format":"date"},"country":{"type":"string","description":"ISO country code (`SA`, `AE`…). The holiday applies to employees residing in that country.","x-description-ar":"رمز الدولة ISO (`SA`، `AE`…). تنطبق العطلة على الموظفين المقيمين فيها."},"show_on_dashboard_for_assigned_users":{"type":"boolean","description":"Show it in those employees' upcoming-holidays card. Default true.","x-description-ar":"إظهارها في بطاقة العطل القادمة لدى هؤلاء الموظفين. الافتراضي true."}}},"holiday_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/holiday_row"},"description":"The holidays on this page.","x-description-ar":"العطل في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"holiday_row":{"type":"object","description":"One public holiday in a list.","x-description-ar":"عطلة رسمية واحدة في قائمة.","required":["id","name","start_date","end_date","country"],"properties":{"id":{"type":"integer","description":"Holiday id.","x-description-ar":"رقم العطلة."},"name":{"type":"string","description":"Name in the requested language (English when the Arabic name is empty).","x-description-ar":"الاسم بلغة الطلب (بالإنجليزية إن كان الاسم العربي فارغاً)."},"start_date":{"type":"string","description":"First day of the holiday.","x-description-ar":"أول أيام العطلة.","format":"date"},"end_date":{"type":"string","description":"Last day of the holiday, inclusive.","x-description-ar":"آخر أيام العطلة، ضمناً.","format":"date"},"country":{"type":"string","description":"Country that observes it, ISO code (`SA`, `AE`…). Applies to employees whose country of residence is this one.","x-description-ar":"الدولة التي تعطّل فيها، برمز ISO (`SA`، `AE`…). تنطبق على الموظفين المقيمين في هذه الدولة."},"country_name":{"type":"string","description":"Country name in the requested language.","x-description-ar":"اسم الدولة بلغة الطلب.","nullable":true},"show_on_dashboard_for_assigned_users":{"type":"boolean","description":"Shown in the upcoming-holidays card of the employees it applies to.","x-description-ar":"تظهر في بطاقة العطل القادمة لدى الموظفين الذين تنطبق عليهم."}}},"hr_employee_loan":{"type":"object","description":"One loan on the settlement screen.","x-description-ar":"سلفة واحدة في شاشة التسوية.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"amount_repaid":{"type":"string","description":"Repaid so far. Decimal string.","x-description-ar":"المسدَّد حتى الآن. نص عشري."},"outstanding":{"type":"string","description":"Still owed. Decimal string.","x-description-ar":"المتبقي. نص عشري."},"disbursement_date":{"type":"string","description":"Payout date.","x-description-ar":"تاريخ الصرف.","format":"date","nullable":true},"installments_paid":{"type":"integer","description":"Installments collected; null before approval.","x-description-ar":"الأقساط المحصّلة؛ null قبل الاعتماد.","nullable":true},"installments_remaining":{"type":"integer","description":"Installments left; null before approval.","x-description-ar":"الأقساط المتبقية؛ null قبل الاعتماد.","nullable":true},"settlement_amount":{"type":"string","description":"Amount settled, once a settlement was recorded.","x-description-ar":"مبلغ التسوية بعد تسجيلها.","nullable":true},"settlement_date":{"type":"string","description":"Settlement date.","x-description-ar":"تاريخ التسوية.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Repaid on (direct loans).","x-description-ar":"تاريخ السداد (للسلفة المباشرة).","format":"date","nullable":true},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"payments":{"type":"array","description":"Payments behind a direct loan: the payout (`paid`) and the repayment (`received`). Always empty for a payroll loan, whose money moves on the payslip.","x-description-ar":"الدفعات خلف السلفة المباشرة: الصرف (`paid`) والسداد (`received`). فارغة دائماً للسلفة عبر الرواتب لأن مالها يتحرك في القسيمة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Payment reference.","x-description-ar":"مرجع الدفعة."},"kind":{"type":"string","description":"`paid` (to the employee) or `received` (from them).","x-description-ar":"`paid` للموظف أو `received` منه."},"purpose":{"type":"string","description":"`disbursement` or `repayment`.","x-description-ar":"`disbursement` صرف أو `repayment` سداد."},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date","nullable":true},"amount":{"type":"string","description":"Amount. Decimal string.","x-description-ar":"المبلغ. نص عشري."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."}}}},"can_settle":{"type":"boolean","description":"True when the token's owner may settle it now.","x-description-ar":"صحيح إن كان لصاحب الرمز تسويةها الآن."},"settlement_block":{"type":"object","nullable":true,"description":"Why the loan cannot be settled (`code` and a localised `message`); null when it can. Codes: `not_settleable`, `already_pending_settlement`, `nothing_outstanding`, `payout_not_delivered`, `installment_in_flight`.","x-description-ar":"سبب تعذّر تسوية السلفة (`code` و`message` مترجمة)؛ null إن أمكنت. الرموز: `not_settleable`، `already_pending_settlement`، `nothing_outstanding`، `payout_not_delivered`، `installment_in_flight`.","properties":{"code":{"type":"string","description":"Reason code.","x-description-ar":"رمز السبب."},"message":{"type":"string","description":"Reason in words.","x-description-ar":"السبب نصاً."}}},"accounting":{"type":"object","nullable":true,"description":"What Qoyod accounting says about the loan (its settlement while one is in play, else its payout). Every field is null when the company is not connected.","x-description-ar":"ما تقوله محاسبة قيود عن السلفة (تسويتها إن وُجدت، وإلا صرفها). كل الحقول null إن لم تكن الشركة مرتبطة.","properties":{"gate":{"type":"string","description":"`loan` when an accountant must approve this loan, else `none`.","x-description-ar":"`loan` إن كان على محاسب اعتمادها، وإلا `none`."},"state":{"type":"string","description":"Delivery state: `queued`, `sending`, `pending_approval`, `posted`, `declined`, `failed`…","x-description-ar":"حالة الإرسال: `queued`، `sending`، `pending_approval`، `posted`، `declined`، `failed`…","nullable":true},"event_id":{"type":"string","description":"Accounting event id.","x-description-ar":"رقم حدث المحاسبة.","nullable":true},"reason_code":{"type":"string","description":"Why it was declined or held.","x-description-ar":"سبب الرفض أو التعليق.","nullable":true},"reason":{"type":"string","description":"The reason in words.","x-description-ar":"السبب نصاً.","nullable":true},"decided_at":{"type":"string","description":"When the accountant decided.","x-description-ar":"وقت قرار المحاسب.","nullable":true},"decided_by":{"type":"string","description":"The accountant (email Qoyod sent).","x-description-ar":"المحاسب (البريد الذي أرسلته قيود).","nullable":true},"resubmit_allowed":{"type":"boolean","description":"Whether a declined loan may be approved again.","x-description-ar":"هل يمكن اعتماد السلفة المرفوضة مجدداً.","nullable":true},"journal_entry":{"type":"string","description":"Qoyod journal entry number once posted.","x-description-ar":"رقم القيد في قيود بعد الترحيل.","nullable":true}}},"installments":{"type":"array","items":{"$ref":"#/components/schemas/loan_installment"},"description":"The schedule.","x-description-ar":"جدول السداد."}}},"hr_leave_employee_row":{"type":"object","description":"One employee with their leave picture today.","x-description-ar":"موظف واحد مع وضع إجازاته اليوم.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي.","nullable":true},"department":{"type":"object","nullable":true,"description":"Department.","x-description-ar":"القسم.","properties":{"id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم."}}},"manager":{"type":"object","nullable":true,"description":"Direct manager.","x-description-ar":"المدير المباشر.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"employment_status":{"type":"string","description":"`active`, `notice_period` or `inactive`.","x-description-ar":"`active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر."},"last_working_day":{"type":"string","description":"Last working day of a started offboarding; null otherwise.","x-description-ar":"آخر يوم عمل في إنهاء خدمة بدأ؛ وإلا null.","format":"date","nullable":true},"on_leave":{"type":"object","nullable":true,"description":"The approved leave they are on today; null when at work.","x-description-ar":"الإجازة المعتمدة التي هو فيها اليوم؛ وnull إن كان في العمل.","properties":{"leave_type":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة.","nullable":true},"until":{"type":"string","description":"Last day of that leave.","x-description-ar":"آخر يوم في تلك الإجازة.","format":"date"}}},"pending":{"type":"object","description":"Requests waiting on a decision.","x-description-ar":"الطلبات التي تنتظر القرار.","properties":{"count":{"type":"integer","description":"How many.","x-description-ar":"عددها."},"days":{"type":"string","description":"Their days together, one decimal, as a string.","x-description-ar":"مجموع أيامها بمنزلة عشرية واحدة كنص."}}},"primary_balance":{"type":"object","nullable":true,"description":"The headline policy: the one asked for with `leave_policy_id`, else annual leave, else the first by name. Null when the employee holds none.","x-description-ar":"السياسة الرئيسية: المطلوبة بـ `leave_policy_id`، وإلا الإجازة السنوية، وإلا الأولى بالاسم. وnull إن لم تكن لديه أي سياسة.","properties":{"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"unit":{"type":"string","description":"Unit the policy counts in, e.g. `days`.","x-description-ar":"الوحدة التي تُحسب بها السياسة، مثل `days`."},"unmetered":{"type":"boolean","description":"True for a `per_event` policy: no balance, each request justified on its own.","x-description-ar":"صحيح لسياسة `per_event`: بلا رصيد، ويُبرَّر كل طلب على حدة."},"available":{"type":"string","description":"Days still available this year. Days with one decimal, as a string (`\"12.5\"`); null on a `per_event` policy, which has no balance.","x-description-ar":"الأيام المتاحة هذا العام. أيام بمنزلة عشرية واحدة كنص (`\"12.5\"`)؛ وnull لسياسة `per_event` التي لا رصيد لها.","nullable":true},"entitled":{"type":"string","description":"Days entitled this year. Days with one decimal, as a string (`\"12.5\"`); null on a `per_event` policy, which has no balance.","x-description-ar":"الأيام المستحقة هذا العام. أيام بمنزلة عشرية واحدة كنص (`\"12.5\"`)؛ وnull لسياسة `per_event` التي لا رصيد لها.","nullable":true},"taken":{"type":"string","description":"Days in approved requests. Days with one decimal, as a string (`\"12.5\"`); null on a `per_event` policy, which has no balance.","x-description-ar":"الأيام في الطلبات المعتمدة. أيام بمنزلة عشرية واحدة كنص (`\"12.5\"`)؛ وnull لسياسة `per_event` التي لا رصيد لها.","nullable":true},"pending_days":{"type":"string","description":"Days held by pending requests. Days with one decimal, as a string (`\"12.5\"`); null on a `per_event` policy, which has no balance.","x-description-ar":"الأيام المحجوزة لطلبات معلّقة. أيام بمنزلة عشرية واحدة كنص (`\"12.5\"`)؛ وnull لسياسة `per_event` التي لا رصيد لها.","nullable":true}}},"other_balances":{"type":"array","description":"The employee's other active policies.","x-description-ar":"سياسات الموظف الفعّالة الأخرى.","items":{"type":"object","properties":{"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"unit":{"type":"string","description":"Unit the policy counts in, e.g. `days`.","x-description-ar":"الوحدة التي تُحسب بها السياسة، مثل `days`."},"unmetered":{"type":"boolean","description":"True for a `per_event` policy: no balance, each request justified on its own.","x-description-ar":"صحيح لسياسة `per_event`: بلا رصيد، ويُبرَّر كل طلب على حدة."},"available":{"type":"string","description":"Days still available this year. Days with one decimal, as a string (`\"12.5\"`); null on a `per_event` policy, which has no balance.","x-description-ar":"الأيام المتاحة هذا العام. أيام بمنزلة عشرية واحدة كنص (`\"12.5\"`)؛ وnull لسياسة `per_event` التي لا رصيد لها.","nullable":true}}}}}},"hr_leave_request_row":{"type":"object","description":"One leave request in the company-wide list.","x-description-ar":"طلب إجازة واحد في قائمة الشركة.","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"employee_id":{"type":"integer","description":"The employee who is taking the leave.","x-description-ar":"الموظف صاحب الإجازة."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days it takes from the balance, as a decimal string (`\"3.0\"`).","x-description-ar":"أيام العمل التي يخصمها من الرصيد، كنص عشري (`\"3.0\"`)."},"status":{"type":"string","description":"`pending`, `approved`, `rejected`, `cancelled` or `revoked`.","x-description-ar":"`pending` معلّق، `approved` معتمد، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحب اعتماده.","enum":["pending","approved","rejected","cancelled","revoked"]},"created_at":{"type":"string","description":"When it was submitted, in UTC (`2026-11-20 08:15:00 UTC`).","x-description-ar":"وقت تقديمه بتوقيت UTC."},"days_pending":{"type":"integer","description":"Days since it was submitted.","x-description-ar":"الأيام منذ تقديمه."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف."},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"leave_type_name":{"type":"string","description":"Leave category name (Annual Leave, Sick Leave…).","x-description-ar":"اسم فئة الإجازة (سنوية، مرضية…).","nullable":true},"compensation_type":{"type":"string","description":"`fully_paid`, `unpaid` or `tiered_pay` (paid at a percentage per band of days).","x-description-ar":"`fully_paid` مدفوعة بالكامل، `unpaid` غير مدفوعة، `tiered_pay` مدفوعة بنسب حسب شرائح الأيام."},"compensation_type_label":{"type":"string","description":"`compensation_type`, translated.","x-description-ar":"`compensation_type` مترجماً."},"current_stage":{"type":"string","description":"Where it waits: `awaiting_manager`, `awaiting_hr`, `cancellation_review` or `terminal` (decided).","x-description-ar":"أين ينتظر: `awaiting_manager` لدى المدير، `awaiting_hr` لدى الموارد البشرية، `cancellation_review` طلب إلغاء قيد المراجعة، `terminal` حُسم."},"overdue":{"type":"boolean","description":"True when it is still pending and its first day has passed.","x-description-ar":"صحيح إن كان ما زال معلّقاً وقد مضى أول أيامه."},"can_act":{"type":"boolean","description":"True when the token's owner can approve or reject it now. Always false when the owner has no employee record.","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع اعتماده أو رفضه الآن. ودائماً false إن لم يكن لصاحب الرمز سجل وظيفي.","nullable":true},"revoke_type":{"type":"string","description":"`withdrawn` or `revoked` when an approval was taken back; null otherwise.","x-description-ar":"`withdrawn` أو `revoked` إن سُحب الاعتماد؛ وإلا null.","nullable":true},"revocation":{"type":"object","nullable":true,"description":"Who took the approval back (`by`: `id`, `full_name`), when (`at`, UTC) and why (`note`).","x-description-ar":"من سحب الاعتماد (`by`: `id` و`full_name`) ومتى (`at` بتوقيت UTC) ولماذا (`note`)."},"approver_actions":{"type":"object","description":"What the token's owner may do as an approver: `can_withdraw`, `can_revoke`, and `revoke_blocked_reason` (`payroll_locked`, `cancellation_pending` or null).","x-description-ar":"ما يستطيعه صاحب الرمز بصفته معتمِداً: `can_withdraw` و`can_revoke` و`revoke_blocked_reason` (`payroll_locked` أو `cancellation_pending` أو null)."}}},"hr_loan_detail":{"type":"object","description":"Everything HR needs to decide a loan.","x-description-ar":"كل ما تحتاجه الموارد البشرية لتقرر في السلفة.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"needed_on":{"type":"string","description":"Date the employee needs the money.","x-description-ar":"التاريخ الذي يحتاج فيه الموظف المال.","format":"date","nullable":true},"submitted_at":{"type":"string","description":"When it was requested, ISO 8601 UTC.","x-description-ar":"وقت الطلب، ISO 8601 بتوقيت UTC."},"description":{"type":"string","description":"Why the employee needs it.","x-description-ar":"سبب حاجة الموظف إليها."},"disbursement_date":{"type":"string","description":"Payout date.","x-description-ar":"تاريخ الصرف.","format":"date","nullable":true},"installments_start_on":{"type":"string","description":"First installment month.","x-description-ar":"شهر أول قسط.","format":"date","nullable":true},"installments_end_on":{"type":"string","description":"Last installment month.","x-description-ar":"شهر آخر قسط.","format":"date","nullable":true},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"payments":{"type":"array","description":"Payments behind a direct loan: the payout (`paid`) and the repayment (`received`). Always empty for a payroll loan, whose money moves on the payslip.","x-description-ar":"الدفعات خلف السلفة المباشرة: الصرف (`paid`) والسداد (`received`). فارغة دائماً للسلفة عبر الرواتب لأن مالها يتحرك في القسيمة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Payment reference.","x-description-ar":"مرجع الدفعة."},"kind":{"type":"string","description":"`paid` (to the employee) or `received` (from them).","x-description-ar":"`paid` للموظف أو `received` منه."},"purpose":{"type":"string","description":"`disbursement` or `repayment`.","x-description-ar":"`disbursement` صرف أو `repayment` سداد."},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date","nullable":true},"amount":{"type":"string","description":"Amount. Decimal string.","x-description-ar":"المبلغ. نص عشري."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."}}}},"decision":{"type":"object","nullable":true,"description":"HR's decision; null while pending.","x-description-ar":"قرار الموارد البشرية؛ null أثناء الانتظار.","properties":{"by":{"type":"integer","description":"Employee id of who decided.","x-description-ar":"رقم موظف صاحب القرار.","nullable":true},"name":{"type":"string","description":"Their name.","x-description-ar":"اسمه.","nullable":true},"at":{"type":"string","description":"When, ISO 8601 UTC.","x-description-ar":"متى، ISO 8601 بتوقيت UTC.","nullable":true},"note":{"type":"string","description":"Note to the employee.","x-description-ar":"ملاحظة للموظف.","nullable":true}}},"installments":{"type":"array","items":{"$ref":"#/components/schemas/loan_installment"},"description":"The repayment schedule (payroll loans).","x-description-ar":"جدول السداد (للسلفة عبر الرواتب)."},"accounting_mode":{"type":"string","description":"`approval` when the company is connected to Qoyod and an accountant approves loans, else `legacy` (HR's decision is final).","x-description-ar":"`approval` إن كانت الشركة مرتبطة بقيود ويعتمد محاسب السلف، وإلا `legacy` (قرار الموارد البشرية نهائي)."},"accounting":{"type":"object","nullable":true,"description":"What Qoyod accounting says about the loan (its settlement while one is in play, else its payout). Every field is null when the company is not connected.","x-description-ar":"ما تقوله محاسبة قيود عن السلفة (تسويتها إن وُجدت، وإلا صرفها). كل الحقول null إن لم تكن الشركة مرتبطة.","properties":{"gate":{"type":"string","description":"`loan` when an accountant must approve this loan, else `none`.","x-description-ar":"`loan` إن كان على محاسب اعتمادها، وإلا `none`."},"state":{"type":"string","description":"Delivery state: `queued`, `sending`, `pending_approval`, `posted`, `declined`, `failed`…","x-description-ar":"حالة الإرسال: `queued`، `sending`، `pending_approval`، `posted`، `declined`، `failed`…","nullable":true},"event_id":{"type":"string","description":"Accounting event id.","x-description-ar":"رقم حدث المحاسبة.","nullable":true},"reason_code":{"type":"string","description":"Why it was declined or held.","x-description-ar":"سبب الرفض أو التعليق.","nullable":true},"reason":{"type":"string","description":"The reason in words.","x-description-ar":"السبب نصاً.","nullable":true},"decided_at":{"type":"string","description":"When the accountant decided.","x-description-ar":"وقت قرار المحاسب.","nullable":true},"decided_by":{"type":"string","description":"The accountant (email Qoyod sent).","x-description-ar":"المحاسب (البريد الذي أرسلته قيود).","nullable":true},"resubmit_allowed":{"type":"boolean","description":"Whether a declined loan may be approved again.","x-description-ar":"هل يمكن اعتماد السلفة المرفوضة مجدداً.","nullable":true},"journal_entry":{"type":"string","description":"Qoyod journal entry number once posted.","x-description-ar":"رقم القيد في قيود بعد الترحيل.","nullable":true}}},"existing_commitments":{"type":"array","description":"Installments the employee already owes, per month, for the next 2 years.","x-description-ar":"الأقساط المستحقة على الموظف أصلاً، لكل شهر، للسنتين القادمتين.","items":{"type":"object","properties":{"month":{"type":"string","description":"`YYYY-MM`.","x-description-ar":"`YYYY-MM`."},"amount":{"type":"string","description":"Total due. Decimal string.","x-description-ar":"المستحق. نص عشري."}}}},"can_approve":{"type":"boolean","description":"True when the token's owner may approve it now.","x-description-ar":"صحيح إن كان لصاحب الرمز اعتمادها الآن."},"can_reject":{"type":"boolean","description":"True when the token's owner may reject it now.","x-description-ar":"صحيح إن كان لصاحب الرمز رفضها الآن."},"can_settle":{"type":"boolean","description":"True when the token's owner may settle it now.","x-description-ar":"صحيح إن كان لصاحب الرمز تسويةها الآن."},"employee":{"type":"object","description":"The borrower.","x-description-ar":"المستفيد.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Name.","x-description-ar":"الاسم."},"email":{"type":"string","description":"Work email.","x-description-ar":"بريد العمل.","nullable":true},"job_title":{"type":"string","description":"Job title.","x-description-ar":"المسمى الوظيفي.","nullable":true},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"join_date":{"type":"string","description":"Joining date.","x-description-ar":"تاريخ الالتحاق.","format":"date","nullable":true}}},"submitted_by":{"type":"object","nullable":true,"description":"Who asked on the employee's behalf.","x-description-ar":"من طلبها نيابةً عن الموظف.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"salary":{"type":"object","nullable":true,"description":"The active salary and monthly gross and net, to judge affordability; null without an active salary.","x-description-ar":"الراتب النشط والإجمالي والصافي الشهري للحكم على القدرة على السداد؛ null بلا راتب نشط.","properties":{"id":{"type":"integer","description":"Salary id.","x-description-ar":"رقم الراتب."},"status":{"type":"string","description":"Salary status.","x-description-ar":"حالة الراتب."},"pay_frequency":{"type":"string","description":"Pay frequency.","x-description-ar":"دورية الصرف."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"basic_salary_amount":{"type":"string","description":"Basic salary. Decimal string.","x-description-ar":"الراتب الأساسي. نص عشري."},"benefits":{"type":"array","items":{"type":"object"},"description":"Allowances.","x-description-ar":"البدلات."},"salary_deductions":{"type":"array","items":{"type":"object"},"description":"Fixed deductions.","x-description-ar":"الاستقطاعات الثابتة."},"monthly_gross":{"type":"string","description":"Monthly gross pay. Decimal string.","x-description-ar":"إجمالي الراتب الشهري. نص عشري."},"monthly_net":{"type":"string","description":"Monthly net pay; no month's installments may exceed it. Decimal string.","x-description-ar":"صافي الراتب الشهري؛ لا يجوز أن تتجاوزه أقساط أي شهر. نص عشري."}}},"other_loans":{"type":"array","items":{"type":"object"},"description":"The employee's other loans: reference, status, amounts, schedule and what is outstanding.","x-description-ar":"سلف الموظف الأخرى: المرجع والحالة والمبالغ والجدول والمتبقي."}}},"hr_loan_row":{"type":"object","description":"A loan in HR's queue.","x-description-ar":"سلفة في قائمة الموارد البشرية.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"needed_on":{"type":"string","description":"Date the employee needs the money.","x-description-ar":"التاريخ الذي يحتاج فيه الموظف المال.","format":"date","nullable":true},"submitted_at":{"type":"string","description":"When it was requested, ISO 8601 UTC.","x-description-ar":"وقت الطلب، ISO 8601 بتوقيت UTC."},"employee_id":{"type":"integer","description":"Borrower's employee id.","x-description-ar":"رقم موظف المستفيد."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Borrower's name.","x-description-ar":"اسم المستفيد."},"submitted_by":{"type":"object","nullable":true,"description":"Manager or HR officer who asked on the employee's behalf; null when the employee asked.","x-description-ar":"المدير أو موظف الموارد البشرية الذي طلبها نيابةً عن الموظف؛ null إن طلبها الموظف.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"can_approve":{"type":"boolean","description":"True when the token's owner may approve it now.","x-description-ar":"صحيح إن كان لصاحب الرمز اعتمادها الآن."},"can_reject":{"type":"boolean","description":"True when the token's owner may reject it now.","x-description-ar":"صحيح إن كان لصاحب الرمز رفضها الآن."},"can_settle":{"type":"boolean","description":"True when the token's owner may settle it now.","x-description-ar":"صحيح إن كان لصاحب الرمز تسويةها الآن."}}},"hr_loan_settlement":{"type":"object","description":"A loan after a settlement.","x-description-ar":"سلفة بعد التسوية.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"settlement_amount":{"type":"string","description":"Amount settled: what was still outstanding.","x-description-ar":"مبلغ التسوية: ما كان متبقياً.","nullable":true},"settlement_date":{"type":"string","description":"Date the money was repaid.","x-description-ar":"تاريخ سداد المبلغ.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Repaid on.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"installments_voided":{"type":"integer","description":"Future installments cancelled (0 until the accountant approves).","x-description-ar":"الأقساط المستقبلية الملغاة (0 حتى يعتمد المحاسب)."},"payments":{"type":"array","description":"Payments behind a direct loan: the payout (`paid`) and the repayment (`received`). Always empty for a payroll loan, whose money moves on the payslip.","x-description-ar":"الدفعات خلف السلفة المباشرة: الصرف (`paid`) والسداد (`received`). فارغة دائماً للسلفة عبر الرواتب لأن مالها يتحرك في القسيمة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Payment reference.","x-description-ar":"مرجع الدفعة."},"kind":{"type":"string","description":"`paid` (to the employee) or `received` (from them).","x-description-ar":"`paid` للموظف أو `received` منه."},"purpose":{"type":"string","description":"`disbursement` or `repayment`.","x-description-ar":"`disbursement` صرف أو `repayment` سداد."},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date","nullable":true},"amount":{"type":"string","description":"Amount. Decimal string.","x-description-ar":"المبلغ. نص عشري."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."}}}},"accounting":{"type":"object","nullable":true,"description":"What Qoyod accounting says about the loan (its settlement while one is in play, else its payout). Every field is null when the company is not connected.","x-description-ar":"ما تقوله محاسبة قيود عن السلفة (تسويتها إن وُجدت، وإلا صرفها). كل الحقول null إن لم تكن الشركة مرتبطة.","properties":{"gate":{"type":"string","description":"`loan` when an accountant must approve this loan, else `none`.","x-description-ar":"`loan` إن كان على محاسب اعتمادها، وإلا `none`."},"state":{"type":"string","description":"Delivery state: `queued`, `sending`, `pending_approval`, `posted`, `declined`, `failed`…","x-description-ar":"حالة الإرسال: `queued`، `sending`، `pending_approval`، `posted`، `declined`، `failed`…","nullable":true},"event_id":{"type":"string","description":"Accounting event id.","x-description-ar":"رقم حدث المحاسبة.","nullable":true},"reason_code":{"type":"string","description":"Why it was declined or held.","x-description-ar":"سبب الرفض أو التعليق.","nullable":true},"reason":{"type":"string","description":"The reason in words.","x-description-ar":"السبب نصاً.","nullable":true},"decided_at":{"type":"string","description":"When the accountant decided.","x-description-ar":"وقت قرار المحاسب.","nullable":true},"decided_by":{"type":"string","description":"The accountant (email Qoyod sent).","x-description-ar":"المحاسب (البريد الذي أرسلته قيود).","nullable":true},"resubmit_allowed":{"type":"boolean","description":"Whether a declined loan may be approved again.","x-description-ar":"هل يمكن اعتماد السلفة المرفوضة مجدداً.","nullable":true},"journal_entry":{"type":"string","description":"Qoyod journal entry number once posted.","x-description-ar":"رقم القيد في قيود بعد الترحيل.","nullable":true}}}}},"hr_ticket_stat_cards":{"type":"object","description":"Request counts over the whole company. Filters never apply.","x-description-ar":"أعداد الطلبات على مستوى الشركة كلها. لا تتأثر بأي تصفية.","properties":{"open":{"type":"integer","description":"Approved and not finished (not closed, rejected or cancelled).","x-description-ar":"معتمدة ولم تنتهِ (غير مغلقة ولا مرفوضة ولا ملغاة)."},"unassigned":{"type":"integer","description":"Open, nobody on them yet.","x-description-ar":"مفتوحة ولم يستلمها أحد بعد."},"overdue":{"type":"integer","description":"Open, assigned or in progress past their due date.","x-description-ar":"مفتوحة أو مسندة أو قيد التنفيذ وتجاوزت تاريخ استحقاقها."},"resolved_this_week":{"type":"integer","description":"Sent for review or closed since the start of this week.","x-description-ar":"أُرسلت للمراجعة أو أُغلقت منذ بداية هذا الأسبوع."},"pending_hr_approval":{"type":"integer","description":"Waiting for HR's approval.","x-description-ar":"بانتظار اعتماد الموارد البشرية."}}},"insurance":{"type":"object","description":"An insurance plan.","x-description-ar":"خطة تأمين.","properties":{"id":{"type":"integer","description":"Plan id.","x-description-ar":"رقم الخطة."},"reference":{"type":"string","description":"Plan reference, e.g. `INS-0001`.","x-description-ar":"مرجع الخطة، مثل `INS-0001`.","nullable":true},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية.","nullable":true},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية.","nullable":true},"employee_share":{"type":"string","description":"Percentage deducted from the employee's pay. Decimal string.","x-description-ar":"النسبة المستقطعة من راتب الموظف. نص عشري."},"company_share":{"type":"string","description":"Percentage the company pays on top. Decimal string.","x-description-ar":"النسبة التي تدفعها الشركة فوقه. نص عشري."},"company_liability_account_ref":{"type":"string","description":"Accounting reference for what the company owes the insurer.","x-description-ar":"المرجع المحاسبي لما تدين به الشركة لجهة التأمين.","nullable":true},"company_expense_account_ref":{"type":"string","description":"Accounting reference for the company's insurance expense.","x-description-ar":"المرجع المحاسبي لمصروف التأمين على الشركة.","nullable":true}}},"insurance_enrolment":{"type":"object","description":"An insurance (e.g. GOSI) the employee is enrolled in on this salary.","x-description-ar":"تأمين (مثل التأمينات الاجتماعية) مشترك فيه الموظف على هذا الراتب.","properties":{"id":{"type":"integer","description":"Enrolment id.","x-description-ar":"رقم الاشتراك."},"salary_id":{"type":"integer","description":"The salary.","x-description-ar":"رقم الراتب."},"insurance_id":{"type":"integer","description":"The insurance plan, from `insurances.list`.","x-description-ar":"خطة التأمين، من `insurances.list`."},"calculation_base":{"type":"string","description":"What the insurance percentage applies to: `basic` or `basic_and_housing`.","x-description-ar":"ما تُطبَّق عليه نسبة التأمين: `basic` الأساسي، أو `basic_and_housing` الأساسي والسكن.","enum":["basic","basic_and_housing"]},"reference":{"type":"string","description":"Member or policy number HR recorded.","x-description-ar":"رقم العضوية أو الوثيقة الذي سجلته الموارد البشرية.","nullable":true}}},"insurance_input":{"type":"object","description":"Plan fields.","x-description-ar":"حقول الخطة.","properties":{"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"employee_share":{"type":"string","description":"Employee's percentage, zero or more.","x-description-ar":"نسبة الموظف، صفر أو أكثر."},"company_share":{"type":"string","description":"Company's percentage, zero or more.","x-description-ar":"نسبة الشركة، صفر أو أكثر."},"company_liability_account_ref":{"type":"string","description":"Accounting reference for the liability.","x-description-ar":"المرجع المحاسبي للالتزام."},"company_expense_account_ref":{"type":"string","description":"Accounting reference for the expense.","x-description-ar":"المرجع المحاسبي للمصروف."}}},"leave_category":{"type":"object","description":"A leave category.","x-description-ar":"فئة إجازة.","required":["id","name","is_default","carryover_eligible"],"properties":{"id":{"type":"integer","description":"Leave category id.","x-description-ar":"رقم فئة الإجازة."},"name":{"type":"string","description":"Name in the language of the request (Arabic or English).","x-description-ar":"الاسم بلغة الطلب (العربية أو الإنجليزية)."},"is_default":{"type":"boolean","description":"True for the six categories every company starts with. They can be renamed but never deleted.","x-description-ar":"صحيح للفئات الست التي تبدأ بها كل شركة. يمكن تغيير اسمها لكن لا يمكن حذفها."},"carryover_eligible":{"type":"boolean","description":"True when unused days of this category's yearly policies are carried into the next year on 1 January.","x-description-ar":"صحيح عندما تُرحَّل الأيام غير المستخدمة من سياسات هذه الفئة السنوية إلى السنة التالية في ١ يناير."}}},"leave_category_input":{"type":"object","required":["leave_category"],"properties":{"leave_category":{"type":"object","description":"The category's fields.","x-description-ar":"حقول الفئة.","properties":{"name_en":{"type":"string","description":"Name in English; unique in the company, case ignored.","x-description-ar":"الاسم بالإنجليزية؛ فريد في الشركة دون اعتبار لحالة الأحرف."},"name_ar":{"type":"string","description":"Name in Arabic; unique in the company.","x-description-ar":"الاسم بالعربية؛ فريد في الشركة."},"carryover_eligible":{"type":"boolean","description":"Allow unused days to be carried into the next year. Off when omitted on create.","x-description-ar":"السماح بترحيل الأيام غير المستخدمة إلى السنة التالية. معطّل إن لم يُرسل عند الإنشاء."}}}}},"leave_category_list":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"Every category, the default ones first, then by creation.","x-description-ar":"كل الفئات، الافتراضية أولاً ثم حسب تاريخ الإنشاء.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave category id.","x-description-ar":"رقم فئة الإجازة."},"name":{"type":"string","description":"Name in the language of the request (Arabic or English).","x-description-ar":"الاسم بلغة الطلب (العربية أو الإنجليزية)."},"is_default":{"type":"boolean","description":"True for the six categories every company starts with. They can be renamed but never deleted.","x-description-ar":"صحيح للفئات الست التي تبدأ بها كل شركة. يمكن تغيير اسمها لكن لا يمكن حذفها."},"carryover_eligible":{"type":"boolean","description":"True when unused days of this category's yearly policies are carried into the next year on 1 January.","x-description-ar":"صحيح عندما تُرحَّل الأيام غير المستخدمة من سياسات هذه الفئة السنوية إلى السنة التالية في ١ يناير."},"policies_count":{"type":"integer","description":"Number of leave policies in this category.","x-description-ar":"عدد سياسات الإجازة في هذه الفئة."}}}}}},"leave_policy":{"type":"object","description":"A leave policy with all its rules. Enum fields are translated labels.","x-description-ar":"سياسة إجازة بكل قواعدها. حقول القيم المحددة تأتي تسميات مترجمة.","required":["id","name","leave_category_id","duration","active"],"properties":{"id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Name in the language of the request.","x-description-ar":"الاسم بلغة الطلب."},"leave_category_id":{"type":"integer","description":"Category the policy belongs to (`leave_categories.list`).","x-description-ar":"الفئة التي تنتمي إليها السياسة (`leave_categories.list`)."},"duration":{"type":"string","description":"Entitlement in days a year (or in total for a one-time policy), as a decimal string, e.g. `\"21.0\"`.","x-description-ar":"الاستحقاق بالأيام في السنة (أو إجمالاً لسياسة المرة الواحدة)، نصاً عشرياً مثل `\"21.0\"`."},"active":{"type":"boolean","description":"False when the policy is switched off: no new requests, no accrual.","x-description-ar":"خطأ إن كانت السياسة معطّلة: لا طلبات جديدة ولا استحقاق."},"employees_count":{"type":"integer","description":"Employees currently holding the policy.","x-description-ar":"عدد الموظفين الذين يحملون السياسة حالياً."},"compensation_type":{"type":"string","description":"How the leave is paid: Fully Paid, Tiered Pay or Unpaid (translated).","x-description-ar":"كيف تُدفع الإجازة: مدفوعة بالكامل، أو أجر متدرج، أو غير مدفوعة (مترجمة)."},"approver":{"type":"string","description":"Who approves requests: Manager, HR, or Manager \u0026 HR (translated).","x-description-ar":"من يعتمد الطلبات: المدير، أو الموارد البشرية، أو المدير ثم الموارد البشرية (مترجمة)."},"accrued_per":{"type":"string","description":"How often the entitlement is granted: Per Year, Per Event or One Time Only (translated).","x-description-ar":"تكرار منح الاستحقاق: سنوياً، أو لكل حالة، أو مرة واحدة (مترجمة)."},"accrual_method":{"type":"string","description":"How the days are granted: Full Balance (all at once) or Monthly (translated).","x-description-ar":"طريقة منح الأيام: الرصيد كاملاً (دفعة واحدة) أو شهرياً (مترجمة)."},"allow_past_dates":{"type":"boolean","description":"Employees may request leave for dates already past.","x-description-ar":"يجوز للموظف طلب إجازة لتواريخ مضت."},"allow_negative_balance":{"type":"boolean","description":"Requests may exceed the available balance. Always true for per-event policies.","x-description-ar":"يجوز أن تتجاوز الطلبات الرصيد المتاح. صحيح دائماً لسياسات «لكل حالة»."},"requires_document":{"type":"boolean","description":"A supporting document must be attached to each request.","x-description-ar":"يجب إرفاق مستند داعم بكل طلب."},"show_used_balance":{"type":"boolean","description":"Employees see the days they have used.","x-description-ar":"يرى الموظف الأيام التي استخدمها."},"carryover_usable":{"type":"boolean","description":"Carried-over days may be taken. When false they are only paid out when the employee leaves the company.","x-description-ar":"يجوز استخدام الأيام المرحَّلة. وإن كان خطأ فلا تُصرف إلا مقابلاً مالياً عند ترك الموظف للشركة."},"carryover_max_days":{"type":"number","description":"Most days carried into the next year; null for no cap, 0 to carry nothing.","x-description-ar":"أقصى عدد أيام يُرحَّل إلى السنة التالية؛ null بلا حد، و0 لعدم ترحيل شيء.","nullable":true},"carryover_expires_end_of_month":{"type":"integer","description":"Month (1–11) at whose end unused carried-over days expire; null when they never expire.","x-description-ar":"الشهر (١–١١) الذي تنتهي بنهايته صلاحية الأيام المرحَّلة غير المستخدمة؛ null إن كانت لا تنتهي.","nullable":true},"tiers":{"type":"array","description":"Pay ladder of a `tiered_pay` policy, in order: the first `days` days of the leave are paid at `percentage`, the next tier's days at its percentage, and any day beyond the last tier is unpaid. Empty for every other compensation type.","x-description-ar":"سلّم الأجر لسياسة `tiered_pay` بالترتيب: تُدفع أول `days` يوماً من الإجازة بنسبة `percentage`، ثم أيام الشريحة التالية بنسبتها، وأي يوم بعد آخر شريحة بلا أجر. فارغ لكل أنواع الأجر الأخرى.","items":{"type":"object","properties":{"days":{"type":"integer","description":"Days in this tier (at least 1).","x-description-ar":"عدد أيام هذه الشريحة (١ على الأقل)."},"percentage":{"type":"integer","description":"Percentage of pay for these days, 0 to 100.","x-description-ar":"نسبة الأجر لهذه الأيام، من ٠ إلى ١٠٠."}}}}}},"leave_policy_input":{"type":"object","required":["leave_policy"],"properties":{"leave_policy":{"type":"object","description":"The policy's fields. Keys for the enum fields come from `leave_policies.meta_data`.","x-description-ar":"حقول السياسة. مفاتيح الحقول ذات القيم المحددة من `leave_policies.meta_data`.","properties":{"name_en":{"type":"string","description":"Name in English; unique within the category.","x-description-ar":"الاسم بالإنجليزية؛ فريد داخل الفئة."},"name_ar":{"type":"string","description":"Name in Arabic; unique within the category.","x-description-ar":"الاسم بالعربية؛ فريد داخل الفئة."},"leave_category_id":{"type":"integer","description":"Category, from `leave_categories.list`.","x-description-ar":"الفئة، من `leave_categories.list`."},"duration":{"type":"number","description":"Entitlement in days, more than 0. For `tiered_pay`, at least the sum of the tiers' days.","x-description-ar":"الاستحقاق بالأيام، أكبر من ٠. ولسياسة `tiered_pay` لا يقل عن مجموع أيام الشرائح."},"accrued_per":{"type":"string","description":"`per_year` (renews every 1 January, can carry over), `one_time_only` (granted once, never renews) or `per_event` (no balance; each occasion requested on its own).","x-description-ar":"`per_year` يتجدد كل ١ يناير ويمكن ترحيله، `one_time_only` يُمنح مرة ولا يتجدد، `per_event` بلا رصيد وتُطلب كل حالة على حدة.","enum":["per_year","per_event","one_time_only"]},"accrual_method":{"type":"string","description":"`full_balance` (all at once) or `monthly` (a twelfth on the 1st of each month; `per_year` only).","x-description-ar":"`full_balance` دفعة واحدة، أو `monthly` جزء من اثني عشر في أول كل شهر (مع `per_year` فقط).","enum":["full_balance","monthly"]},"compensation_type":{"type":"string","description":"`fully_paid`, `tiered_pay` (needs `tiers`) or `unpaid`.","x-description-ar":"`fully_paid` مدفوعة بالكامل، `tiered_pay` أجر متدرج (يحتاج `tiers`)، `unpaid` غير مدفوعة.","enum":["fully_paid","tiered_pay","unpaid"]},"approver":{"type":"string","description":"`manager`, `hr` or `manager_and_hr` (manager first, then HR).","x-description-ar":"`manager` المدير، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["manager","hr","manager_and_hr"]},"allow_past_dates":{"type":"boolean","description":"Allow requests for past dates.","x-description-ar":"السماح بطلبات لتواريخ مضت."},"allow_negative_balance":{"type":"boolean","description":"Allow requests beyond the available balance (forced true for `per_event`).","x-description-ar":"السماح بطلبات تتجاوز الرصيد المتاح (صحيح دائماً مع `per_event`)."},"requires_document":{"type":"boolean","description":"Require a supporting document.","x-description-ar":"اشتراط مستند داعم."},"show_used_balance":{"type":"boolean","description":"Show employees their used days.","x-description-ar":"إظهار الأيام المستخدمة للموظف."},"carryover_usable":{"type":"boolean","description":"Let employees take carried-over days.","x-description-ar":"السماح للموظف باستخدام الأيام المرحَّلة."},"carryover_max_days":{"type":"number","description":"Cap on days carried over; null for no cap.","x-description-ar":"حد الأيام المرحَّلة؛ null بلا حد.","nullable":true},"carryover_expires_end_of_month":{"type":"integer","description":"Month 1–11 after which unused carried-over days expire; null for never.","x-description-ar":"الشهر ١–١١ الذي تنتهي بعده الأيام المرحَّلة غير المستخدمة؛ null لعدم الانتهاء.","nullable":true},"active":{"type":"boolean","description":"Switch the policy on or off. Cannot be switched off while employees hold it.","x-description-ar":"تفعيل السياسة أو تعطيلها. لا يمكن تعطيلها ما دام موظفون يحملونها."},"tiers":{"type":"array","description":"Pay ladder of a `tiered_pay` policy, in order: the first `days` days of the leave are paid at `percentage`, the next tier's days at its percentage, and any day beyond the last tier is unpaid. Empty for every other compensation type.","x-description-ar":"سلّم الأجر لسياسة `tiered_pay` بالترتيب: تُدفع أول `days` يوماً من الإجازة بنسبة `percentage`، ثم أيام الشريحة التالية بنسبتها، وأي يوم بعد آخر شريحة بلا أجر. فارغ لكل أنواع الأجر الأخرى.","items":{"type":"object","properties":{"days":{"type":"integer","description":"Days in this tier (at least 1).","x-description-ar":"عدد أيام هذه الشريحة (١ على الأقل)."},"percentage":{"type":"integer","description":"Percentage of pay for these days, 0 to 100.","x-description-ar":"نسبة الأجر لهذه الأيام، من ٠ إلى ١٠٠."}}}}}}}},"leave_policy_update_result":{"allOf":[{"$ref":"#/components/schemas/leave_policy"},{"type":"object","properties":{"warnings":{"type":"array","description":"Present only when the change touches the entitlement (`duration`, `accrued_per`, `accrual_method`) of a policy employees hold: what it means for their balances. Show these to the person who made the change.","x-description-ar":"يظهر فقط عندما يمس التعديل الاستحقاق (`duration` أو `accrued_per` أو `accrual_method`) لسياسة يحملها موظفون: ما يعنيه ذلك لأرصدتهم. اعرضه على من أجرى التعديل.","items":{"type":"string"}}}}]},"leave_request":{"type":"object","description":"One leave request with its approval history.","x-description-ar":"طلب إجازة واحد مع سجل الموافقات عليه.","required":["id","employee_id","start_date","end_date","status"],"properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"employee_id":{"type":"integer","description":"Id of the employee taking the leave.","x-description-ar":"رقم الموظف صاحب الإجازة."},"employee_no":{"type":"string","description":"Their employee number.","x-description-ar":"رقمه الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request charges to the leave balance, as a decimal string (`\"3.0\"`). Weekends, days off and public holidays are not counted.","x-description-ar":"أيام العمل التي يخصمها الطلب من رصيد الإجازة، كنص عشري (`\"3.0\"`). لا تُحتسب العطل الأسبوعية وأيام الراحة والعطل الرسمية."},"status":{"type":"string","description":"Request status: `pending` (waiting for a decision), `approved`, `rejected`, `cancelled`, or `revoked` (an approval was taken back).","x-description-ar":"حالة الطلب: `pending` بانتظار قرار، `approved` موافق عليه، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحبت الموافقة عليه.","enum":["pending","approved","rejected","cancelled","revoked"]},"reason":{"type":"string","description":"The employee's reason, up to 500 characters.","x-description-ar":"سبب الموظف، حتى ٥٠٠ حرف.","nullable":true},"created_at":{"type":"string","description":"When the request was submitted, in UTC (`2026-03-02 06:00:00 UTC`).","x-description-ar":"وقت تقديم الطلب بتوقيت UTC (`2026-03-02 06:00:00 UTC`)."},"leave_type_name":{"type":"string","description":"Leave policy name, in the requested language.","x-description-ar":"اسم سياسة الإجازة بلغة الطلب.","nullable":true},"cancellation_requested_at":{"type":"string","description":"When the employee asked to cancel this leave, while that is under review.","x-description-ar":"وقت طلب الموظف إلغاء الإجازة، ما دام الطلب قيد المراجعة.","nullable":true},"on_behalf":{"type":"boolean","description":"True when HR or the manager filed it for the employee.","x-description-ar":"صحيح إن قدّمته الموارد البشرية أو المدير نيابةً عن الموظف."},"document_url":{"type":"string","description":"Short-lived link to the attached supporting document. Null when there is none.","x-description-ar":"رابط مؤقت للمستند الداعم المرفق. null إن لم يوجد.","nullable":true},"document_filename":{"type":"string","description":"The attached document's file name.","x-description-ar":"اسم ملف المستند المرفق.","nullable":true},"current_stage":{"type":"string","description":"Where the request sits in the approval chain: `awaiting_manager`, `awaiting_hr`, `cancellation_review` (the employee asked to cancel an approved leave) or `terminal` (decided).","x-description-ar":"موضع الطلب في سلسلة الموافقة: `awaiting_manager` بانتظار المدير، `awaiting_hr` بانتظار الموارد البشرية، `cancellation_review` طلب الموظف إلغاء إجازة موافق عليها، `terminal` حُسم الطلب.","enum":["awaiting_manager","awaiting_hr","cancellation_review","terminal"]},"current_approver_name":{"type":"string","description":"Who must decide next, when the request is waiting.","x-description-ar":"من يجب أن يقرر تالياً إن كان الطلب ينتظر.","nullable":true},"compensation_type":{"type":"string","description":"How the leave is paid: `fully_paid`, `tiered_pay` (pay drops after some days) or `unpaid`.","x-description-ar":"طريقة احتساب أجر الإجازة: `fully_paid` مدفوعة بالكامل، `tiered_pay` يقل الأجر بعد عدد من الأيام، `unpaid` غير مدفوعة.","nullable":true,"enum":["fully_paid","tiered_pay","unpaid",null]},"compensation_type_label":{"type":"string","description":"The same, translated.","x-description-ar":"الشيء نفسه مترجماً.","nullable":true},"actions":{"type":"array","description":"The approval history, oldest first: who did what, when, with their note.","x-description-ar":"سجل الموافقات من الأقدم: من فعل ماذا ومتى مع ملاحظته.","items":{"type":"object","properties":{"action":{"type":"string","description":"What happened: `submitted`, `updated`, `manager_approved`, `pending_hr`, `hr_approved`, `manager_rejected`, `hr_rejected` (sent back to the manager when a manager had approved), `pending_cancellation`, `cancelled`, `cancellation_rejected`, `withdrawn` or `revoked`.","x-description-ar":"ما حدث: `submitted` قُدّم، `updated` عُدّل، `manager_approved` وافق المدير، `pending_hr` أُحيل للموارد البشرية، `hr_approved` وافقت الموارد البشرية، `manager_rejected` رفض المدير، `hr_rejected` رفضت الموارد البشرية (يعود للمدير إن كان قد وافق)، `pending_cancellation` طلب إلغاء، `cancelled` أُلغي، `cancellation_rejected` رُفض طلب الإلغاء، `withdrawn` سُحبت موافقة المدير، `revoked` أُلغيت الموافقة النهائية."},"actioned_at":{"type":"string","description":"When, in UTC (`2026-03-02 08:15:00 UTC`).","x-description-ar":"الوقت بتوقيت UTC (`2026-03-02 08:15:00 UTC`)."},"note":{"type":"string","description":"The note written with it.","x-description-ar":"الملاحظة المكتوبة معه.","nullable":true},"actioned_by":{"type":"string","description":"Who did it (full name).","x-description-ar":"من قام به (الاسم الكامل)."}}}},"revoke_type":{"type":"string","description":"How the approval was taken back: `withdrawn` (the manager, while HR had not decided) or `revoked` (a final approval, before the leave started). Null unless revoked.","x-description-ar":"طريقة سحب الموافقة: `withdrawn` سحبها المدير قبل قرار الموارد البشرية، أو `revoked` أُلغيت موافقة نهائية قبل بدء الإجازة. null ما لم يُسحب.","nullable":true,"enum":["withdrawn","revoked",null]},"revocation":{"$ref":"#/components/schemas/leave_request_revocation"},"approver_actions":{"$ref":"#/components/schemas/leave_request_approver_actions"}}},"leave_request_approver_actions":{"type":"object","description":"What the caller may do with this request as an approver. All false on your own requests.","x-description-ar":"ما يستطيع المستدعي فعله بهذا الطلب بصفته معتمِداً. كلها false على طلباتك أنت.","properties":{"can_withdraw":{"type":"boolean","description":"True when you may take back your manager approval with `leave_requests.withdraw`.","x-description-ar":"صحيح إن كان بإمكانك سحب موافقتك كمدير عبر `leave_requests.withdraw`."},"can_revoke":{"type":"boolean","description":"True when you may take back the final approval with `leave_requests.revoke`.","x-description-ar":"صحيح إن كان بإمكانك إلغاء الموافقة النهائية عبر `leave_requests.revoke`."},"revoke_blocked_reason":{"type":"string","description":"Why revoking is blocked right now although you hold the right: `payroll_locked` or `cancellation_pending`. Null otherwise.","x-description-ar":"سبب تعذّر إلغاء الموافقة الآن رغم أن لك الحق: `payroll_locked` أو `cancellation_pending`. null فيما عدا ذلك.","nullable":true,"enum":["payroll_locked","cancellation_pending",null]}}},"leave_request_cancelled":{"type":"object","required":["record"],"properties":{"record":{"type":"object","description":"The request after the cancellation.","x-description-ar":"الطلب بعد الإلغاء.","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"employee_id":{"type":"integer","description":"Id of the employee taking the leave.","x-description-ar":"رقم الموظف صاحب الإجازة."},"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request charges to the leave balance, as a decimal string (`\"3.0\"`). Weekends, days off and public holidays are not counted.","x-description-ar":"أيام العمل التي يخصمها الطلب من رصيد الإجازة، كنص عشري (`\"3.0\"`). لا تُحتسب العطل الأسبوعية وأيام الراحة والعطل الرسمية."},"reason":{"type":"string","description":"The reason given.","x-description-ar":"السبب المذكور.","nullable":true},"status":{"type":"string","description":"Request status: `pending` (waiting for a decision), `approved`, `rejected`, `cancelled`, or `revoked` (an approval was taken back).","x-description-ar":"حالة الطلب: `pending` بانتظار قرار، `approved` موافق عليه، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحبت الموافقة عليه.","enum":["pending","approved","rejected","cancelled","revoked"]},"created_at":{"type":"string","description":"When it was submitted, in UTC (`2026-03-02 06:00:00 UTC`).","x-description-ar":"وقت التقديم بتوقيت UTC (`2026-03-02 06:00:00 UTC`)."},"note":{"type":"string","description":"The cancellation note you sent.","x-description-ar":"ملاحظة الإلغاء التي أرسلتها.","nullable":true}}}}},"leave_request_created":{"type":"object","required":["record"],"properties":{"record":{"type":"object","description":"The leave request as saved.","x-description-ar":"طلب الإجازة كما حُفظ.","required":["id","employee_id","leave_policy_id","start_date","end_date","status"],"properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"employee_id":{"type":"integer","description":"Id of the employee taking the leave.","x-description-ar":"رقم الموظف صاحب الإجازة."},"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request charges to the leave balance, as a decimal string (`\"3.0\"`). Weekends, days off and public holidays are not counted.","x-description-ar":"أيام العمل التي يخصمها الطلب من رصيد الإجازة، كنص عشري (`\"3.0\"`). لا تُحتسب العطل الأسبوعية وأيام الراحة والعطل الرسمية."},"reason":{"type":"string","description":"The reason given.","x-description-ar":"السبب المذكور.","nullable":true},"status":{"type":"string","description":"Request status: `pending` (waiting for a decision), `approved`, `rejected`, `cancelled`, or `revoked` (an approval was taken back).","x-description-ar":"حالة الطلب: `pending` بانتظار قرار، `approved` موافق عليه، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحبت الموافقة عليه.","enum":["pending","approved","rejected","cancelled","revoked"]},"on_behalf":{"type":"boolean","description":"True when filed by a manager or HR for the employee.","x-description-ar":"صحيح إن قدّمه مدير أو الموارد البشرية نيابةً عن الموظف."},"created_at":{"type":"string","description":"When it was submitted, in UTC (`2026-03-02 06:00:00 UTC`).","x-description-ar":"وقت التقديم بتوقيت UTC (`2026-03-02 06:00:00 UTC`)."}}},"warning":{"type":"string","description":"Present when the request went through with something to know: it overlaps another pending request, or it starts next year (that year's balance is not granted yet).","x-description-ar":"يظهر إن قُبل الطلب مع تنبيه: يتداخل مع طلب آخر قيد الانتظار، أو يبدأ في السنة القادمة (لم يُمنح رصيدها بعد)."}}},"leave_request_decision_note":{"type":"object","properties":{"note":{"type":"string","description":"A note for the employee, up to 500 characters.","x-description-ar":"ملاحظة للموظف، حتى ٥٠٠ حرف.","maxLength":500}}},"leave_request_export_columns":{"type":"object","required":["columns"],"properties":{"columns":{"type":"array","description":"The columns the export can include, in file order.","x-description-ar":"الأعمدة التي يمكن تضمينها في الملف، بترتيبها.","items":{"type":"object","properties":{"key":{"type":"string","description":"Column key, to send in `columns[]`.","x-description-ar":"مفتاح العمود، يُرسل في `columns[]`."},"label":{"type":"string","description":"Column heading, in the requested language.","x-description-ar":"عنوان العمود بلغة الطلب."},"default":{"type":"boolean","description":"True when the column is ticked by default.","x-description-ar":"صحيح إن كان العمود محدداً افتراضياً."},"type":{"type":"string","description":"Value type: `string`, `date`, `datetime`, `number`, `enum` or `boolean`.","x-description-ar":"نوع القيمة: `string` أو `date` أو `datetime` أو `number` أو `enum` أو `boolean`."}}}}}},"leave_request_input":{"type":"object","description":"The leave being requested.","x-description-ar":"الإجازة المطلوبة.","properties":{"leave_policy_id":{"type":"integer","description":"The leave policy (Annual, Sick…). Must be assigned to the employee and active.","x-description-ar":"سياسة الإجازة (سنوية، مرضية…). يجب أن تكون مسندة إلى الموظف ومفعّلة."},"start_date":{"type":"string","description":"First day of leave (`YYYY-MM-DD`), in this year or the next. Not in the past unless the policy allows past dates.","x-description-ar":"أول يوم في الإجازة (`YYYY-MM-DD`)، في هذه السنة أو التي تليها. لا يكون في الماضي ما لم تسمح السياسة بذلك.","format":"date"},"end_date":{"type":"string","description":"Last day of leave, on or after `start_date`, and not after the employee's last working day.","x-description-ar":"آخر يوم في الإجازة، في `start_date` أو بعده، ولا يتجاوز آخر يوم عمل للموظف.","format":"date"},"reason":{"type":"string","description":"Why, up to 500 characters. Optional.","x-description-ar":"السبب، حتى ٥٠٠ حرف. اختياري.","maxLength":500}}},"leave_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/leave_request_row"},"description":"The requests on this page, newest submitted first.","x-description-ar":"الطلبات في هذه الصفحة، الأحدث تقديماً أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"leave_request_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/leave_request"}}},"leave_request_required_note":{"type":"object","required":["note"],"properties":{"note":{"type":"string","description":"The reason, up to 500 characters. The employee sees it.","x-description-ar":"السبب، حتى ٥٠٠ حرف. يراه الموظف.","maxLength":500}}},"leave_request_revocation":{"type":"object","nullable":true,"description":"Who took the approval back, when and why. Null unless the status is `revoked`.","x-description-ar":"من سحب الموافقة ومتى ولماذا. null ما لم تكن الحالة `revoked`.","properties":{"by":{"type":"object","nullable":true,"description":"A person: `id` (employee id) and `full_name`.","x-description-ar":"شخص: `id` رقم الموظف و`full_name` اسمه.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name, in the requested language when known.","x-description-ar":"الاسم الكامل، بلغة الطلب إن توفر."}}},"at":{"type":"string","description":"When, in UTC.","x-description-ar":"الوقت بتوقيت UTC.","format":"date-time"},"note":{"type":"string","description":"The reason given.","x-description-ar":"السبب المذكور.","nullable":true}}},"leave_request_row":{"type":"object","description":"One leave request in the My Leaves list.","x-description-ar":"طلب إجازة واحد في قائمة «إجازاتي».","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request charges to the leave balance, as a decimal string (`\"3.0\"`). Weekends, days off and public holidays are not counted.","x-description-ar":"أيام العمل التي يخصمها الطلب من رصيد الإجازة، كنص عشري (`\"3.0\"`). لا تُحتسب العطل الأسبوعية وأيام الراحة والعطل الرسمية."},"status":{"type":"string","description":"Request status: `pending` (waiting for a decision), `approved`, `rejected`, `cancelled`, or `revoked` (an approval was taken back).","x-description-ar":"حالة الطلب: `pending` بانتظار قرار، `approved` موافق عليه، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحبت الموافقة عليه.","enum":["pending","approved","rejected","cancelled","revoked"]},"created_at":{"type":"string","description":"When the request was submitted, in UTC (`2026-03-02 06:00:00 UTC`).","x-description-ar":"وقت تقديم الطلب بتوقيت UTC (`2026-03-02 06:00:00 UTC`)."},"leave_type_name":{"type":"string","description":"Leave policy name (Annual leave, Sick leave…), in the requested language.","x-description-ar":"اسم سياسة الإجازة (سنوية، مرضية…) بلغة الطلب.","nullable":true},"on_behalf":{"type":"boolean","description":"True when HR or the employee's manager filed it. The employee cannot edit it or withdraw it directly; cancelling it goes to review.","x-description-ar":"صحيح إن قدّمته الموارد البشرية أو مدير الموظف. لا يستطيع الموظف تعديله أو سحبه مباشرة، وإلغاؤه يمر بالمراجعة."},"policy_approver":{"type":"string","description":"Who the leave policy routes requests to (manager, manager then HR, or HR), translated. Not the person holding it now — see `current_approver_name`.","x-description-ar":"الجهة التي توجّه إليها السياسة الطلبات (المدير، أو المدير ثم الموارد البشرية، أو الموارد البشرية) مترجمة. ليست الشخص الذي يحمل الطلب الآن — انظر `current_approver_name`.","nullable":true},"current_stage":{"type":"string","description":"Where the request sits in the approval chain: `awaiting_manager`, `awaiting_hr`, `cancellation_review` (the employee asked to cancel an approved leave) or `terminal` (decided).","x-description-ar":"موضع الطلب في سلسلة الموافقة: `awaiting_manager` بانتظار المدير، `awaiting_hr` بانتظار الموارد البشرية، `cancellation_review` طلب الموظف إلغاء إجازة موافق عليها، `terminal` حُسم الطلب.","enum":["awaiting_manager","awaiting_hr","cancellation_review","terminal"]},"current_approver_name":{"type":"string","description":"Who must decide next, when the request is waiting. Null once decided.","x-description-ar":"من يجب أن يقرر تالياً إن كان الطلب ينتظر. null بعد البت فيه.","nullable":true},"cancellation_requested_at":{"type":"string","description":"When the employee asked to cancel this approved leave, while that is under review. Null otherwise.","x-description-ar":"وقت طلب الموظف إلغاء هذه الإجازة الموافق عليها، ما دام الطلب قيد المراجعة. null فيما عدا ذلك.","nullable":true},"locked":{"type":"boolean","description":"True when the employee can no longer cancel the request (see `lock_reason`).","x-description-ar":"صحيح إن لم يعد الموظف يستطيع إلغاء الطلب (انظر `lock_reason`)."},"lock_reason":{"type":"string","description":"Why it is locked, in words (\"Rejected by Omar Ali.\", \"Your leave has started…\"). Null when not locked.","x-description-ar":"سبب القفل بصيغة مقروءة (مثل «رفضه عمر علي»). null إن لم يكن مقفلاً.","nullable":true},"submitted_by":{"type":"object","nullable":true,"description":"Who filed it on the employee's behalf (HR or the manager). Null when the employee filed it.","x-description-ar":"من قدّمه نيابةً عن الموظف (الموارد البشرية أو المدير). null إن قدّمه الموظف بنفسه.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name, in the requested language when known.","x-description-ar":"الاسم الكامل، بلغة الطلب إن توفر."}}},"revoke_type":{"type":"string","description":"How the approval was taken back: `withdrawn` (the manager, while HR had not decided) or `revoked` (a final approval, before the leave started). Null unless revoked.","x-description-ar":"طريقة سحب الموافقة: `withdrawn` سحبها المدير قبل قرار الموارد البشرية، أو `revoked` أُلغيت موافقة نهائية قبل بدء الإجازة. null ما لم يُسحب.","nullable":true,"enum":["withdrawn","revoked",null]},"revocation":{"$ref":"#/components/schemas/leave_request_revocation"},"approver_actions":{"$ref":"#/components/schemas/leave_request_approver_actions"}}},"leave_request_updated":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/leave_request"},"warning":{"type":"string","description":"Present when the edit went through with something to know: the day count changed, it overlaps another pending request, or it starts next year.","x-description-ar":"يظهر إن قُبل التعديل مع تنبيه: تغيّر عدد الأيام، أو يتداخل مع طلب آخر قيد الانتظار، أو يبدأ في السنة القادمة."}}},"leave_request_validation":{"type":"object","required":["overlaps","balance"],"properties":{"overlaps":{"type":"array","description":"The employee's pending or approved requests that share at least one day with these dates.","x-description-ar":"طلبات الموظف المعلّقة أو الموافق عليها التي تشترك مع هذه التواريخ في يوم واحد على الأقل.","items":{"type":"object","properties":{"leave_type":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"status":{"type":"string","description":"`pending` or `approved`.","x-description-ar":"`pending` أو `approved`.","enum":["pending","approved"]}}}},"balance":{"type":"object","description":"This request against the balance of this year.","x-description-ar":"هذا الطلب مقارنةً برصيد السنة الحالية.","properties":{"available_days":{"type":"number","description":"Days left now: granted plus usable carry-over, minus approved and pending days.","x-description-ar":"الأيام المتبقية الآن: الممنوح مع المرحّل القابل للاستخدام، مطروحاً منه الأيام الموافق عليها والمعلّقة."},"requested_days":{"type":"number","description":"Working days these dates would charge.","x-description-ar":"أيام العمل التي ستُخصم لهذه التواريخ."},"allow_negative_balance":{"type":"boolean","description":"True when the policy lets the balance go below zero.","x-description-ar":"صحيح إن كانت السياسة تسمح بأن يصبح الرصيد سالباً."},"exceeded":{"type":"boolean","description":"True when the request needs more days than are left. Submitting is then refused unless `allow_negative_balance` is true.","x-description-ar":"صحيح إن احتاج الطلب أياماً أكثر من المتبقي. يُرفض التقديم حينها ما لم تكن `allow_negative_balance` صحيحة."}}},"warning":{"type":"string","description":"Present when the dates overlap another pending or approved request.","x-description-ar":"يظهر إن تداخلت التواريخ مع طلب آخر معلّق أو موافق عليه."}}},"leave_setting":{"type":"object","description":"The company's leave settings.","x-description-ar":"إعدادات الإجازات في الشركة.","required":["id","automatic_reminders_enabled","pending_reminder_after_days","reminder_frequency_days"],"properties":{"id":{"type":"integer","description":"Settings record id (one per company).","x-description-ar":"رقم سجل الإعدادات (واحد لكل شركة)."},"automatic_reminders_enabled":{"type":"boolean","description":"Approvers are emailed about leave requests waiting for them. Off by default.","x-description-ar":"يُرسل بريد للمعتمدين بطلبات الإجازة التي تنتظرهم. معطّل افتراضياً."},"pending_reminder_after_days":{"type":"integer","description":"Days a request waits with the same approver before the first reminder (default 3).","x-description-ar":"عدد الأيام التي ينتظرها الطلب لدى المعتمد نفسه قبل أول تذكير (الافتراضي ٣)."},"reminder_frequency_days":{"type":"integer","description":"Days between reminders while the request keeps waiting (default 7).","x-description-ar":"عدد الأيام بين التذكيرات ما دام الطلب ينتظر (الافتراضي ٧)."}}},"loan_detail":{"type":"object","description":"A loan with its decision and schedule.","x-description-ar":"سلفة مع قرارها وجدول سدادها.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"needed_on":{"type":"string","description":"Date the employee needs the money.","x-description-ar":"التاريخ الذي يحتاج فيه الموظف المال.","format":"date","nullable":true},"submitted_at":{"type":"string","description":"When it was requested, ISO 8601 UTC.","x-description-ar":"وقت الطلب، ISO 8601 بتوقيت UTC."},"description":{"type":"string","description":"Why the employee needs it.","x-description-ar":"سبب حاجة الموظف إليها."},"disbursement_date":{"type":"string","description":"Payout date.","x-description-ar":"تاريخ الصرف.","format":"date","nullable":true},"installments_start_on":{"type":"string","description":"First installment month.","x-description-ar":"شهر أول قسط.","format":"date","nullable":true},"installments_end_on":{"type":"string","description":"Last installment month.","x-description-ar":"شهر آخر قسط.","format":"date","nullable":true},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"payments":{"type":"array","description":"Payments behind a direct loan: the payout (`paid`) and the repayment (`received`). Always empty for a payroll loan, whose money moves on the payslip.","x-description-ar":"الدفعات خلف السلفة المباشرة: الصرف (`paid`) والسداد (`received`). فارغة دائماً للسلفة عبر الرواتب لأن مالها يتحرك في القسيمة.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Payment id.","x-description-ar":"رقم الدفعة."},"reference":{"type":"string","description":"Payment reference.","x-description-ar":"مرجع الدفعة."},"kind":{"type":"string","description":"`paid` (to the employee) or `received` (from them).","x-description-ar":"`paid` للموظف أو `received` منه."},"purpose":{"type":"string","description":"`disbursement` or `repayment`.","x-description-ar":"`disbursement` صرف أو `repayment` سداد."},"date":{"type":"string","description":"Payment date.","x-description-ar":"تاريخ الدفعة.","format":"date","nullable":true},"amount":{"type":"string","description":"Amount. Decimal string.","x-description-ar":"المبلغ. نص عشري."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."}}}},"decision":{"type":"object","nullable":true,"description":"HR's decision; null while pending.","x-description-ar":"قرار الموارد البشرية؛ null أثناء الانتظار.","properties":{"by":{"type":"integer","description":"Employee id of who decided.","x-description-ar":"رقم موظف صاحب القرار.","nullable":true},"name":{"type":"string","description":"Their name.","x-description-ar":"اسمه.","nullable":true},"at":{"type":"string","description":"When, ISO 8601 UTC.","x-description-ar":"متى، ISO 8601 بتوقيت UTC.","nullable":true},"note":{"type":"string","description":"Note to the employee.","x-description-ar":"ملاحظة للموظف.","nullable":true}}},"installments":{"type":"array","items":{"$ref":"#/components/schemas/loan_installment"},"description":"The repayment schedule (payroll loans).","x-description-ar":"جدول السداد (للسلفة عبر الرواتب)."},"installments_paid":{"type":"integer","description":"Installments collected; null before approval.","x-description-ar":"الأقساط المحصّلة؛ null قبل الاعتماد.","nullable":true},"installments_remaining":{"type":"integer","description":"Installments still to collect; null before approval.","x-description-ar":"الأقساط المتبقية؛ null قبل الاعتماد.","nullable":true},"amount_repaid":{"type":"string","description":"Repaid so far. Decimal string.","x-description-ar":"المسدَّد حتى الآن. نص عشري."},"outstanding":{"type":"string","description":"Still owed. Decimal string.","x-description-ar":"المتبقي على الموظف. نص عشري."},"editable":{"type":"boolean","description":"True while it can be changed.","x-description-ar":"صحيح ما دام قابلاً للتعديل."},"cancellable":{"type":"boolean","description":"True while it can be withdrawn.","x-description-ar":"صحيح ما دام قابلاً للإلغاء."}}},"loan_installment":{"type":"object","description":"One monthly installment of a payroll loan.","x-description-ar":"قسط شهري واحد لسلفة عبر الرواتب.","properties":{"id":{"type":"integer","description":"Installment id.","x-description-ar":"رقم القسط."},"sequence":{"type":"integer","description":"Its number, from 1.","x-description-ar":"ترتيبه، يبدأ من 1."},"payroll_id":{"type":"integer","description":"The payroll run collecting it; null until a run claims it.","x-description-ar":"مسيّر الرواتب الذي يحصّله؛ null حتى يحجزه مسيّر.","nullable":true},"due_on":{"type":"string","description":"Month it is deducted (first day).","x-description-ar":"الشهر الذي يُستقطع فيه (أول يوم).","format":"date","nullable":true},"amount":{"type":"string","description":"Amount. Decimal string.","x-description-ar":"المبلغ. نص عشري."},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"status":{"type":"string","description":"`due` or `paid`.","x-description-ar":"`due` مستحق أو `paid` مسدَّد.","enum":["due","paid"]}}},"loan_row":{"type":"object","description":"A loan in a list.","x-description-ar":"سلفة في قائمة.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"needed_on":{"type":"string","description":"Date the employee needs the money.","x-description-ar":"التاريخ الذي يحتاج فيه الموظف المال.","format":"date","nullable":true},"submitted_at":{"type":"string","description":"When it was requested, ISO 8601 UTC.","x-description-ar":"وقت الطلب، ISO 8601 بتوقيت UTC."},"installments_remaining":{"type":"integer","description":"Installments still to collect; null before approval.","x-description-ar":"الأقساط المتبقية؛ null قبل الاعتماد.","nullable":true},"outstanding":{"type":"string","description":"Still owed. Decimal string.","x-description-ar":"المتبقي على الموظف. نص عشري."},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"editable":{"type":"boolean","description":"True while it can be changed (`pending`).","x-description-ar":"صحيح ما دام قابلاً للتعديل (`pending`)."},"cancellable":{"type":"boolean","description":"True while it can be withdrawn (`pending`).","x-description-ar":"صحيح ما دام قابلاً للإلغاء (`pending`)."}}},"location":{"type":"object","description":"A work location.","x-description-ar":"موقع عمل.","properties":{"id":{"type":"integer","description":"Location id.","x-description-ar":"رقم الموقع."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"is_active":{"type":"boolean","description":"False when switched off: its employees then check in from anywhere and are recorded as remote.","x-description-ar":"خطأ إذا أُوقف الموقع: يسجل موظفوه الحضور من أي مكان ويُسجَّلون عن بُعد."},"employees_count":{"type":"integer","description":"Employed employees assigned, main plus additional.","x-description-ar":"الموظفون على رأس العمل المعيّنون، رئيسي وإضافي."},"primary_employees_count":{"type":"integer","description":"Employees with this as their main location.","x-description-ar":"الموظفون الذين هذا موقعهم الرئيسي."},"additional_employees_count":{"type":"integer","description":"Employees with this as an additional location.","x-description-ar":"الموظفون الذين هذا موقع إضافي لهم."},"geo_fencing":{"type":"object","description":"Where check-in is allowed. Kept while switched off, so it can be switched back on.","x-description-ar":"أين يُسمح بتسجيل الحضور. تُحفظ القيم أثناء الإيقاف لإعادة التفعيل.","properties":{"enabled":{"type":"boolean","description":"True when the fence is switched on.","x-description-ar":"صحيح إذا كان السياج مفعّلاً."},"latitude":{"type":"number","description":"Map pin latitude.","x-description-ar":"خط عرض النقطة.","nullable":true},"longitude":{"type":"number","description":"Map pin longitude.","x-description-ar":"خط طول النقطة.","nullable":true},"radius_meters":{"type":"integer","description":"Allowed distance from the pin, in metres.","x-description-ar":"المسافة المسموحة من النقطة بالمتر.","nullable":true},"allowed_ips":{"type":"array","description":"Office network addresses or ranges (CIDR).","x-description-ar":"عناوين شبكات المكتب أو نطاقاتها (CIDR).","items":{"type":"string"},"nullable":true},"enforce_on_check_out":{"type":"boolean","description":"True when check-out is held to the fence too.","x-description-ar":"صحيح إذا كان تسجيل الانصراف مقيداً بالسياج أيضاً."}}}}},"location_input":{"type":"object","description":"Location fields.","x-description-ar":"حقول الموقع.","properties":{"name_en":{"type":"string","description":"Name in English, unique.","x-description-ar":"الاسم بالإنجليزية، فريد."},"name_ar":{"type":"string","description":"Name in Arabic, unique.","x-description-ar":"الاسم بالعربية، فريد."},"is_active":{"type":"boolean","description":"`false` switches it off; refused while employed employees are assigned.","x-description-ar":"`false` يوقفه؛ ويُرفض ما دام عليه موظفون على رأس العمل."},"geo_fencing_enabled":{"type":"boolean","description":"Switch the fence on; needs a map pin or an allowed network.","x-description-ar":"تفعيل السياج؛ يحتاج نقطة على الخريطة أو شبكة مسموحة."},"latitude":{"type":"number","description":"Pin latitude; send with longitude and radius.","x-description-ar":"خط العرض؛ يُرسل مع خط الطول والنطاق."},"longitude":{"type":"number","description":"Pin longitude.","x-description-ar":"خط الطول."},"radius_meters":{"type":"integer","description":"Allowed distance in metres.","x-description-ar":"المسافة المسموحة بالمتر."},"enforce_on_check_out":{"type":"boolean","description":"Hold check-out to the fence too.","x-description-ar":"تقييد الانصراف بالسياج أيضاً."},"allowed_ips":{"type":"array","description":"Office network addresses or CIDR ranges.","x-description-ar":"عناوين شبكات المكتب أو نطاقات CIDR.","items":{"type":"string"}}}},"me":{"type":"object","required":["user","company","token","features","permissions"],"properties":{"user":{"type":"object","description":"The token's owner.","x-description-ar":"صاحب الرمز.","properties":{"id":{"type":"integer","description":"User id.","x-description-ar":"رقم المستخدم."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."},"email":{"type":"string","description":"Login email.","x-description-ar":"بريد الدخول."}}},"company":{"type":"object","description":"The only company this token can reach.","x-description-ar":"الشركة الوحيدة التي يصل إليها هذا الرمز.","properties":{"id":{"type":"integer","description":"Company id.","x-description-ar":"رقم الشركة."},"name":{"type":"string","description":"Company name.","x-description-ar":"اسم الشركة."}}},"employee_id":{"type":"integer","nullable":true,"description":"The owner's own employee id; null when the owner is a user with no employee record.","x-description-ar":"رقم الموظف الخاص بصاحب الرمز؛ null إن كان مستخدماً بلا سجل وظيفي."},"locale":{"type":"string","description":"Language of this answer.","x-description-ar":"لغة هذه الإجابة."},"token":{"type":"object","description":"The token itself — never its secret.","x-description-ar":"الرمز نفسه — دون الجزء السري.","properties":{"name":{"type":"string","description":"Name given at creation.","x-description-ar":"الاسم المعطى عند الإنشاء."},"public_id":{"type":"string","description":"Non-secret id shown in QHR.","x-description-ar":"المعرّف غير السري الظاهر في QHR."},"access":{"type":"string","enum":["read","read_write"],"description":"`read` or `read_write`.","x-description-ar":"`read` للقراءة فقط أو `read_write` للقراءة والتعديل."},"expires_at":{"type":"string","format":"date-time","description":"When the token stops working.","x-description-ar":"متى يتوقف الرمز عن العمل."}}},"features":{"type":"array","items":{"type":"string"},"description":"Feature keys the company can use; compare with an operation's `x-feature`.","x-description-ar":"مفاتيح الميزات المتاحة للشركة؛ قارنها بـ `x-feature` في العملية."},"permissions":{"type":"array","items":{"type":"string"},"description":"Permission keys the owner holds; compare with an operation's `x-permission.key`.","x-description-ar":"مفاتيح الصلاحيات التي يملكها صاحب الرمز؛ قارنها بـ `x-permission.key` في العملية."}}},"my_custody_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/my_custody_row"},"description":"The owner's custody on this page.","x-description-ar":"عهد صاحب الرمز في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"my_custody_record":{"type":"object","required":["record"],"properties":{"record":{"type":"object","description":"One of the owner's custody records in full, read only.","x-description-ar":"سجل عهدة لصاحب الرمز كاملاً، للقراءة فقط.","properties":{"id":{"type":"integer","description":"Custody id.","x-description-ar":"رقم العهدة."},"reference":{"type":"string","description":"Custody reference, e.g. `CUS-0042`.","x-description-ar":"مرجع العهدة، مثل `CUS-0042`."},"employee":{"$ref":"#/components/schemas/custody_employee"},"category":{"type":"object","description":"Category as it was named when handed over.","x-description-ar":"الفئة كما كانت تسميتها وقت التسليم.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name":{"type":"string","description":"Category name.","x-description-ar":"اسم الفئة."},"icon":{"type":"string","description":"Category icon key.","x-description-ar":"مفتاح أيقونة الفئة.","nullable":true}}},"item":{"type":"object","description":"Item as it was named when handed over.","x-description-ar":"الصنف كما كان اسمه وقت التسليم.","properties":{"id":{"type":"integer","description":"Item id.","x-description-ar":"رقم الصنف."},"name":{"type":"string","description":"Item name.","x-description-ar":"اسم الصنف."}}},"serial":{"type":"string","description":"Serial number of the unit handed over.","x-description-ar":"الرقم التسلسلي للوحدة المسلَّمة.","nullable":true},"value":{"type":"string","description":"Value of the asset, 2 decimals.","x-description-ar":"قيمة الأصل بخانتين عشريتين."},"currency":{"type":"string","description":"Currency of the money fields (the holder's pay currency).","x-description-ar":"عملة المبالغ (عملة راتب الحامل)."},"assigned_on":{"type":"string","description":"Date it was first handed over.","x-description-ar":"تاريخ التسليم الأول.","format":"date"},"held_since":{"type":"string","description":"Date the current holder received it.","x-description-ar":"تاريخ استلام الحامل الحالي له.","format":"date","nullable":true},"status":{"type":"string","description":"`held` (with the employee), `returned` (back with the company), `deducting` (returned damaged or lost, the employee repaying it from salary) or `deducted` (fully recovered or settled).","x-description-ar":"`held` في عهدة الموظف، `returned` أُعيد إلى الشركة، `deducting` أُعيد تالفاً أو مفقوداً ويُسترد من راتب الموظف، `deducted` اكتمل استرداده أو سُوّي.","enum":["held","returned","deducting","deducted"]},"installments_paid":{"type":"integer","description":"Salary deductions already paid; 0 when none.","x-description-ar":"عدد الاستقطاعات المدفوعة من الراتب؛ 0 إن لم يوجد."},"installments_count":{"type":"integer","description":"Number of salary deductions scheduled; null when the employee pays nothing.","x-description-ar":"عدد الاستقطاعات المجدولة من الراتب؛ null إن لم يكن على الموظف شيء.","nullable":true},"returned_on":{"type":"string","description":"Return date; null while held.","x-description-ar":"تاريخ الإعادة؛ null ما دام في العهدة.","format":"date","nullable":true},"condition":{"type":"string","description":"Condition at return: `intact`, `damaged` or `lost`; null until returned.","x-description-ar":"الحالة عند الإعادة: `intact` سليم، `damaged` تالف، `lost` مفقود؛ null قبل الإعادة.","enum":["intact","damaged","lost",null],"nullable":true},"compensation_amount":{"type":"string","description":"Cost of the damage or loss; null for an intact return.","x-description-ar":"تكلفة التلف أو الفقد؛ null عند الإعادة سليماً.","nullable":true},"borne_by":{"type":"string","description":"Who pays that cost: `company` or `employee`.","x-description-ar":"من يتحمل التكلفة: `company` الشركة أو `employee` الموظف.","enum":["company","employee",null],"nullable":true},"labor_law_cap":{"type":"boolean","description":"True when the deductions were limited to five days' wage a month (labour law).","x-description-ar":"صحيح إن حُدّ الاستقطاع الشهري بأجر خمسة أيام (نظام العمل).","nullable":true},"amount_repaid":{"type":"string","description":"Already recovered from salary; null unless the employee pays.","x-description-ar":"ما استُرد من الراتب حتى الآن؛ null إن لم يكن على الموظف شيء.","nullable":true},"outstanding":{"type":"string","description":"Still to recover; null unless the employee pays.","x-description-ar":"المتبقي للاسترداد؛ null إن لم يكن على الموظف شيء.","nullable":true},"settlement":{"type":"object","nullable":true,"description":"How the balance was closed (cash, or a termination package); null until settled.","x-description-ar":"كيف أُغلق الرصيد (نقداً أو بمخالصة نهاية الخدمة)؛ null قبل التسوية.","properties":{"amount":{"type":"string","description":"Amount settled.","x-description-ar":"المبلغ المسوّى.","nullable":true},"date":{"type":"string","description":"Settlement date.","x-description-ar":"تاريخ التسوية.","format":"date"},"source":{"type":"string","description":"`cash` or `termination_package`.","x-description-ar":"`cash` نقداً أو `termination_package` مخالصة نهاية الخدمة."},"reason":{"type":"string","description":"HR's reason, for a cash settlement.","x-description-ar":"سبب الموارد البشرية في التسوية النقدية.","nullable":true},"termination_package":{"type":"object","nullable":true,"description":"The termination package that settled it.","x-description-ar":"مخالصة نهاية الخدمة التي سوّته.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}}}},"installments":{"type":"array","description":"The salary-deduction schedule, oldest first; empty unless the employee pays.","x-description-ar":"جدول الاستقطاع من الراتب، الأقدم أولاً؛ فارغ إن لم يكن على الموظف شيء.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Installment id.","x-description-ar":"رقم القسط."},"sequence":{"type":"integer","description":"Position in the schedule, from 1.","x-description-ar":"ترتيبه في الجدول، يبدأ من 1."},"due_on":{"type":"string","description":"First day of the month whose payroll deducts it.","x-description-ar":"أول يوم من الشهر الذي يُستقطع في مسير رواتبه.","format":"date"},"amount":{"type":"string","description":"Amount.","x-description-ar":"المبلغ."},"currency":{"type":"string","description":"Currency.","x-description-ar":"العملة."},"status":{"type":"string","description":"`paid` once the payslip carrying it was paid, `due` until then.","x-description-ar":"`paid` بعد دفع قسيمة الراتب التي تحمله، و`due` قبل ذلك.","enum":["paid","due"]},"payroll":{"type":"object","nullable":true,"description":"The payroll run that deducted it.","x-description-ar":"مسير الرواتب الذي استقطعه.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}}}}},"timeline":{"type":"array","description":"What happened to the asset, newest first.","x-description-ar":"ما جرى على الأصل، الأحدث أولاً.","items":{"type":"object","properties":{"kind":{"type":"string","description":"`assigned`, `transferred`, `auto_transferred` (moved to HR when a leaver's package was paid), `returned`, `installment_deducted`, `settled` or `package_settled`.","x-description-ar":"`assigned` تسليم، `transferred` نقل، `auto_transferred` نُقل تلقائياً إلى الموارد البشرية عند دفع مخالصة موظف مغادر، `returned` إعادة، `installment_deducted` استقطاع قسط، `settled` تسوية نقدية، `package_settled` تسوية بالمخالصة."},"occurred_on":{"type":"string","description":"Date.","x-description-ar":"التاريخ.","format":"date"},"actor":{"type":"object","nullable":true,"description":"Who did it; null for a system action.","x-description-ar":"من قام به؛ null للإجراء الآلي.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"from_employee":{"type":"object","nullable":true,"description":"Previous holder, for a transfer.","x-description-ar":"الحامل السابق في النقل.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"to_employee":{"type":"object","nullable":true,"description":"New holder, for an assignment or transfer.","x-description-ar":"الحامل الجديد في التسليم أو النقل.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"amount":{"type":"string","description":"Money involved, when any.","x-description-ar":"المبلغ المعني إن وُجد.","nullable":true},"note":{"type":"string","description":"Settlement reason.","x-description-ar":"سبب التسوية.","nullable":true},"condition":{"type":"string","description":"Condition, for a return.","x-description-ar":"الحالة عند الإعادة.","nullable":true},"termination_package":{"type":"object","nullable":true,"description":"Related termination package.","x-description-ar":"مخالصة نهاية الخدمة المعنية.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}},"payroll":{"type":"object","nullable":true,"description":"Payroll run, for a deduction.","x-description-ar":"مسير الرواتب في الاستقطاع.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}},"installment":{"type":"object","nullable":true,"description":"Which installment, for a deduction.","x-description-ar":"أي قسط، في الاستقطاع.","properties":{"sequence":{"type":"integer","description":"Installment number.","x-description-ar":"رقم القسط."},"count":{"type":"integer","description":"Installments in total.","x-description-ar":"إجمالي الأقساط.","nullable":true}}},"document":{"type":"object","nullable":true,"description":"The signed handover PDF.","x-description-ar":"نموذج التسليم الموقَّع (PDF).","properties":{"url":{"type":"string","description":"Temporary download link.","x-description-ar":"رابط تنزيل مؤقت."},"filename":{"type":"string","description":"File name.","x-description-ar":"اسم الملف."}}}}}},"can_return":{"type":"boolean","description":"True when the caller may take it back now.","x-description-ar":"صحيح إن كان للمستدعي استلامه الآن."},"can_transfer":{"type":"boolean","description":"True when the caller may move it to another employee now.","x-description-ar":"صحيح إن كان للمستدعي نقله إلى موظف آخر الآن."},"can_settle":{"type":"boolean","description":"True when the caller may settle the balance in cash now.","x-description-ar":"صحيح إن كان للمستدعي تسوية الرصيد نقداً الآن."},"settlement_blocker":{"type":"object","nullable":true,"description":"Why the balance cannot be settled in cash, while deducting: `claimed_by_package`, `nothing_outstanding` or `installment_in_flight`.","x-description-ar":"سبب تعذّر تسوية الرصيد نقداً أثناء الاستقطاع: `claimed_by_package` أو `nothing_outstanding` أو `installment_in_flight`.","properties":{"code":{"type":"string","description":"Reason code.","x-description-ar":"رمز السبب."},"message":{"type":"string","description":"Explanation.","x-description-ar":"الشرح."}}},"employee_termination_package":{"type":"object","nullable":true,"description":"The holder's open termination package, which blocks moving the asset.","x-description-ar":"مخالصة نهاية الخدمة المفتوحة للحامل، والتي تمنع تحريك الأصل.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"reference":{"type":"string","description":"Reference.","x-description-ar":"المرجع."}}},"holding":{"type":"string","description":"`current` when the token owner holds it now, `previous` when it has moved away from them.","x-description-ar":"`current` إن كان في عهدة صاحب الرمز الآن، و`previous` إن انتقل منه.","enum":["current","previous"]},"transferred_to":{"type":"object","nullable":true,"description":"Who it went to when it left the owner; null on a current record.","x-description-ar":"إلى من انتقل حين خرج من صاحب الرمز؛ null للعهدة الحالية.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"transferred_on":{"type":"string","description":"When it left the owner.","x-description-ar":"متى خرج من صاحب الرمز.","format":"date","nullable":true}}}}},"my_custody_row":{"type":"object","description":"One of the owner's custody records.","x-description-ar":"سجل من سجلات عهدة صاحب الرمز.","properties":{"id":{"type":"integer","description":"Custody id.","x-description-ar":"رقم العهدة."},"reference":{"type":"string","description":"Custody reference, e.g. `CUS-0042`.","x-description-ar":"مرجع العهدة، مثل `CUS-0042`."},"employee":{"$ref":"#/components/schemas/custody_employee"},"category":{"type":"object","description":"Category as it was named when handed over.","x-description-ar":"الفئة كما كانت تسميتها وقت التسليم.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name":{"type":"string","description":"Category name.","x-description-ar":"اسم الفئة."},"icon":{"type":"string","description":"Category icon key.","x-description-ar":"مفتاح أيقونة الفئة.","nullable":true}}},"item":{"type":"object","description":"Item as it was named when handed over.","x-description-ar":"الصنف كما كان اسمه وقت التسليم.","properties":{"id":{"type":"integer","description":"Item id.","x-description-ar":"رقم الصنف."},"name":{"type":"string","description":"Item name.","x-description-ar":"اسم الصنف."}}},"serial":{"type":"string","description":"Serial number of the unit handed over.","x-description-ar":"الرقم التسلسلي للوحدة المسلَّمة.","nullable":true},"value":{"type":"string","description":"Value of the asset, 2 decimals.","x-description-ar":"قيمة الأصل بخانتين عشريتين."},"currency":{"type":"string","description":"Currency of the money fields (the holder's pay currency).","x-description-ar":"عملة المبالغ (عملة راتب الحامل)."},"assigned_on":{"type":"string","description":"Date it was first handed over.","x-description-ar":"تاريخ التسليم الأول.","format":"date"},"held_since":{"type":"string","description":"Date the current holder received it.","x-description-ar":"تاريخ استلام الحامل الحالي له.","format":"date","nullable":true},"status":{"type":"string","description":"`held` (with the employee), `returned` (back with the company), `deducting` (returned damaged or lost, the employee repaying it from salary) or `deducted` (fully recovered or settled).","x-description-ar":"`held` في عهدة الموظف، `returned` أُعيد إلى الشركة، `deducting` أُعيد تالفاً أو مفقوداً ويُسترد من راتب الموظف، `deducted` اكتمل استرداده أو سُوّي.","enum":["held","returned","deducting","deducted"]},"installments_paid":{"type":"integer","description":"Salary deductions already paid; 0 when none.","x-description-ar":"عدد الاستقطاعات المدفوعة من الراتب؛ 0 إن لم يوجد."},"installments_count":{"type":"integer","description":"Number of salary deductions scheduled; null when the employee pays nothing.","x-description-ar":"عدد الاستقطاعات المجدولة من الراتب؛ null إن لم يكن على الموظف شيء.","nullable":true},"returned_on":{"type":"string","description":"Return date; null while held.","x-description-ar":"تاريخ الإعادة؛ null ما دام في العهدة.","format":"date","nullable":true},"condition":{"type":"string","description":"Condition at return: `intact`, `damaged` or `lost`; null until returned.","x-description-ar":"الحالة عند الإعادة: `intact` سليم، `damaged` تالف، `lost` مفقود؛ null قبل الإعادة.","enum":["intact","damaged","lost",null],"nullable":true},"holding":{"type":"string","description":"`current` when the token owner holds it now, `previous` when it has moved away from them.","x-description-ar":"`current` إن كان في عهدة صاحب الرمز الآن، و`previous` إن انتقل منه.","enum":["current","previous"]},"transferred_to":{"type":"object","nullable":true,"description":"Who it went to when it left the owner; null on a current record.","x-description-ar":"إلى من انتقل حين خرج من صاحب الرمز؛ null للعهدة الحالية.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"transferred_on":{"type":"string","description":"When it left the owner.","x-description-ar":"متى خرج من صاحب الرمز.","format":"date","nullable":true}}},"my_payslip":{"type":"object","description":"One of your payslips.","x-description-ar":"إحدى قسائمك.","properties":{"id":{"type":"integer","description":"Payslip id.","x-description-ar":"رقم القسيمة."},"period":{"type":"string","description":"Month, `YYYY-MM`.","x-description-ar":"الشهر بالشكل `YYYY-MM`."},"net_pay":{"type":"string","description":"Net pay. Decimal string.","x-description-ar":"صافي الراتب. نص عشري."},"currency":{"type":"string","description":"Pay currency, ISO code.","x-description-ar":"عملة الراتب برمز ISO."},"status":{"type":"string","description":"Payment status: `unpaid`, `partial` (part of the net was paid), `paid`, or `not_required` (net is zero, nothing to transfer).","x-description-ar":"حالة الصرف: `unpaid` لم يُصرف، `partial` صُرف جزء من الصافي، `paid` صُرف بالكامل، `not_required` الصافي صفر فلا شيء يُحوَّل.","enum":["unpaid","partial","paid","not_required"]},"finalized":{"type":"boolean","description":"True once the run is final.","x-description-ar":"صحيح إذا اعتُمد المسيّر نهائياً."}}},"my_payslip_detail":{"type":"object","description":"One of your payslips, with its lines.","x-description-ar":"إحدى قسائمك مع بنودها.","properties":{"id":{"type":"integer","description":"Payslip id.","x-description-ar":"رقم القسيمة."},"period":{"type":"string","description":"Month, `YYYY-MM`.","x-description-ar":"الشهر بالشكل `YYYY-MM`."},"net_pay":{"type":"string","description":"Net pay. Decimal string.","x-description-ar":"صافي الراتب. نص عشري."},"currency":{"type":"string","description":"Pay currency, ISO code.","x-description-ar":"عملة الراتب برمز ISO."},"status":{"type":"string","description":"Payment status: `unpaid`, `partial` (part of the net was paid), `paid`, or `not_required` (net is zero, nothing to transfer).","x-description-ar":"حالة الصرف: `unpaid` لم يُصرف، `partial` صُرف جزء من الصافي، `paid` صُرف بالكامل، `not_required` الصافي صفر فلا شيء يُحوَّل.","enum":["unpaid","partial","paid","not_required"]},"finalized":{"type":"boolean","description":"True once the run is final.","x-description-ar":"صحيح إذا اعتُمد المسيّر نهائياً."},"earnings":{"type":"array","items":{"$ref":"#/components/schemas/employee_earning"},"description":"Every line of the payslip.","x-description-ar":"كل بنود القسيمة."}}},"overtime_bulk_result":{"type":"object","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids decided.","x-description-ar":"الأرقام التي تم البت فيها.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids left as they were, each with the reason.","x-description-ar":"الأرقام التي لم تتغير، ولكلٍّ سببه.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Overtime request id.","x-description-ar":"رقم الطلب."},"error":{"type":"string","description":"Why it was not decided.","x-description-ar":"سبب عدم البت فيه."}}}}}},"overtime_hr_stat_cards":{"type":"object","properties":{"needs_my_action":{"type":"integer","description":"Requests waiting for HR (`pending_hr`), any date.","x-description-ar":"الطلبات بانتظار الموارد البشرية (`pending_hr`)، أياً كان تاريخها."},"all_pending":{"type":"integer","description":"Requests waiting for anyone (manager or HR).","x-description-ar":"الطلبات المعلقة لدى أي جهة (المدير أو الموارد البشرية)."},"pending_hours":{"type":"number","description":"Hours of all pending requests.","x-description-ar":"ساعات كل الطلبات المعلقة."},"approved_this_month":{"type":"integer","description":"Requests approved for dates this month.","x-description-ar":"الطلبات المعتمدة لتواريخ هذا الشهر."},"approved_hours_this_month":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."},"approved_hours_last_month":{"type":"number","description":"Hours approved for dates last month.","x-description-ar":"الساعات المعتمدة لتواريخ الشهر الماضي."},"unconsumed_approved_hours":{"type":"number","description":"Approved hours no payroll run has taken yet, any date.","x-description-ar":"الساعات المعتمدة التي لم يأخذها أي مسير رواتب بعد، أياً كان تاريخها."}}},"overtime_my_stat_cards":{"type":"object","properties":{"period":{"type":"object","description":"The dates counted.","x-description-ar":"الفترة المحسوبة.","properties":{"from":{"type":"string","description":"First day.","x-description-ar":"اليوم الأول.","format":"date"},"to":{"type":"string","description":"Last day.","x-description-ar":"اليوم الأخير.","format":"date"}}},"pending":{"type":"object","description":"Waiting for the manager or HR.","x-description-ar":"بانتظار المدير أو الموارد البشرية.","properties":{"count":{"type":"integer","description":"Number of requests.","x-description-ar":"عدد الطلبات."},"hours":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."}}},"approved":{"type":"object","description":"Approved, paid or not.","x-description-ar":"المعتمدة، صُرفت أو لم تُصرف.","properties":{"count":{"type":"integer","description":"Number of requests.","x-description-ar":"عدد الطلبات."},"hours":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."}}},"rejected":{"type":"object","description":"Rejected.","x-description-ar":"المرفوضة.","properties":{"count":{"type":"integer","description":"Number of requests.","x-description-ar":"عدد الطلبات."},"hours":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."}}},"paid":{"type":"object","description":"Approved and already taken by a payroll run.","x-description-ar":"المعتمدة التي أخذها مسير رواتب.","properties":{"count":{"type":"integer","description":"Number of requests.","x-description-ar":"عدد الطلبات."},"hours":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."}}},"unpaid_approved_hours":{"type":"number","description":"Approved hours no payroll run has taken yet.","x-description-ar":"الساعات المعتمدة التي لم يأخذها مسير بعد."},"estimated_amount":{"type":"number","description":"Estimated pay for the approved hours at today's salary and overtime rate; null without a salary or approved hours.","x-description-ar":"تقدير أجر الساعات المعتمدة براتب اليوم ومعامل العمل الإضافي؛ null إن لم يوجد راتب أو ساعات معتمدة.","nullable":true}}},"overtime_request":{"type":"object","description":"One overtime request.","x-description-ar":"طلب عمل إضافي واحد.","required":["id","employee_id","date","start_time","end_time","minutes","status"],"properties":{"id":{"type":"integer","description":"Overtime request id.","x-description-ar":"رقم طلب العمل الإضافي."},"employee_id":{"type":"integer","description":"Id of the employee who asked.","x-description-ar":"رقم الموظف صاحب الطلب."},"employee_no":{"type":"string","description":"Their employee number.","x-description-ar":"رقمه الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل.","nullable":true},"date":{"type":"string","description":"The work day the hours belong to (`YYYY-MM-DD`).","x-description-ar":"يوم العمل الذي تتبع له الساعات (`YYYY-MM-DD`).","format":"date"},"start_time":{"type":"string","description":"Start, `HH:MM` on the employee's wall clock (company time zone).","x-description-ar":"البداية بصيغة `HH:MM` بتوقيت الشركة."},"end_time":{"type":"string","description":"End, `HH:MM`. Earlier than the start means it ends the next day.","x-description-ar":"النهاية بصيغة `HH:MM`. إن كانت قبل البداية فهي في اليوم التالي."},"minutes":{"type":"integer","description":"Length in minutes (1 to 720).","x-description-ar":"المدة بالدقائق (من ١ إلى ٧٢٠)."},"hours":{"type":"number","description":"Length in hours, two decimals.","x-description-ar":"المدة بالساعات لأقرب منزلتين عشريتين."},"reason":{"type":"string","description":"Why the overtime was worked.","x-description-ar":"سبب العمل الإضافي."},"status":{"type":"string","description":"Where the request stands: `pending_manager` (waiting for the employee's manager), `pending_hr` (waiting for HR), `approved` (will be paid), `rejected` or `cancelled` (by the employee).","x-description-ar":"موقف الطلب: `pending_manager` بانتظار مدير الموظف، `pending_hr` بانتظار الموارد البشرية، `approved` معتمد وسيُصرف، `rejected` مرفوض، `cancelled` ألغاه الموظف.","enum":["pending_manager","pending_hr","approved","rejected","cancelled"]},"trimmed":{"type":"boolean","description":"True when QHR cut the asked window because part of it fell inside the shift.","x-description-ar":"صحيح إن قصّ QHR الفترة المطلوبة لأن جزءاً منها وقع داخل الدوام."},"original_start_time":{"type":"string","description":"The start originally asked, when trimmed.","x-description-ar":"البداية المطلوبة أصلاً عند القص.","nullable":true},"original_end_time":{"type":"string","description":"The end originally asked, when trimmed.","x-description-ar":"النهاية المطلوبة أصلاً عند القص.","nullable":true},"current_approver_name":{"type":"string","description":"Who must decide next: the manager's name, or \"HR\" (translated). Null once decided.","x-description-ar":"من عليه القرار الآن: اسم المدير أو «الموارد البشرية». null بعد البت فيه.","nullable":true},"can_act":{"type":"boolean","description":"True when the token owner may approve or reject it now.","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع اعتماده أو رفضه الآن."},"attendance_profile":{"type":"object","description":"The employee's schedule on that date, so an approver can see the claim is outside it.","x-description-ar":"جدول الموظف في ذلك اليوم، ليتأكد المعتمِد أن الساعات خارج الدوام.","properties":{"id":{"type":"integer","description":"Attendance profile id.","x-description-ar":"رقم ملف الحضور."},"name":{"type":"string","description":"Attendance profile name.","x-description-ar":"اسم ملف الحضور."},"daily_target_hours":{"type":"number","description":"Hours a normal day asks.","x-description-ar":"الساعات المطلوبة في اليوم العادي."},"grace_period_minutes":{"type":"integer","description":"Late grace, minutes.","x-description-ar":"مهلة التأخير بالدقائق.","nullable":true},"shift_start":{"type":"string","description":"Shift start that day, `HH:MM`; null on a day off or flexible day.","x-description-ar":"بداية الدوام ذلك اليوم؛ null في يوم الراحة أو اليوم المرن.","nullable":true},"shift_end":{"type":"string","description":"Shift end that day, `HH:MM`.","x-description-ar":"نهاية الدوام ذلك اليوم.","nullable":true},"day_type":{"type":"string","description":"`working_day`, `weekend`, `holiday` or `on_leave`.","x-description-ar":"`working_day` يوم عمل، `weekend` راحة، `holiday` عطلة رسمية، `on_leave` في إجازة.","nullable":true},"flexible":{"type":"boolean","description":"True on a flexible day (hours owed, no fixed window).","x-description-ar":"صحيح في اليوم المرن (ساعات مطلوبة بلا وقت محدد)."},"scheduled_hours":{"type":"number","description":"Hours owed that day; null when nothing is owed.","x-description-ar":"الساعات المطلوبة ذلك اليوم؛ null إن لم يُطلب شيء.","nullable":true}}},"manager":{"type":"object","description":"The manager's decision: who, when and the note. Null until that desk has acted.","x-description-ar":"قرار المدير: من اتخذه ومتى والملاحظة. null حتى يتخذ قراره.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id of the approver.","x-description-ar":"رقم موظف المعتمِد.","nullable":true},"name":{"type":"string","description":"Approver's full name.","x-description-ar":"الاسم الكامل للمعتمِد.","nullable":true},"acted_at":{"type":"string","description":"When they decided, in UTC (ISO 8601).","x-description-ar":"وقت القرار بتوقيت UTC (ISO 8601)."},"note":{"type":"string","description":"Their note; always present on a rejection.","x-description-ar":"ملاحظته؛ موجودة دائماً عند الرفض.","nullable":true}}},"hr":{"type":"object","description":"The HR decision: who, when and the note. Null until that desk has acted.","x-description-ar":"قرار الموارد البشرية: من اتخذه ومتى والملاحظة. null حتى يتخذ قراره.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id of the approver.","x-description-ar":"رقم موظف المعتمِد.","nullable":true},"name":{"type":"string","description":"Approver's full name.","x-description-ar":"الاسم الكامل للمعتمِد.","nullable":true},"acted_at":{"type":"string","description":"When they decided, in UTC (ISO 8601).","x-description-ar":"وقت القرار بتوقيت UTC (ISO 8601)."},"note":{"type":"string","description":"Their note; always present on a rejection.","x-description-ar":"ملاحظته؛ موجودة دائماً عند الرفض.","nullable":true}}},"payroll_id":{"type":"integer","description":"The payroll run that paid it; null until a run takes it.","x-description-ar":"رقم مسير الرواتب الذي صرفه؛ null حتى يأخذه مسير.","nullable":true},"created_at":{"type":"string","description":"When it was submitted, in UTC (ISO 8601).","x-description-ar":"وقت تقديمه بتوقيت UTC (ISO 8601)."}}},"overtime_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/overtime_request"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"overtime_request_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/overtime_request"}}},"overtime_request_saved":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/overtime_request"},"warning":{"type":"string","description":"Present when the window was trimmed: what was kept and why. Show it to the employee.","x-description-ar":"يظهر عند قص الفترة: ما الذي بقي ولماذا. اعرضه على الموظف."}}},"overtime_team_stat_cards":{"type":"object","properties":{"needs_my_action":{"type":"integer","description":"Direct reports' requests waiting for you, any date.","x-description-ar":"طلبات مرؤوسيك المباشرين بانتظارك، أياً كان تاريخها."},"pending_hours":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."},"approved_this_month":{"type":"integer","description":"Your team's requests approved for dates this month.","x-description-ar":"طلبات فريقك المعتمدة لتواريخ هذا الشهر."},"approved_hours_this_month":{"type":"number","description":"Their hours.","x-description-ar":"ساعاتها."},"team_size":{"type":"integer","description":"Number of your direct reports.","x-description-ar":"عدد مرؤوسيك المباشرين."}}},"pagination":{"type":"object","required":["current_page","per_page","total_entries","pages"],"properties":{"current_page":{"type":"integer","description":"This page's number.","x-description-ar":"رقم هذه الصفحة."},"per_page":{"type":"integer","description":"Records per page.","x-description-ar":"عدد السجلات في الصفحة."},"total_entries":{"type":"integer","description":"Records across all pages.","x-description-ar":"عدد السجلات في كل الصفحات."},"pages":{"type":"integer","description":"Number of pages.","x-description-ar":"عدد الصفحات."}}},"payroll_component":{"type":"object","description":"A named pay component in the company's catalogue.","x-description-ar":"مكوّن راتب مسمّى في قائمة الشركة.","properties":{"id":{"type":"integer","description":"Component id.","x-description-ar":"رقم المكوّن."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"component_type":{"type":"string","description":"`earning` or `deduction`.","x-description-ar":"`earning` استحقاق أو `deduction` استقطاع.","enum":["earning","deduction"]},"calc_basis":{"type":"string","description":"Free-text note on how it is calculated.","x-description-ar":"ملاحظة حرة عن طريقة الحساب.","nullable":true},"is_builtin":{"type":"boolean","description":"True for the components every company starts with.","x-description-ar":"صحيح للمكوّنات التي تبدأ بها كل شركة."}}},"payroll_run":{"type":"object","description":"A payroll run: one pay period for a group of employees, moving through its steps to finalised.","x-description-ar":"مسيّر رواتب: فترة صرف واحدة لمجموعة من الموظفين، يمر بخطواته حتى الاعتماد النهائي.","properties":{"id":{"type":"integer","description":"Run id.","x-description-ar":"رقم المسيّر."},"reference":{"type":"string","description":"Run reference, e.g. `PYR-0042`.","x-description-ar":"مرجع المسيّر، مثل `PYR-0042`."},"pay_cycle":{"type":"string","description":"`monthly`, `weekly` or `daily`.","x-description-ar":"`monthly` شهري، `weekly` أسبوعي، `daily` يومي."},"status":{"type":"string","description":"Step: `verify_info`, `verify_time`, `verify_earnings`, `verify_payments`, `pending_accounting` (waiting for approval in Qoyod accounting) or `finalized`.","x-description-ar":"الخطوة: `verify_info` مراجعة البيانات، `verify_time` مراجعة الوقت، `verify_earnings` مراجعة الاستحقاقات، `verify_payments` مراجعة الصرف، `pending_accounting` بانتظار موافقة محاسبة قيود، `finalized` معتمد نهائياً.","enum":["verify_info","verify_time","verify_earnings","verify_payments","pending_accounting","finalized"]},"description":{"type":"string","description":"Free-text description.","x-description-ar":"وصف حر.","nullable":true},"location_id":{"type":"integer","description":"Work location the run is limited to; null for all locations.","x-description-ar":"موقع العمل الذي يقتصر عليه المسيّر؛ null لكل المواقع.","nullable":true},"payment_date":{"type":"string","description":"Planned pay date.","x-description-ar":"تاريخ الصرف المخطط.","format":"date","nullable":true},"from":{"type":"string","description":"First day of the period.","x-description-ar":"أول يوم في الفترة.","format":"date"},"to":{"type":"string","description":"Last day of the period.","x-description-ar":"آخر يوم في الفترة.","format":"date"},"employees_count":{"type":"integer","description":"Employees in the run.","x-description-ar":"عدد الموظفين في المسيّر."},"total_due":{"type":"object","additionalProperties":{"type":"string"},"description":"Still to pay, per currency (`{ \"SAR\": \"412000.00\" }`). Empty before payslips exist.","x-description-ar":"المتبقي للصرف لكل عملة (`{ \"SAR\": \"412000.00\" }`). فارغ قبل إنشاء القسائم."},"totals":{"type":"object","description":"One entry per pay currency (`SAR`, `USD`…), since a run's employees may be paid in different currencies.","x-description-ar":"مدخل لكل عملة صرف (`SAR`، `USD`…)، لأن موظفي المسيّر قد تُصرف رواتبهم بعملات مختلفة.","additionalProperties":{"type":"object","properties":{"slips":{"type":"integer","description":"Payslips in this currency.","x-description-ar":"عدد القسائم بهذه العملة."},"total_incomes":{"type":"string","description":"Incomes, decimal string.","x-description-ar":"الاستحقاقات، نص عشري."},"total_deductions":{"type":"string","description":"Deductions, decimal string.","x-description-ar":"الاستقطاعات، نص عشري."},"total_paid":{"type":"string","description":"Paid so far, decimal string.","x-description-ar":"المصروف حتى الآن، نص عشري."},"due":{"type":"string","description":"Still to pay, decimal string.","x-description-ar":"المتبقي للصرف، نص عشري."}}}}}},"payroll_run_accounting":{"type":"object","description":"Where the run stands in Qoyod accounting. `state` is `not_applicable` (no accounting connected), `not_sent`, `queued`, `sending`, `retrying`, `posted`, `held` (an account mapping is missing in Qoyod), `needs_decision` (the period is closed in Qoyod), `failed`, `rejected` or `reversed`. Once sent it also carries the event id, the journal entry, the reason for a hold, and whether a retry or a re-post is allowed.","x-description-ar":"موقف المسيّر في محاسبة قيود. قيمة `state`: `not_applicable` لا محاسبة مرتبطة، `not_sent` لم يُرسل، `queued` في الانتظار، `sending` جارٍ الإرسال، `retrying` تُعاد المحاولة، `posted` رُحّل، `held` معلّق لنقص ربط حساب في قيود، `needs_decision` الفترة مقفلة في قيود، `failed` فشل، `rejected` رُفض، `reversed` عُكس. وبعد الإرسال يتضمن رقم الحدث والقيد اليومي وسبب التعليق، وهل تجوز إعادة المحاولة أو إعادة الترحيل.","properties":{"state":{"type":"string","description":"Accounting state, see above.","x-description-ar":"حالة المحاسبة، انظر أعلاه."},"mode":{"type":"string","description":"`legacy` (finalising completes the run) or `approval` (accounting approves it).","x-description-ar":"`legacy` الاعتماد يُنهي المسيّر، أو `approval` المحاسبة توافق عليه.","enum":["legacy","approval"]},"event_id":{"type":"string","description":"Id of the event sent to Qoyod.","x-description-ar":"رقم الحدث المرسل إلى قيود.","nullable":true},"journal_entry":{"type":"object","description":"The Qoyod journal entry: `ref` and `url`.","x-description-ar":"القيد اليومي في قيود: `ref` و`url`.","nullable":true},"reason":{"type":"string","description":"Why it is held, waiting or failed.","x-description-ar":"سبب التعليق أو الانتظار أو الفشل.","nullable":true},"retryable":{"type":"boolean","description":"True when `payroll_runs.accounting_retry` may be called.","x-description-ar":"صحيح إن أمكن استدعاء `payroll_runs.accounting_retry`."},"repost_allowed":{"type":"boolean","description":"True when `payroll_runs.accounting_repost` may be called.","x-description-ar":"صحيح إن أمكن استدعاء `payroll_runs.accounting_repost`."}}},"payroll_run_detail":{"type":"object","description":"A run, its leave advisories and its accounting status.","x-description-ar":"المسيّر وتنبيهات الإجازات وحالة المحاسبة.","properties":{"payroll":{"$ref":"#/components/schemas/payroll_run"},"leave_warnings":{"type":"array","description":"Advisories that never block a step: `pending_leave` (a leave request still awaiting a decision overlaps the period) and, on finalised runs, `unpaid_leave_changed` (unpaid leave changed after the run closed; correct it with a deduction next month).","x-description-ar":"تنبيهات لا تمنع أي خطوة: `pending_leave` طلب إجازة لم يُبت فيه يتداخل مع الفترة، وفي المسيّرات المعتمدة `unpaid_leave_changed` تغيّرت الإجازة غير المدفوعة بعد إغلاق المسيّر (صحّحها باستقطاع في الشهر التالي).","items":{"type":"object","properties":{"issue":{"type":"string","description":"`pending_leave` or `unpaid_leave_changed`.","x-description-ar":"`pending_leave` أو `unpaid_leave_changed`."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Employee name.","x-description-ar":"اسم الموظف.","nullable":true}}}},"accounting":{"$ref":"#/components/schemas/payroll_run_accounting"}}},"payroll_setting":{"type":"object","description":"The company's payroll rules.","x-description-ar":"قواعد الرواتب في الشركة.","properties":{"overtime_multiplier":{"type":"string","description":"Overtime pay rate as a multiple of the hourly rate (`1.5` = time and a half). Decimal string.","x-description-ar":"أجر العمل الإضافي كمضاعف لأجر الساعة (`1.5` = ساعة ونصف). نص عشري."},"late_multiplier":{"type":"string","description":"Multiple of the hourly rate deducted per hour late. Decimal string.","x-description-ar":"مضاعف أجر الساعة المستقطع عن كل ساعة تأخير. نص عشري."},"undertime_multiplier":{"type":"string","description":"Multiple of the hourly rate deducted per hour of undertime. Decimal string.","x-description-ar":"مضاعف أجر الساعة المستقطع عن كل ساعة نقص. نص عشري."},"payment_date_rule":{"type":"string","description":"`last_day_of_month` or `specific_day`.","x-description-ar":"`last_day_of_month` آخر يوم في الشهر، أو `specific_day` يوم محدد.","enum":["last_day_of_month","specific_day"]},"payment_day_of_month":{"type":"integer","description":"Pay day (1–28) with `specific_day`; null otherwise.","x-description-ar":"يوم الصرف (١–٢٨) مع `specific_day`؛ وإلا null.","nullable":true}}},"payslip":{"type":"object","description":"A payslip's totals.","x-description-ar":"إجماليات القسيمة.","properties":{"id":{"type":"integer","description":"Payslip id.","x-description-ar":"رقم القسيمة."},"payroll_id":{"type":"integer","description":"The payroll run it belongs to.","x-description-ar":"رقم مسيّر الرواتب الذي تتبع له."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف.","nullable":true},"total_incomes":{"type":"string","description":"Sum of the income lines that apply. Decimal string.","x-description-ar":"مجموع بنود الاستحقاق المفعّلة. نص عشري."},"total_deductions":{"type":"string","description":"Sum of the deduction lines that apply. Decimal string.","x-description-ar":"مجموع بنود الاستقطاع المفعّلة. نص عشري."},"net":{"type":"string","description":"Net pay: incomes minus deductions. Decimal string.","x-description-ar":"صافي الراتب: الاستحقاقات ناقص الاستقطاعات. نص عشري."},"total_paid":{"type":"string","description":"Paid so far against this payslip. Decimal string.","x-description-ar":"المصروف حتى الآن على هذه القسيمة. نص عشري."},"due":{"type":"string","description":"Still to pay: net minus paid. Decimal string.","x-description-ar":"المتبقي للصرف: الصافي ناقص المصروف. نص عشري."},"payment_status":{"type":"string","description":"Payment status: `unpaid`, `partial` (part of the net was paid), `paid`, or `not_required` (net is zero, nothing to transfer).","x-description-ar":"حالة الصرف: `unpaid` لم يُصرف، `partial` صُرف جزء من الصافي، `paid` صُرف بالكامل، `not_required` الصافي صفر فلا شيء يُحوَّل.","enum":["unpaid","partial","paid","not_required"]},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"period":{"type":"string","description":"Month of the run, `YYYY-MM`.","x-description-ar":"شهر المسيّر بالشكل `YYYY-MM`."},"finalized":{"type":"boolean","description":"True once the run is finalised and the payslip can no longer change.","x-description-ar":"صحيح إذا اعتُمد المسيّر نهائياً ولم تعد القسيمة قابلة للتعديل."}}},"payslip_detail":{"type":"object","description":"A payslip with its lines.","x-description-ar":"قسيمة مع بنودها.","properties":{"id":{"type":"integer","description":"Payslip id.","x-description-ar":"رقم القسيمة."},"payroll_id":{"type":"integer","description":"The payroll run it belongs to.","x-description-ar":"رقم مسيّر الرواتب الذي تتبع له."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Employee's full name.","x-description-ar":"الاسم الكامل للموظف.","nullable":true},"total_incomes":{"type":"string","description":"Sum of the income lines that apply. Decimal string.","x-description-ar":"مجموع بنود الاستحقاق المفعّلة. نص عشري."},"total_deductions":{"type":"string","description":"Sum of the deduction lines that apply. Decimal string.","x-description-ar":"مجموع بنود الاستقطاع المفعّلة. نص عشري."},"net":{"type":"string","description":"Net pay: incomes minus deductions. Decimal string.","x-description-ar":"صافي الراتب: الاستحقاقات ناقص الاستقطاعات. نص عشري."},"total_paid":{"type":"string","description":"Paid so far against this payslip. Decimal string.","x-description-ar":"المصروف حتى الآن على هذه القسيمة. نص عشري."},"due":{"type":"string","description":"Still to pay: net minus paid. Decimal string.","x-description-ar":"المتبقي للصرف: الصافي ناقص المصروف. نص عشري."},"payment_status":{"type":"string","description":"Payment status: `unpaid`, `partial` (part of the net was paid), `paid`, or `not_required` (net is zero, nothing to transfer).","x-description-ar":"حالة الصرف: `unpaid` لم يُصرف، `partial` صُرف جزء من الصافي، `paid` صُرف بالكامل، `not_required` الصافي صفر فلا شيء يُحوَّل.","enum":["unpaid","partial","paid","not_required"]},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"period":{"type":"string","description":"Month of the run, `YYYY-MM`.","x-description-ar":"شهر المسيّر بالشكل `YYYY-MM`."},"finalized":{"type":"boolean","description":"True once the run is finalised and the payslip can no longer change.","x-description-ar":"صحيح إذا اعتُمد المسيّر نهائياً ولم تعد القسيمة قابلة للتعديل."},"earnings":{"type":"array","items":{"$ref":"#/components/schemas/employee_earning"},"description":"Every line, switched-off ones included.","x-description-ar":"كل البنود، بما فيها المعطّلة."}}},"permission_request":{"type":"object","description":"A permission request: an hourly leave of absence on one working day.","x-description-ar":"طلب استئذان: غياب بالساعات في يوم عمل واحد.","required":["id","employee_id","date","start_time","end_time","status"],"properties":{"id":{"type":"integer","description":"Permission request id.","x-description-ar":"رقم طلب الاستئذان."},"reference":{"type":"string","description":"Reference shown to people, `PRM-\u003cid\u003e`.","x-description-ar":"المرجع الظاهر للمستخدمين بالشكل `PRM-\u003cid\u003e`."},"employee_id":{"type":"integer","description":"The employee who asked.","x-description-ar":"رقم الموظف صاحب الطلب."},"employee_no":{"type":"string","description":"Their employee number.","x-description-ar":"رقمه الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل.","nullable":true},"date":{"type":"string","description":"The working day the permission is for.","x-description-ar":"يوم العمل الذي يخصه الاستئذان.","format":"date"},"start_time":{"type":"string","description":"Start, wall-clock time `HH:MM` in the attendance profile's timezone.","x-description-ar":"وقت البداية `HH:MM` بتوقيت ملف الحضور."},"end_time":{"type":"string","description":"End, wall-clock time `HH:MM` in the attendance profile's timezone.","x-description-ar":"وقت النهاية `HH:MM` بتوقيت ملف الحضور."},"starts_at":{"type":"string","description":"Absolute start, in UTC. For an overnight shift it may fall on the next calendar day.","x-description-ar":"البداية الفعلية بتوقيت UTC. في الدوام الليلي قد تقع في اليوم التالي.","format":"date-time"},"ends_at":{"type":"string","description":"Absolute end, in UTC.","x-description-ar":"النهاية الفعلية بتوقيت UTC.","format":"date-time"},"minutes":{"type":"integer","description":"Length in minutes.","x-description-ar":"المدة بالدقائق."},"hours":{"type":"number","description":"Length in hours, two decimals.","x-description-ar":"المدة بالساعات بمنزلتين عشريتين."},"kind":{"type":"string","description":"What the window is, worked out by QHR from the shift: `late_arrival` (starts when the shift starts), `early_leave` (ends when the shift ends), `mid_shift` (inside the shift) or `flexible` (a day with no fixed hours).","x-description-ar":"نوع الاستئذان، يحدده QHR من الدوام: `late_arrival` تأخير في الحضور (يبدأ مع بداية الدوام)، `early_leave` انصراف مبكر (ينتهي مع نهاية الدوام)، `mid_shift` خروج أثناء الدوام، `flexible` يوم مرن بلا ساعات ثابتة.","enum":["late_arrival","early_leave","mid_shift","flexible"]},"note":{"type":"string","description":"The employee's reason (up to 500 characters).","x-description-ar":"سبب الموظف (حتى ٥٠٠ حرف).","nullable":true},"status":{"type":"string","description":"`pending_manager` (waiting for the employee's manager), `pending_hr` (waiting for HR), `approved`, `rejected`, `cancelled` (by the employee) or `revoked` (an approval taken back).","x-description-ar":"`pending_manager` بانتظار المدير، `pending_hr` بانتظار الموارد البشرية، `approved` مقبول، `rejected` مرفوض، `cancelled` ألغاه الموظف، `revoked` سُحبت الموافقة عليه.","enum":["pending_manager","pending_hr","approved","rejected","cancelled","revoked"]},"approval_route":{"type":"string","description":"Who approves, fixed when the request was filed from the attendance profile: `manager`, `hr`, or `manager_and_hr` (the manager first, then HR).","x-description-ar":"من يوافق، ويُثبَّت عند تقديم الطلب من ملف الحضور: `manager` المدير، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["manager","hr","manager_and_hr"]},"revoke_type":{"type":"string","description":"For a `revoked` request: `withdrawn` (the manager took back their approval before HR decided) or `revoked` (a final approval taken back). Null otherwise.","x-description-ar":"للطلب `revoked`: `withdrawn` تراجع المدير عن موافقته قبل قرار الموارد البشرية، أو `revoked` سُحبت الموافقة النهائية. وإلا null.","nullable":true},"current_approver_name":{"type":"string","description":"Who must decide now: the manager's name, or \"HR\". Null once decided.","x-description-ar":"من عليه القرار الآن: اسم المدير أو «الموارد البشرية». null بعد القرار.","nullable":true},"attachment":{"type":"object","description":"Supporting file, if one was added in the QHR app: `filename`, `content_type`, `byte_size` and a temporary download `url`.","x-description-ar":"المرفق الداعم إن أُضيف من تطبيق QHR: `filename` و`content_type` و`byte_size` ورابط تنزيل مؤقت `url`.","nullable":true},"actions":{"type":"object","description":"What the token owner may do with this request now. `blocked_reason` explains why approve is off for an approver: `payroll_locked` or `incident_decided`.","x-description-ar":"ما يستطيع صاحب الرمز فعله بالطلب الآن. يوضح `blocked_reason` سبب تعذّر الموافقة على من يملك القرار: `payroll_locked` أو `incident_decided`.","properties":{"can_edit":{"type":"boolean","description":"May edit it (`permission_requests.update`).","x-description-ar":"يستطيع تعديله."},"can_cancel":{"type":"boolean","description":"May cancel it (`permission_requests.cancel`).","x-description-ar":"يستطيع إلغاءه."},"can_approve":{"type":"boolean","description":"May approve it (`permission_requests.approve`).","x-description-ar":"يستطيع الموافقة عليه."},"can_reject":{"type":"boolean","description":"May reject it (`permission_requests.reject`).","x-description-ar":"يستطيع رفضه."},"can_withdraw":{"type":"boolean","description":"May withdraw their approval (`permission_requests.withdraw`).","x-description-ar":"يستطيع التراجع عن موافقته."},"can_revoke":{"type":"boolean","description":"May revoke the approval (`permission_requests.revoke`).","x-description-ar":"يستطيع سحب الموافقة."},"blocked_reason":{"type":"string","description":"Why approving is blocked, or null.","x-description-ar":"سبب تعذّر الموافقة، أو null.","nullable":true}}},"manager":{"type":"object","description":"The manager's decision, once they acted.","x-description-ar":"قرار المدير بعد أن يتخذه.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id of the person who acted.","x-description-ar":"رقم موظف من قام بالإجراء.","nullable":true},"name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل.","nullable":true},"acted_at":{"type":"string","description":"When, in UTC.","x-description-ar":"وقت الإجراء بتوقيت UTC.","format":"date-time"},"note":{"type":"string","description":"The note they left.","x-description-ar":"الملاحظة التي كتبها.","nullable":true}}},"hr":{"type":"object","description":"HR's decision, once HR acted.","x-description-ar":"قرار الموارد البشرية بعد اتخاذه.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id of the person who acted.","x-description-ar":"رقم موظف من قام بالإجراء.","nullable":true},"name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل.","nullable":true},"acted_at":{"type":"string","description":"When, in UTC.","x-description-ar":"وقت الإجراء بتوقيت UTC.","format":"date-time"},"note":{"type":"string","description":"The note they left.","x-description-ar":"الملاحظة التي كتبها.","nullable":true}}},"revoked":{"type":"object","description":"Who withdrew or revoked the approval, and why.","x-description-ar":"من تراجع عن الموافقة أو سحبها ولماذا.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id of the person who acted.","x-description-ar":"رقم موظف من قام بالإجراء.","nullable":true},"name":{"type":"string","description":"Their full name.","x-description-ar":"اسمه الكامل.","nullable":true},"acted_at":{"type":"string","description":"When, in UTC.","x-description-ar":"وقت الإجراء بتوقيت UTC.","format":"date-time"},"note":{"type":"string","description":"The note they left.","x-description-ar":"الملاحظة التي كتبها.","nullable":true}}},"cancelled_at":{"type":"string","description":"When the employee cancelled it, in UTC.","x-description-ar":"وقت إلغاء الموظف له بتوقيت UTC.","format":"date-time","nullable":true},"created_at":{"type":"string","description":"When it was filed, in UTC.","x-description-ar":"وقت تقديمه بتوقيت UTC.","format":"date-time"},"attendance_profile":{"type":"object","description":"Only on `permission_requests.show`: the employee's shift that day (`shift_start`, `shift_end`, `day_type`, `flexible`, `scheduled_hours`, `grace_period_minutes`).","x-description-ar":"في `permission_requests.show` فقط: دوام الموظف ذلك اليوم (`shift_start` و`shift_end` و`day_type` و`flexible` و`scheduled_hours` و`grace_period_minutes`)."}}},"permission_request_bulk_input":{"type":"object","required":["ids"],"properties":{"ids":{"type":"array","description":"Permission request ids, up to 100 (extra ids are ignored).","x-description-ar":"أرقام طلبات الاستئذان، حتى ١٠٠ (يُتجاهل ما زاد).","items":{"type":"integer"}},"note":{"type":"string","description":"One note saved on every request decided.","x-description-ar":"ملاحظة واحدة تُحفظ على كل طلب يُبت فيه."}}},"permission_request_bulk_result":{"type":"object","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids decided.","x-description-ar":"الأرقام التي تم البت فيها.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids not decided, each with the reason: `error` (text) and `error_code` (the same codes as the single approve / reject, plus `not_found`).","x-description-ar":"الأرقام التي لم يُبت فيها، مع السبب: `error` نصاً و`error_code` (رموز الموافقة والرفض الفردية نفسها، إضافة إلى `not_found`).","items":{"type":"object","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"error":{"type":"string","description":"Why, in the requested language.","x-description-ar":"السبب بلغة الطلب."},"error_code":{"type":"string","description":"Stable reason code.","x-description-ar":"رمز ثابت للسبب."}}}}}},"permission_request_input":{"type":"object","required":["permission_request"],"properties":{"permission_request":{"type":"object","description":"The window. Times are wall-clock times in the employee's attendance profile timezone.","x-description-ar":"فترة الاستئذان. الأوقات بتوقيت ملف حضور الموظف.","properties":{"date":{"type":"string","description":"The working day, `YYYY-MM-DD`.","x-description-ar":"يوم العمل بالشكل `YYYY-MM-DD`.","format":"date"},"start_time":{"type":"string","description":"Start, `HH:MM` (24-hour).","x-description-ar":"وقت البداية `HH:MM` (نظام ٢٤ ساعة)."},"end_time":{"type":"string","description":"End, `HH:MM`. Must be after the start on the same day (an overnight shift may wrap past midnight).","x-description-ar":"وقت النهاية `HH:MM`. يجب أن يكون بعد البداية في اليوم نفسه (يجوز تجاوز منتصف الليل في الدوام الليلي)."},"note":{"type":"string","description":"Reason, up to 500 characters.","x-description-ar":"السبب، حتى ٥٠٠ حرف."},"remove_attachment":{"type":"boolean","description":"Edit only: `true` removes the attached file.","x-description-ar":"عند التعديل فقط: `true` يحذف المرفق."}}}}},"permission_request_note_input":{"type":"object","properties":{"note":{"type":"string","description":"Note for the employee, up to 500 characters.","x-description-ar":"ملاحظة للموظف، حتى ٥٠٠ حرف."}}},"permission_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/permission_request"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"permission_request_record":{"type":"object","required":["record"],"properties":{"record":{"$ref":"#/components/schemas/permission_request"}}},"role":{"type":"object","description":"A role with every permission it can hold and whether each one is on.","x-description-ar":"دور مع كل صلاحية يمكن أن يحملها وهل هي مفعّلة.","required":["id","name_en","name_ar","name","is_active","is_default","role_type","users_count","permission_groups","role_types"],"properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"is_active":{"type":"boolean","description":"Whether the role can still be given to users.","x-description-ar":"هل يمكن منح الدور لمستخدمين بعد."},"is_default":{"type":"boolean","description":"A built-in role (cannot be renamed, deactivated, retyped or deleted).","x-description-ar":"دور أساسي (لا يمكن تغيير اسمه أو تعطيله أو تغيير فئته أو حذفه)."},"role_type":{"type":"string","description":"The role's tier: `admin` (company-wide administration), `manager` (own team) or `employee` (self-service). It decides which permission groups the role can hold.","x-description-ar":"فئة الدور: `admin` إدارة على مستوى الشركة، `manager` إدارة الفريق، `employee` خدمة ذاتية. تحدد الفئة مجموعات الصلاحيات التي يمكن أن يحملها الدور.","enum":["employee","manager","admin"]},"users_count":{"type":"integer","description":"Active users who hold the role.","x-description-ar":"عدد المستخدمين النشطين الذين يحملون الدور."},"permission_groups":{"type":"array","items":{"$ref":"#/components/schemas/role_permission_group"},"description":"Every permission group available to the role's type.","x-description-ar":"كل مجموعات الصلاحيات المتاحة لفئة الدور."},"role_types":{"type":"array","items":{"$ref":"#/components/schemas/role_type_option"},"description":"The three role types, for a picker.","x-description-ar":"فئات الأدوار الثلاث، لقائمة الاختيار."}}},"role_envelope":{"type":"object","required":["role"],"properties":{"role":{"$ref":"#/components/schemas/role"}}},"role_input":{"type":"object","required":["role"],"properties":{"role":{"type":"object","description":"The role's fields.","x-description-ar":"حقول الدور.","properties":{"name_en":{"type":"string","description":"Name in English, unique in the company.","x-description-ar":"الاسم بالإنجليزية، فريد في الشركة."},"name_ar":{"type":"string","description":"Name in Arabic, unique in the company.","x-description-ar":"الاسم بالعربية، فريد في الشركة."},"role_type":{"type":"string","description":"The role's tier: `admin` (company-wide administration), `manager` (own team) or `employee` (self-service). It decides which permission groups the role can hold.","x-description-ar":"فئة الدور: `admin` إدارة على مستوى الشركة، `manager` إدارة الفريق، `employee` خدمة ذاتية. تحدد الفئة مجموعات الصلاحيات التي يمكن أن يحملها الدور.","enum":["employee","manager","admin"]},"is_active":{"type":"boolean","description":"Whether the role can be given to users. Defaults to true.","x-description-ar":"هل يمكن منح الدور لمستخدمين. الافتراضي true."},"permissions":{"type":"object","description":"Permissions as `{ group_key: { permission_key: true|false } }`, using the keys from `roles.meta_data`. Keys outside the role type's groups are refused.","x-description-ar":"الصلاحيات بصيغة `{ group_key: { permission_key: true|false } }` بالمفاتيح الواردة في `roles.meta_data`. تُرفض المفاتيح التي لا تنتمي إلى مجموعات فئة الدور.","additionalProperties":{"type":"object","additionalProperties":{"type":"boolean"}}}}}}},"role_permission_group":{"type":"object","description":"A permission group (one module of QHR) and each permission in it.","x-description-ar":"مجموعة صلاحيات (وحدة من وحدات QHR) وكل صلاحية فيها.","required":["key","name","permissions"],"properties":{"key":{"type":"string","description":"Group key, e.g. `leave_request`. Used in `permissions` and `permission_groups` bodies.","x-description-ar":"مفتاح المجموعة مثل `leave_request`، ويُستخدم في جسم `permissions` و`permission_groups`."},"name":{"type":"string","description":"Group name in the requested language.","x-description-ar":"اسم المجموعة بلغة الطلب."},"permissions":{"type":"array","description":"The permissions in the group.","x-description-ar":"الصلاحيات في المجموعة.","items":{"type":"object","required":["key","name","enabled"],"properties":{"key":{"type":"string","description":"Permission key, e.g. `approve`.","x-description-ar":"مفتاح الصلاحية مثل `approve`."},"name":{"type":"string","description":"What the permission allows, in the requested language.","x-description-ar":"ما تسمح به الصلاحية، بلغة الطلب."},"hint":{"type":"string","description":"Extra explanation, when there is one.","x-description-ar":"شرح إضافي إن وُجد.","nullable":true},"enabled":{"type":"boolean","description":"Whether the role grants it.","x-description-ar":"هل يمنحها الدور."}}}}}},"role_row":{"type":"object","description":"One role in the list.","x-description-ar":"دور واحد في القائمة.","required":["id","name","is_active","is_default","role_type","users_count"],"properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"is_active":{"type":"boolean","description":"Whether the role can still be given to users. People who already hold a deactivated role keep its permissions.","x-description-ar":"هل يمكن منح الدور لمستخدمين بعد. من يحمل دوراً معطّلاً يحتفظ بصلاحياته."},"is_default":{"type":"boolean","description":"A built-in role QHR creates for every company (Admin, HR Officer, Manager, Employee). It cannot be renamed, deactivated, retyped or deleted.","x-description-ar":"دور أساسي ينشئه QHR لكل شركة (مدير النظام، موظف موارد بشرية، مدير، موظف). لا يمكن تغيير اسمه أو تعطيله أو تغيير فئته أو حذفه."},"role_type":{"type":"string","description":"The role's tier: `admin` (company-wide administration), `manager` (own team) or `employee` (self-service). It decides which permission groups the role can hold.","x-description-ar":"فئة الدور: `admin` إدارة على مستوى الشركة، `manager` إدارة الفريق، `employee` خدمة ذاتية. تحدد الفئة مجموعات الصلاحيات التي يمكن أن يحملها الدور.","enum":["employee","manager","admin"]},"users_count":{"type":"integer","description":"Active users who hold the role.","x-description-ar":"عدد المستخدمين النشطين الذين يحملون الدور."}}},"role_template":{"type":"object","required":["permission_groups","role_types"],"properties":{"permission_groups":{"type":"array","items":{"$ref":"#/components/schemas/role_permission_group"},"description":"Every permission group for the requested type, all off except the defaults.","x-description-ar":"كل مجموعات الصلاحيات للفئة المطلوبة، كلها معطّلة إلا الافتراضية."},"role_types":{"type":"array","items":{"$ref":"#/components/schemas/role_type_option"},"description":"The three role types, for a picker.","x-description-ar":"فئات الأدوار الثلاث، لقائمة الاختيار."}}},"role_type_option":{"type":"object","required":["value","label"],"properties":{"value":{"type":"string","description":"Role type key.","x-description-ar":"مفتاح فئة الدور."},"label":{"type":"string","description":"Role type name in the requested language.","x-description-ar":"اسم فئة الدور بلغة الطلب."}}},"salary":{"type":"object","description":"One salary of an employee, with its allowances, deductions and insurance enrolments.","x-description-ar":"راتب واحد للموظف مع بدلاته واستقطاعاته واشتراكات التأمين.","properties":{"id":{"type":"integer","description":"Salary id.","x-description-ar":"رقم الراتب."},"status":{"type":"string","description":"`active` (the one payroll uses), `inactive` (past or prepared in advance) or `deleted`.","x-description-ar":"`active` النشط الذي يعتمده المسيّر، `inactive` سابق أو مُعدّ مسبقاً، `deleted` محذوف.","enum":["active","inactive","deleted"]},"basic_salary_amount":{"type":"string","description":"Basic salary: a monthly amount, or the hourly rate for `hourly`. Decimal string.","x-description-ar":"الراتب الأساسي: مبلغ شهري، أو أجر الساعة مع `hourly`. نص عشري.","nullable":true},"pay_frequency":{"type":"string","description":"`monthly`, `weekly` or `daily`.","x-description-ar":"`monthly` شهري، `weekly` أسبوعي، `daily` يومي."},"basic_salary_kind":{"type":"string","description":"`fixed` or `hourly`.","x-description-ar":"`fixed` ثابت أو `hourly` بالساعة."},"input_time_type":{"type":"string","description":"Hours payroll pays for: `employed_time` (scheduled) or `worked_time` (attended).","x-description-ar":"الساعات التي يدفع عنها المسيّر: `employed_time` المجدولة، أو `worked_time` الفعلية."},"start_date":{"type":"string","description":"Date the salary applies from.","x-description-ar":"تاريخ بدء سريان الراتب.","format":"date"},"end_date":{"type":"string","description":"Last day it applied; set when a newer salary replaced it.","x-description-ar":"آخر يوم سرى فيه؛ يُعيَّن عندما يحل محله راتب أحدث.","format":"date","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"benefits":{"type":"array","items":{"type":"object","description":"An allowance.","x-description-ar":"بدل.","properties":{"id":{"type":"integer","description":"Line id.","x-description-ar":"رقم البند."},"kind":{"type":"string","description":"`housing`, `transportation`, `counter_inflation` or `other`.","x-description-ar":"`housing` سكن، `transportation` نقل، `counter_inflation` غلاء معيشة، `other` أخرى.","enum":["housing","transportation","counter_inflation","other"]},"calculation_type":{"type":"string","description":"`fixed_monthly` (an amount a month) or `percent_of_basic` (a percentage of the basic salary).","x-description-ar":"`fixed_monthly` مبلغ شهري ثابت، أو `percent_of_basic` نسبة من الراتب الأساسي.","enum":["fixed_monthly","percent_of_basic"]},"amount":{"type":"string","description":"Amount, or the percentage for a percentage type. Decimal string.","x-description-ar":"المبلغ، أو النسبة في الأنواع النسبية. نص عشري."},"description":{"type":"string","description":"Free-text label.","x-description-ar":"وصف حر.","nullable":true},"currency":{"type":"string","description":"Currency for `fixed_monthly`; null for a percentage.","x-description-ar":"العملة مع `fixed_monthly`؛ null مع النسبة.","nullable":true}}},"description":"Allowances paid on top of the basic salary.","x-description-ar":"البدلات المضافة إلى الراتب الأساسي."},"salary_deductions":{"type":"array","items":{"type":"object","description":"A fixed deduction.","x-description-ar":"استقطاع ثابت.","properties":{"id":{"type":"integer","description":"Line id.","x-description-ar":"رقم البند."},"kind":{"type":"string","description":"`fund_contribution` (savings fund) or `other`.","x-description-ar":"`fund_contribution` صندوق ادخار، أو `other` أخرى.","enum":["fund_contribution","other"]},"calculation_type":{"type":"string","description":"`fixed_monthly`, or a percentage of `percent_basic` (basic), `percent_basic_housing`, `percent_basic_housing_transport` or `percent_gross_no_bonus` (gross before bonuses).","x-description-ar":"`fixed_monthly` مبلغ ثابت، أو نسبة من: `percent_basic` الأساسي، `percent_basic_housing` الأساسي والسكن، `percent_basic_housing_transport` الأساسي والسكن والنقل، `percent_gross_no_bonus` الإجمالي قبل المكافآت.","enum":["fixed_monthly","percent_basic","percent_basic_housing","percent_basic_housing_transport","percent_gross_no_bonus"]},"amount":{"type":"string","description":"Amount, or the percentage for a percentage type. Decimal string.","x-description-ar":"المبلغ، أو النسبة في الأنواع النسبية. نص عشري."},"description":{"type":"string","description":"Free-text label.","x-description-ar":"وصف حر.","nullable":true},"currency":{"type":"string","description":"Currency for `fixed_monthly`; null for a percentage.","x-description-ar":"العملة مع `fixed_monthly`؛ null مع النسبة.","nullable":true}}},"description":"Deductions taken every period.","x-description-ar":"استقطاعات تؤخذ كل فترة."},"insurance_deductions":{"type":"array","items":{"$ref":"#/components/schemas/insurance_enrolment"},"description":"Insurance enrolments.","x-description-ar":"اشتراكات التأمين."}}},"salary_input":{"type":"object","description":"Salary fields.","x-description-ar":"حقول الراتب.","properties":{"basic_salary_amount":{"type":"string","description":"Basic salary, decimal string, zero or more.","x-description-ar":"الراتب الأساسي، نص عشري، صفر أو أكثر."},"basic_salary_kind":{"type":"string","description":"`fixed` or `hourly`.","x-description-ar":"`fixed` ثابت أو `hourly` بالساعة.","enum":["fixed","hourly"]},"pay_frequency":{"type":"string","description":"`monthly`, `weekly` or `daily`.","x-description-ar":"`monthly` شهري، `weekly` أسبوعي، `daily` يومي.","enum":["monthly","weekly","daily"]},"input_time_type":{"type":"string","description":"`employed_time` or `worked_time`.","x-description-ar":"`employed_time` المجدولة أو `worked_time` الفعلية.","enum":["employed_time","worked_time"]},"start_date":{"type":"string","description":"Date it applies from. A new active salary must start after the current one.","x-description-ar":"تاريخ بدء السريان. يجب أن يبدأ الراتب النشط الجديد بعد الراتب الحالي.","format":"date"},"benefits_attributes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Existing line id, to change or remove it; omit to add a line.","x-description-ar":"رقم البند الحالي لتعديله أو حذفه؛ أهمله لإضافة بند."},"kind":{"type":"string","description":"`housing`, `transportation`, `counter_inflation` or `other`.","x-description-ar":"`housing` سكن، `transportation` نقل، `counter_inflation` غلاء معيشة، `other` أخرى.","enum":["housing","transportation","counter_inflation","other"]},"calculation_type":{"type":"string","description":"`fixed_monthly` (an amount a month) or `percent_of_basic` (a percentage of the basic salary).","x-description-ar":"`fixed_monthly` مبلغ شهري ثابت، أو `percent_of_basic` نسبة من الراتب الأساسي.","enum":["fixed_monthly","percent_of_basic"]},"amount":{"type":"string","description":"Amount or percentage, decimal string.","x-description-ar":"المبلغ أو النسبة، نص عشري."},"description":{"type":"string","description":"Free-text label, up to 255 characters.","x-description-ar":"وصف حر حتى ٢٥٥ حرفاً."},"_destroy":{"type":"boolean","description":"`true` with `id` removes the line.","x-description-ar":"`true` مع `id` يحذف البند."}}},"description":"Allowances to add, change or remove.","x-description-ar":"بدلات للإضافة أو التعديل أو الحذف."},"salary_deductions_attributes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Existing line id, to change or remove it; omit to add a line.","x-description-ar":"رقم البند الحالي لتعديله أو حذفه؛ أهمله لإضافة بند."},"kind":{"type":"string","description":"`fund_contribution` (savings fund) or `other`.","x-description-ar":"`fund_contribution` صندوق ادخار، أو `other` أخرى.","enum":["fund_contribution","other"]},"calculation_type":{"type":"string","description":"`fixed_monthly`, or a percentage of `percent_basic` (basic), `percent_basic_housing`, `percent_basic_housing_transport` or `percent_gross_no_bonus` (gross before bonuses).","x-description-ar":"`fixed_monthly` مبلغ ثابت، أو نسبة من: `percent_basic` الأساسي، `percent_basic_housing` الأساسي والسكن، `percent_basic_housing_transport` الأساسي والسكن والنقل، `percent_gross_no_bonus` الإجمالي قبل المكافآت.","enum":["fixed_monthly","percent_basic","percent_basic_housing","percent_basic_housing_transport","percent_gross_no_bonus"]},"amount":{"type":"string","description":"Amount or percentage, decimal string.","x-description-ar":"المبلغ أو النسبة، نص عشري."},"description":{"type":"string","description":"Free-text label, up to 255 characters.","x-description-ar":"وصف حر حتى ٢٥٥ حرفاً."},"_destroy":{"type":"boolean","description":"`true` with `id` removes the line.","x-description-ar":"`true` مع `id` يحذف البند."}}},"description":"Fixed deductions to add, change or remove.","x-description-ar":"استقطاعات ثابتة للإضافة أو التعديل أو الحذف."}}},"support_message":{"type":"object","description":"One entry in the conversation.","x-description-ar":"مُدخل واحد في المحادثة.","properties":{"id":{"type":"integer","description":"Message id; pass the last one as `after_id` to poll for newer ones.","x-description-ar":"رقم الرسالة؛ أرسل آخر رقم في `after_id` لجلب الأحدث فقط."},"kind":{"type":"string","description":"`customer` (written by your company), `support` (written by QHR support) or `system` (an event).","x-description-ar":"`customer` كتبتها شركتك، `support` كتبها دعم QHR، `system` حدث آلي.","enum":["customer","support","system"]},"body":{"type":"string","description":"Text; null for an event or a message with files only.","x-description-ar":"النص؛ null للحدث أو لرسالة فيها ملفات فقط.","nullable":true},"event_type":{"type":"string","description":"For an event: `request_received`, `status_changed` or `type_changed`.","x-description-ar":"للحدث: `request_received` استلام الطلب، `status_changed` تغيّر الحالة، `type_changed` تغيّر النوع.","nullable":true},"event_data":{"type":"object","description":"Event details, e.g. `{ \"from\": \"new\", \"to\": \"resolved\", \"actor\": \"customer\" }`.","x-description-ar":"تفاصيل الحدث، مثل `{ \"from\": \"new\", \"to\": \"resolved\", \"actor\": \"customer\" }`."},"author":{"type":"object","nullable":true,"description":"Who wrote it; null for an event.","x-description-ar":"كاتبها؛ null للحدث.","properties":{"name":{"type":"string","description":"Author's name (\"QHR Support\" for the team).","x-description-ar":"اسم الكاتب (\"QHR Support\" للفريق).","nullable":true}}},"attachments":{"type":"array","description":"Files attached to it.","x-description-ar":"الملفات المرفقة بها.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Attachment id.","x-description-ar":"رقم المرفق."},"filename":{"type":"string","description":"File name.","x-description-ar":"اسم الملف."},"content_type":{"type":"string","description":"Media type.","x-description-ar":"نوع الملف."},"byte_size":{"type":"integer","description":"Size in bytes.","x-description-ar":"الحجم بالبايت."},"url":{"type":"string","description":"Temporary download link.","x-description-ar":"رابط تنزيل مؤقت."},"url_expires_at":{"type":"string","description":"When the link stops working.","x-description-ar":"متى يتوقف الرابط عن العمل.","format":"date-time"}}}},"created_at":{"type":"string","description":"When it was written.","x-description-ar":"وقت كتابتها.","format":"date-time"}}},"support_request":{"type":"object","description":"One support request with its whole conversation.","x-description-ar":"طلب دعم مع محادثته كاملة.","properties":{"id":{"type":"integer","description":"Support request id.","x-description-ar":"رقم طلب الدعم."},"reference":{"type":"string","description":"Reference to quote to QHR, e.g. `SUP-1057`.","x-description-ar":"المرجع الذي تذكره لـ QHR، مثل `SUP-1057`."},"request_type":{"type":"string","description":"`problem`, `feature_request`, `question` or `other`.","x-description-ar":"`problem` مشكلة، `feature_request` اقتراح ميزة، `question` سؤال، `other` أخرى.","enum":["problem","feature_request","question","other"]},"title":{"type":"string","description":"Title.","x-description-ar":"العنوان."},"status":{"type":"string","description":"`new` (not picked up yet), `in_progress`, `waiting_for_customer` (support asked you something) or `resolved`.","x-description-ar":"`new` لم يُستلم بعد، `in_progress` قيد المعالجة، `waiting_for_customer` ينتظر ردك، `resolved` مغلق.","enum":["new","in_progress","waiting_for_customer","resolved"]},"created_at":{"type":"string","description":"When it was raised.","x-description-ar":"وقت رفعه.","format":"date-time"},"last_activity_at":{"type":"string","description":"Last change you can see.","x-description-ar":"آخر تغيير ظاهر لك.","format":"date-time","nullable":true},"resolved_at":{"type":"string","description":"When it was resolved; null while open.","x-description-ar":"وقت إغلاقه؛ null ما دام مفتوحاً.","format":"date-time","nullable":true},"requester":{"type":"object","description":"Who raised it (the token owner).","x-description-ar":"من رفعه (صاحب الرمز).","properties":{"id":{"type":"integer","description":"User id.","x-description-ar":"رقم المستخدم."},"name":{"type":"string","description":"Name.","x-description-ar":"الاسم."}}},"company":{"type":"object","description":"The company.","x-description-ar":"الشركة.","properties":{"id":{"type":"integer","description":"Company id.","x-description-ar":"رقم الشركة."},"name":{"type":"string","description":"Company name.","x-description-ar":"اسم الشركة."}}},"origin_path":{"type":"string","description":"QHR page it was raised from.","x-description-ar":"صفحة QHR التي رُفع منها.","nullable":true},"messages":{"type":"array","items":{"$ref":"#/components/schemas/support_message"},"description":"The conversation, oldest first.","x-description-ar":"المحادثة، الأقدم أولاً."}}},"support_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/support_request_row"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"support_request_row":{"type":"object","description":"One support request in the list.","x-description-ar":"طلب دعم واحد في القائمة.","properties":{"id":{"type":"integer","description":"Support request id.","x-description-ar":"رقم طلب الدعم."},"reference":{"type":"string","description":"Reference to quote to QHR, e.g. `SUP-1057`.","x-description-ar":"المرجع الذي تذكره لـ QHR، مثل `SUP-1057`."},"request_type":{"type":"string","description":"`problem`, `feature_request`, `question` or `other`.","x-description-ar":"`problem` مشكلة، `feature_request` اقتراح ميزة، `question` سؤال، `other` أخرى.","enum":["problem","feature_request","question","other"]},"title":{"type":"string","description":"Title.","x-description-ar":"العنوان."},"status":{"type":"string","description":"`new` (not picked up yet), `in_progress`, `waiting_for_customer` (support asked you something) or `resolved`.","x-description-ar":"`new` لم يُستلم بعد، `in_progress` قيد المعالجة، `waiting_for_customer` ينتظر ردك، `resolved` مغلق.","enum":["new","in_progress","waiting_for_customer","resolved"]},"created_at":{"type":"string","description":"When it was raised.","x-description-ar":"وقت رفعه.","format":"date-time"},"last_activity_at":{"type":"string","description":"Last change you can see.","x-description-ar":"آخر تغيير ظاهر لك.","format":"date-time","nullable":true},"resolved_at":{"type":"string","description":"When it was resolved; null while open.","x-description-ar":"وقت إغلاقه؛ null ما دام مفتوحاً.","format":"date-time","nullable":true},"last_message":{"type":"object","nullable":true,"description":"The latest entry, for a preview.","x-description-ar":"آخر مُدخل، للمعاينة.","properties":{"kind":{"type":"string","description":"`customer`, `support` or `system`.","x-description-ar":"`customer` أو `support` أو `system`."},"preview":{"type":"string","description":"Start of the text.","x-description-ar":"بداية النص.","nullable":true},"event_type":{"type":"string","description":"Event type, for an event.","x-description-ar":"نوع الحدث، للحدث.","nullable":true},"created_at":{"type":"string","description":"When.","x-description-ar":"الوقت.","format":"date-time"}}}}},"support_request_summary":{"type":"object","description":"The request's current state.","x-description-ar":"حالة الطلب الحالية.","properties":{"status":{"type":"string","description":"`new` (not picked up yet), `in_progress`, `waiting_for_customer` (support asked you something) or `resolved`.","x-description-ar":"`new` لم يُستلم بعد، `in_progress` قيد المعالجة، `waiting_for_customer` ينتظر ردك، `resolved` مغلق.","enum":["new","in_progress","waiting_for_customer","resolved"]},"request_type":{"type":"string","description":"`problem`, `feature_request`, `question` or `other`.","x-description-ar":"`problem` مشكلة، `feature_request` اقتراح ميزة، `question` سؤال، `other` أخرى.","enum":["problem","feature_request","question","other"]},"last_activity_at":{"type":"string","description":"Last change you can see.","x-description-ar":"آخر تغيير ظاهر لك.","format":"date-time","nullable":true},"resolved_at":{"type":"string","description":"When it was resolved; null while open.","x-description-ar":"وقت إغلاقه؛ null ما دام مفتوحاً.","format":"date-time","nullable":true}}},"team_leave_availability":{"type":"object","required":["data"],"properties":{"data":{"type":"array","description":"One entry per day, starting today.","x-description-ar":"عنصر لكل يوم بدءاً من اليوم.","items":{"type":"object","properties":{"date":{"type":"string","description":"The day.","x-description-ar":"اليوم.","format":"date"},"total":{"type":"integer","description":"Team members (direct reports still at work).","x-description-ar":"عدد أعضاء الفريق (المرؤوسون المباشرون العاملون)."},"on_leave":{"type":"integer","description":"Of them, on approved leave that day.","x-description-ar":"عدد من هم منهم في إجازة موافق عليها ذلك اليوم."},"available":{"type":"integer","description":"Of them, not on leave that day.","x-description-ar":"عدد غير المجازين منهم ذلك اليوم."},"working_day":{"type":"boolean","description":"True when at least one team member works that day (not a weekend or holiday for all).","x-description-ar":"صحيح إن كان يوم عمل لعضو واحد على الأقل من الفريق (ليس عطلة للجميع)."}}}}}},"team_leave_pending_request":{"type":"object","description":"One leave request waiting for a decision.","x-description-ar":"طلب إجازة واحد ينتظر قراراً.","properties":{"id":{"type":"integer","description":"Leave request id, for `leave_requests.show`, `leave_requests.approve` and `leave_requests.reject`.","x-description-ar":"رقم طلب الإجازة، لـ `leave_requests.show` و`leave_requests.approve` و`leave_requests.reject`."},"employee_id":{"type":"integer","description":"Id of the employee taking the leave.","x-description-ar":"رقم الموظف صاحب الإجازة."},"employee_no":{"type":"string","description":"Their employee number.","x-description-ar":"رقمه الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Their full name, in the requested language.","x-description-ar":"اسمه الكامل بلغة الطلب."},"employee_image":{"type":"string","description":"Reserved; always null for now.","x-description-ar":"محجوز؛ دائماً null حالياً.","nullable":true},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request charges, as a decimal string.","x-description-ar":"أيام العمل التي يخصمها الطلب، كنص عشري."},"leave_type_name":{"type":"string","description":"Leave category name (Annual, Sick…).","x-description-ar":"اسم فئة الإجازة (سنوية، مرضية…)."},"compensation_type":{"type":"string","description":"`fully_paid`, `tiered_pay` or `unpaid`.","x-description-ar":"`fully_paid` أو `tiered_pay` أو `unpaid`.","nullable":true},"compensation_type_label":{"type":"string","description":"The same, translated.","x-description-ar":"الشيء نفسه مترجماً.","nullable":true},"submission_date":{"type":"string","description":"When it was submitted, in UTC.","x-description-ar":"وقت التقديم بتوقيت UTC.","format":"date-time"},"current_stage":{"type":"string","description":"`awaiting_manager`, `awaiting_hr` or `cancellation_review` (the employee asked to cancel an approved leave).","x-description-ar":"`awaiting_manager` أو `awaiting_hr` أو `cancellation_review` (طلب الموظف إلغاء إجازة موافق عليها)."},"can_act":{"type":"boolean","description":"True when you can decide it now. False when it waits for HR, or for another manager.","x-description-ar":"صحيح إن كان بإمكانك البت فيه الآن. خطأ إن كان ينتظر الموارد البشرية أو مديراً آخر."},"approver_actions":{"$ref":"#/components/schemas/leave_request_approver_actions"}}},"team_leave_pending_requests":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/team_leave_pending_request"},"description":"Every waiting request (not paginated).","x-description-ar":"كل الطلبات المنتظرة (بلا تقسيم صفحات)."}}},"team_leave_policies":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"The report's active leave policies.","x-description-ar":"سياسات الإجازة المفعّلة للموظف المرؤوس.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave policy id, to send as `leave_policy_id`.","x-description-ar":"رقم سياسة الإجازة، يُرسل في `leave_policy_id`."},"name":{"type":"string","description":"Policy name, in the requested language.","x-description-ar":"اسم السياسة بلغة الطلب."},"available_balance":{"type":"number","description":"Days the report has left this year under this policy.","x-description-ar":"الأيام المتبقية للموظف هذه السنة في هذه السياسة."},"requires_document":{"type":"boolean","description":"True when a supporting document is required — such leave cannot be filed through the open API (JSON only).","x-description-ar":"صحيح إن كان المستند الداعم إلزامياً — ولا يمكن تقديم هذه الإجازة عبر الواجهة المفتوحة (JSON فقط)."},"allow_past_dates":{"type":"boolean","description":"True when the leave may start in the past.","x-description-ar":"صحيح إن جاز أن تبدأ الإجازة في الماضي."},"approver":{"type":"string","description":"Where a filed request lands: `manager` (approved at once), `manager_and_hr` (waits for HR) or `hr` (waits for HR).","x-description-ar":"أين يذهب الطلب بعد تقديمه: `manager` يُعتمد فوراً، `manager_and_hr` ينتظر الموارد البشرية، `hr` ينتظر الموارد البشرية.","enum":["manager","manager_and_hr","hr"]}}}}}},"team_leave_stat_cards":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The cards above the manager's approvals page.","x-description-ar":"البطاقات أعلى صفحة موافقات المدير.","properties":{"team_members":{"type":"integer","description":"Direct reports still at work (active or in their notice period).","x-description-ar":"المرؤوسون المباشرون الذين ما زالوا يعملون (نشطون أو في فترة الإشعار)."},"on_leave_today":{"type":"integer","description":"Of those, how many are on approved leave today.","x-description-ar":"عدد من هم منهم في إجازة موافق عليها اليوم."},"available":{"type":"integer","description":"Team members at work today.","x-description-ar":"أعضاء الفريق الحاضرون اليوم."},"requests_waiting":{"type":"integer","description":"Leave requests waiting for a decision: your team's, plus any escalated to you.","x-description-ar":"طلبات الإجازة التي تنتظر قراراً: طلبات فريقك، إضافة إلى ما صُعّد إليك."},"requires_my_action":{"type":"integer","description":"Of those, how many you can decide yourself now.","x-description-ar":"عدد ما يمكنك أنت البت فيه الآن منها."}}}}},"team_loan_row":{"type":"object","description":"A loan a manager requested for a team member.","x-description-ar":"سلفة طلبها مدير لأحد أعضاء فريقه.","properties":{"id":{"type":"integer","description":"Loan id.","x-description-ar":"رقم السلفة."},"reference":{"type":"string","description":"Loan reference, e.g. `LON-0042`.","x-description-ar":"مرجع السلفة، مثل `LON-0042`."},"status":{"type":"string","description":"Status: `pending` (waiting for HR), `pending_accounting` (HR approved, an accountant in Qoyod is deciding), `approved` (lent, nothing repaid yet), `repaying` (installments being collected), `pending_settlement` (a settlement waits for the accountant), `settled` (paid back), `rejected` or `cancelled`.","x-description-ar":"الحالة: `pending` بانتظار الموارد البشرية، `pending_accounting` اعتمدتها الموارد البشرية ومحاسب في قيود يقرر، `approved` صُرفت ولم يُسدَّد شيء، `repaying` تُحصَّل أقساطها، `pending_settlement` تسوية بانتظار المحاسب، `settled` سُدّدت، `rejected` مرفوضة، `cancelled` ملغاة.","enum":["pending","pending_accounting","approved","repaying","pending_settlement","settled","rejected","cancelled"]},"channel":{"type":"string","description":"How the money moves, chosen by HR at approval: `payroll` (paid out on a payslip and repaid in monthly installments deducted from pay) or `direct` (paid out and repaid in one payment outside payroll). Null until approved.","x-description-ar":"طريقة حركة المال التي تختارها الموارد البشرية عند الاعتماد: `payroll` تُصرف في القسيمة وتُسدَّد بأقساط شهرية تُستقطع من الراتب، أو `direct` تُصرف وتُسدَّد دفعة واحدة خارج الرواتب. null قبل الاعتماد.","enum":["payroll","direct",null],"nullable":true},"installments_count":{"type":"integer","description":"Number of installments (payroll loans).","x-description-ar":"عدد الأقساط (للسلفة عبر الرواتب).","nullable":true},"currency":{"type":"string","description":"The employee's pay currency, ISO code.","x-description-ar":"عملة راتب الموظف برمز ISO."},"amount":{"type":"string","description":"Amount lent. Decimal string.","x-description-ar":"مبلغ السلفة. نص عشري."},"needed_on":{"type":"string","description":"Date the employee needs the money.","x-description-ar":"التاريخ الذي يحتاج فيه الموظف المال.","format":"date","nullable":true},"submitted_at":{"type":"string","description":"When it was requested, ISO 8601 UTC.","x-description-ar":"وقت الطلب، ISO 8601 بتوقيت UTC."},"installments_remaining":{"type":"integer","description":"Installments still to collect; null before approval.","x-description-ar":"الأقساط المتبقية؛ null قبل الاعتماد.","nullable":true},"outstanding":{"type":"string","description":"Still owed. Decimal string.","x-description-ar":"المتبقي على الموظف. نص عشري."},"repayment":{"type":"object","nullable":true,"description":"Where a direct loan's single repayment stands; null for a payroll loan or one not approved.","x-description-ar":"موقف السداد الوحيد للسلفة المباشرة؛ null للسلفة عبر الرواتب أو غير المعتمدة.","properties":{"due_on":{"type":"string","description":"Repayment due date.","x-description-ar":"تاريخ استحقاق السداد.","format":"date","nullable":true},"repaid_on":{"type":"string","description":"Date it was repaid.","x-description-ar":"تاريخ السداد.","format":"date","nullable":true},"state":{"type":"string","description":"`not_due`, `due_soon` (within 3 days), `overdue`, `paid_early`, `paid_on_time` or `paid_late`.","x-description-ar":"`not_due` لم يحن، `due_soon` خلال ٣ أيام، `overdue` متأخر، `paid_early` سُدّد مبكراً، `paid_on_time` في موعده، `paid_late` متأخراً."},"days":{"type":"integer","description":"Days to, past or early/late against the due date, by `state`.","x-description-ar":"عدد الأيام حسب `state`."}}},"editable":{"type":"boolean","description":"True while it can be changed (`pending`).","x-description-ar":"صحيح ما دام قابلاً للتعديل (`pending`)."},"cancellable":{"type":"boolean","description":"True while it can be withdrawn (`pending`).","x-description-ar":"صحيح ما دام قابلاً للإلغاء (`pending`)."},"employee":{"type":"object","nullable":true,"description":"The borrower.","x-description-ar":"المستفيد.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"submitted_by":{"type":"object","nullable":true,"description":"Who requested it.","x-description-ar":"من طلبها.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}}}},"termination_package":{"type":"object","description":"A termination package in full: the frozen calculation, the money, what happened on approval and what may be done next.","x-description-ar":"تسوية نهاية الخدمة كاملة: الحساب المجمّد والمبالغ وما ترتب على الاعتماد وما يمكن فعله بعدها.","properties":{"id":{"type":"integer","description":"Package id.","x-description-ar":"رقم التسوية."},"reference":{"type":"string","description":"Reference, e.g. `EOS-0041`.","x-description-ar":"المرجع، مثل `EOS-0041`."},"status":{"type":"string","description":"`draft` (saved calculation, nothing happened yet), `pending_accounting` (confirmed, waiting for the accountant in Qoyod), `declined` (refused by accounting, editable again), `paid` (approved and the payout recorded) or `cancelled`.","x-description-ar":"`draft` مسودة محفوظة لم يترتب عليها شيء، `pending_accounting` معتمدة بانتظار المحاسب في قيود، `declined` رفضتها المحاسبة وعادت قابلة للتعديل، `paid` اعتُمدت وسُجّل صرفها، `cancelled` ملغاة.","enum":["draft","pending_accounting","declined","paid","cancelled"]},"status_label_en":{"type":"string","description":"Status in English.","x-description-ar":"الحالة بالإنجليزية."},"status_label_ar":{"type":"string","description":"Status in Arabic.","x-description-ar":"الحالة بالعربية."},"include_last_payroll":{"type":"boolean","description":"True when the final partial month is paid in the package (and the employee is kept off the payroll run for it); false when payroll pays it.","x-description-ar":"صحيح إذا صُرف الشهر الأخير ضمن التسوية (ويُستبعد الموظف من مسيّره)، وخطأ إذا صرفه المسيّر."},"employee":{"type":"object","description":"The leaving employee.","x-description-ar":"الموظف المغادر.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية.","nullable":true},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"employment_status":{"type":"string","description":"Employment status key (`active`, `notice_period`, `inactive`).","x-description-ar":"مفتاح حالة التوظيف (`active`، `notice_period`، `inactive`)."}}},"last_working_day":{"type":"string","description":"Last working day.","x-description-ar":"آخر يوم عمل.","format":"date"},"payment_date":{"type":"string","description":"Date the package is paid.","x-description-ar":"تاريخ صرف التسوية.","format":"date"},"compensation_total":{"type":"string","description":"What the employee is owed (HR's figure when overridden).","x-description-ar":"ما يستحقه الموظف (رقم الموارد البشرية عند التعديل اليدوي)."},"offsets_total":{"type":"string","description":"Loans, deductions and custody taken off.","x-description-ar":"السلف والاستقطاعات والعهد المخصومة."},"net_payout":{"type":"string","description":"What is paid: compensation minus offsets.","x-description-ar":"الصافي المصروف: المستحقات ناقص الخصومات."},"currency":{"type":"string","description":"Currency, ISO code.","x-description-ar":"العملة برمز ISO."},"has_override":{"type":"boolean","description":"True when HR entered a total different from the calculated one.","x-description-ar":"صحيح إذا أدخلت الموارد البشرية إجمالياً يختلف عن المحسوب."},"payment_status":{"type":"string","description":"Whether the payout is recorded.","x-description-ar":"هل سُجّل الصرف.","nullable":true},"accounting":{"type":"object","description":"`mode` (`legacy`, or `approval` when an accountant must approve in Qoyod) and `gate`.","x-description-ar":"`mode` (`legacy`، أو `approval` عندما يجب أن يوافق محاسب في قيود) و`gate`.","nullable":true},"created_at":{"type":"string","description":"When it was created, UTC ISO 8601.","x-description-ar":"وقت الإنشاء بتوقيت UTC بصيغة ISO 8601."},"reason":{"$ref":"#/components/schemas/termination_reason"},"computed_compensation_total":{"type":"string","description":"What QHR calculated.","x-description-ar":"ما احتسبه QHR."},"override":{"type":"object","description":"When overridden: `computed`, `entered`, `variance`, `reason`.","x-description-ar":"عند التعديل اليدوي: `computed` و`entered` و`variance` و`reason`.","nullable":true},"payment":{"type":"object","description":"The recorded payout: `id`, `reference`, `kind`, `purpose`, `date`, `amount`.","x-description-ar":"الصرف المسجّل: `id` و`reference` و`kind` و`purpose` و`date` و`amount`.","nullable":true},"breakdown":{"type":"object","description":"The calculation frozen when saved: `service` (tenure), `wage_base`, `gratuity` (award and tier), `leave_encashment`, `final_salary`, `bonuses`, `deductions`, `loans`, `custody`, `totals`.","x-description-ar":"الحساب المجمّد عند الحفظ: `service` مدة الخدمة، `wage_base` الأجر، `gratuity` المكافأة وشريحتها، `leave_encashment` بدل الإجازات، `final_salary` الراتب الأخير، `bonuses` و`deductions` و`loans` و`custody` و`totals` الإجماليات."},"custody":{"type":"array","description":"Custody whose value is deducted from the package.","x-description-ar":"العهد التي تُخصم قيمتها من التسوية.","items":{"type":"object"}},"held_custody":{"type":"array","description":"Assets still held, to be acknowledged at confirm.","x-description-ar":"أصول ما زالت لدى الموظف، يُقَرّ بها عند الاعتماد.","items":{"type":"object"}},"calculated_at":{"type":"string","description":"When the figures were calculated.","x-description-ar":"وقت احتساب الأرقام."},"confirmed_at":{"type":"string","description":"When it was confirmed.","x-description-ar":"وقت الاعتماد.","nullable":true},"approved_at":{"type":"string","description":"When it became final.","x-description-ar":"وقت اعتمادها نهائياً.","nullable":true},"paid_at":{"type":"string","description":"When the payout was recorded.","x-description-ar":"وقت تسجيل الصرف.","nullable":true},"cancelled_at":{"type":"string","description":"When it was cancelled.","x-description-ar":"وقت الإلغاء.","nullable":true},"created_by":{"type":"object","description":"Who created it.","x-description-ar":"من أنشأها.","nullable":true},"confirmed_by":{"type":"object","description":"Who confirmed it.","x-description-ar":"من اعتمدها.","nullable":true},"stale":{"type":"boolean","description":"True when the employee's data changed since the calculation; recalculate before confirming.","x-description-ar":"صحيح إذا تغيّرت بيانات الموظف بعد الحساب؛ أعد الحساب قبل الاعتماد."},"stale_reasons":{"type":"array","description":"What changed.","x-description-ar":"ما الذي تغيّر.","items":{"type":"object"}},"blockers":{"type":"array","description":"What prevents confirming (`code`, `message`).","x-description-ar":"ما يمنع الاعتماد (`code` و`message`).","items":{"type":"object"}},"decisions_outstanding":{"type":"integer","description":"Accounting decisions still awaited.","x-description-ar":"قرارات المحاسبة المنتظرة.","nullable":true},"loan_settlements":{"type":"array","description":"The loans this package settles.","x-description-ar":"السلف التي تسويها هذه التسوية.","items":{"type":"object"}},"effects":{"type":"object","description":"After confirmation: new employment status, offboarding record, cancelled leave, settled loans, claimed bonuses and deductions, custody, and the payment created.","x-description-ar":"بعد الاعتماد: حالة التوظيف الجديدة وسجل إنهاء الخدمة والإجازات الملغاة والسلف المسوّاة والمكافآت والاستقطاعات المحتسبة والعهد والدفعة المنشأة.","nullable":true},"actions":{"type":"object","description":"What may be done now: `can_edit`, `can_recalculate`, `can_confirm`, `can_cancel`.","x-description-ar":"ما يمكن فعله الآن: `can_edit` و`can_recalculate` و`can_confirm` و`can_cancel`."}}},"termination_package_row":{"type":"object","description":"A termination package in a list, without its calculation.","x-description-ar":"تسوية نهاية خدمة في قائمة، بدون تفاصيل الحساب.","properties":{"id":{"type":"integer","description":"Package id.","x-description-ar":"رقم التسوية."},"reference":{"type":"string","description":"Reference, e.g. `EOS-0041`.","x-description-ar":"المرجع، مثل `EOS-0041`."},"status":{"type":"string","description":"`draft` (saved calculation, nothing happened yet), `pending_accounting` (confirmed, waiting for the accountant in Qoyod), `declined` (refused by accounting, editable again), `paid` (approved and the payout recorded) or `cancelled`.","x-description-ar":"`draft` مسودة محفوظة لم يترتب عليها شيء، `pending_accounting` معتمدة بانتظار المحاسب في قيود، `declined` رفضتها المحاسبة وعادت قابلة للتعديل، `paid` اعتُمدت وسُجّل صرفها، `cancelled` ملغاة.","enum":["draft","pending_accounting","declined","paid","cancelled"]},"status_label_en":{"type":"string","description":"Status in English.","x-description-ar":"الحالة بالإنجليزية."},"status_label_ar":{"type":"string","description":"Status in Arabic.","x-description-ar":"الحالة بالعربية."},"include_last_payroll":{"type":"boolean","description":"True when the final partial month is paid in the package (and the employee is kept off the payroll run for it); false when payroll pays it.","x-description-ar":"صحيح إذا صُرف الشهر الأخير ضمن التسوية (ويُستبعد الموظف من مسيّره)، وخطأ إذا صرفه المسيّر."},"employee":{"type":"object","description":"The leaving employee.","x-description-ar":"الموظف المغادر.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية.","nullable":true},"department":{"type":"string","description":"Department.","x-description-ar":"القسم.","nullable":true},"employment_status":{"type":"string","description":"Employment status key (`active`, `notice_period`, `inactive`).","x-description-ar":"مفتاح حالة التوظيف (`active`، `notice_period`، `inactive`)."}}},"last_working_day":{"type":"string","description":"Last working day.","x-description-ar":"آخر يوم عمل.","format":"date"},"payment_date":{"type":"string","description":"Date the package is paid.","x-description-ar":"تاريخ صرف التسوية.","format":"date"},"compensation_total":{"type":"string","description":"What the employee is owed (HR's figure when overridden).","x-description-ar":"ما يستحقه الموظف (رقم الموارد البشرية عند التعديل اليدوي)."},"offsets_total":{"type":"string","description":"Loans, deductions and custody taken off.","x-description-ar":"السلف والاستقطاعات والعهد المخصومة."},"net_payout":{"type":"string","description":"What is paid: compensation minus offsets.","x-description-ar":"الصافي المصروف: المستحقات ناقص الخصومات."},"currency":{"type":"string","description":"Currency, ISO code.","x-description-ar":"العملة برمز ISO."},"has_override":{"type":"boolean","description":"True when HR entered a total different from the calculated one.","x-description-ar":"صحيح إذا أدخلت الموارد البشرية إجمالياً يختلف عن المحسوب."},"payment_status":{"type":"string","description":"Whether the payout is recorded.","x-description-ar":"هل سُجّل الصرف.","nullable":true},"accounting":{"type":"object","description":"`mode` (`legacy`, or `approval` when an accountant must approve in Qoyod) and `gate`.","x-description-ar":"`mode` (`legacy`، أو `approval` عندما يجب أن يوافق محاسب في قيود) و`gate`.","nullable":true},"created_at":{"type":"string","description":"When it was created, UTC ISO 8601.","x-description-ar":"وقت الإنشاء بتوقيت UTC بصيغة ISO 8601."},"reason":{"type":"object","description":"The reason: `id`, `code`, `name_en`, `name_ar`.","x-description-ar":"السبب: `id` و`code` و`name_en` و`name_ar`."},"payment":{"type":"object","description":"The recorded payout: `reference`, `date`, `amount`.","x-description-ar":"الصرف المسجّل: `reference` و`date` و`amount`.","nullable":true},"created_by":{"type":"object","description":"Who created it: `id`, `name`.","x-description-ar":"من أنشأها: `id` و`name`.","nullable":true}}},"termination_reason":{"type":"object","description":"A reason an employment can end, as the Ministry of Human Resources lists it.","x-description-ar":"سبب لانتهاء علاقة العمل كما تدرجه وزارة الموارد البشرية.","properties":{"id":{"type":"integer","description":"Ministry reason id (there is no 8 or 10).","x-description-ar":"رقم السبب لدى الوزارة (لا يوجد 8 ولا 10)."},"code":{"type":"string","description":"Stable key, e.g. `resignation`, `contract_expiry`, `article_80`.","x-description-ar":"مفتاح ثابت، مثل `resignation` و`contract_expiry` و`article_80`."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"payout_class":{"type":"string","description":"Effect on the award: `full`, `none` (e.g. Article 80) or `tiered` (resignation: none under 2 years, one third 2–5, two thirds 5–10, full from 10).","x-description-ar":"أثره على المكافأة: `full` كاملة، `none` لا شيء (مثل المادة ٨٠)، `tiered` متدرجة للاستقالة (لا شيء قبل سنتين، الثلث من ٢ إلى ٥، الثلثان من ٥ إلى ١٠، كاملة من ١٠ سنوات).","enum":["full","none","tiered"]}}},"ticket":{"type":"object","description":"A request with everything on its details page. After an action that leaves the caller unable to see the request any more, only `id` and `status` come back.","x-description-ar":"طلب بكل ما في صفحة تفاصيله. وبعد إجراء يُفقد صاحب الرمز إمكانية رؤية الطلب يعود `id` و`status` فقط.","required":["id","status"],"properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"reference":{"type":"string","description":"Reference people quote, e.g. `TKT-000123`.","x-description-ar":"المرجع الذي يتداوله الناس، مثل `TKT-000123`."},"subject":{"type":"string","description":"Subject the requester wrote (up to 120 characters).","x-description-ar":"العنوان الذي كتبه مقدّم الطلب (حتى ١٢٠ حرفاً)."},"status":{"type":"string","description":"Where the request is: `pending_manager` (waiting for the direct manager), `pending_hr` (waiting for HR), `open` (approved, in the department queue, nobody on it yet), `assigned` (given to someone who has not accepted yet), `in_progress` (someone is working on it), `in_review` (done, waiting for the requester to confirm), `closed`, `rejected` or `cancelled` (the last three are final).","x-description-ar":"مكان الطلب الآن: `pending_manager` بانتظار المدير المباشر، `pending_hr` بانتظار الموارد البشرية، `open` معتمد وفي قائمة القسم ولم يستلمه أحد، `assigned` أُسند إلى شخص لم يقبله بعد، `in_progress` قيد التنفيذ، `in_review` أُنجز وينتظر تأكيد مقدّم الطلب، `closed` مغلق، `rejected` مرفوض، `cancelled` ملغي (الثلاث الأخيرة نهائية).","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]},"priority":{"type":"string","description":"Priority: `low`, `medium`, `high` or `highest`. Set by the request type; only HR changes it.","x-description-ar":"الأولوية: `low` منخفضة، `medium` متوسطة، `high` عالية، `highest` قصوى. يحددها نوع الطلب ولا يغيرها إلا الموارد البشرية.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department has to finish once the request is approved.","x-description-ar":"عدد الأيام المتاحة للقسم لإنجاز الطلب بعد اعتماده."},"type":{"type":"object","description":"The request type.","x-description-ar":"نوع الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"category":{"type":"object","description":"The type's category, with its `icon` and `color`.","x-description-ar":"فئة النوع مع `icon` و`color`.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة."},"color":{"type":"string","description":"Colour key; null for the default colour.","x-description-ar":"مفتاح اللون؛ null للون الافتراضي.","nullable":true}}},"department":{"type":"object","description":"The department handling the request.","x-description-ar":"القسم الذي يعالج الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"requester":{"type":"object","description":"Who raised the request.","x-description-ar":"مقدّم الطلب.","nullable":false,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"assignee":{"type":"object","description":"Who is working on it; null while nobody is.","x-description-ar":"من يعمل عليه؛ null ما دام لم يُسند لأحد.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"due_on":{"type":"string","description":"Due date: set when the request is approved (approval day + `target_days`); HR can move it.","x-description-ar":"تاريخ الاستحقاق: يُحدد عند اعتماد الطلب (يوم الاعتماد + `target_days`) ويمكن للموارد البشرية تغييره.","format":"date","nullable":true},"overdue":{"type":"boolean","description":"True when it is `open`, `assigned` or `in_progress` and past its due date.","x-description-ar":"صحيح إن كان `open` أو `assigned` أو `in_progress` وتجاوز تاريخ الاستحقاق."},"last_activity_at":{"type":"string","description":"Last time anything happened on it, UTC.","x-description-ar":"آخر نشاط عليه بتوقيت UTC.","format":"date-time"},"created_at":{"type":"string","description":"When it was submitted, UTC.","x-description-ar":"وقت تقديمه بتوقيت UTC.","format":"date-time"},"available_actions":{"type":"array","description":"What the token's owner may do on this request now, as the operation's last word: `approve`, `reject`, `take`, `assign`, `accept`, `reject_work`, `send_for_review`, `send_back`, `close`, `cancel`, `priority`, `due_date` (e.g. `take` → `tickets.take`). Check it before calling a member action.","x-description-ar":"ما يستطيع صاحب الرمز فعله على هذا الطلب الآن، باسم العملية: `approve` و`reject` و`take` و`assign` و`accept` و`reject_work` و`send_for_review` و`send_back` و`close` و`cancel` و`priority` و`due_date` (مثلاً `take` ← `tickets.take`). تحقق منه قبل استدعاء أي إجراء على الطلب.","items":{"type":"string"}},"description":{"type":"string","description":"Free text the requester added (up to 5,000 characters).","x-description-ar":"نص حر أضافه مقدّم الطلب (حتى ٥٠٠٠ حرف).","nullable":true},"approval_flow":{"type":"string","description":"Approvals the request goes through, copied from its type at submission: `none`, `manager`, `hr` or `manager_and_hr`.","x-description-ar":"الموافقات التي يمر بها الطلب، منسوخة من نوعه عند التقديم: `none` بدون، `manager` المدير المباشر، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["none","manager","hr","manager_and_hr"]},"opened_at":{"type":"string","description":"When it entered the department queue (approved), UTC.","x-description-ar":"وقت دخوله قائمة القسم (اعتماده) بتوقيت UTC.","format":"date-time","nullable":true},"assigned_at":{"type":"string","description":"When it was last taken or assigned, UTC.","x-description-ar":"آخر وقت استُلم فيه أو أُسند بتوقيت UTC.","format":"date-time","nullable":true},"review_started_at":{"type":"string","description":"When it was sent for review, UTC.","x-description-ar":"وقت إرساله للمراجعة بتوقيت UTC.","format":"date-time","nullable":true},"auto_close_on":{"type":"string","description":"While in review: the day it closes by itself if the requester does nothing.","x-description-ar":"أثناء المراجعة: اليوم الذي يُغلق فيه تلقائياً إن لم يتصرف مقدّم الطلب.","format":"date","nullable":true},"closed_at":{"type":"string","description":"When it reached a final status, UTC.","x-description-ar":"وقت وصوله إلى حالة نهائية بتوقيت UTC.","format":"date-time","nullable":true},"manager_approval":{"type":"object","description":"The direct manager's decision; null until they decide.","x-description-ar":"قرار المدير المباشر؛ null حتى يقرر.","nullable":true,"properties":{"approver":{"type":"object","description":"Who decided.","x-description-ar":"صاحب القرار.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"acted_at":{"type":"string","description":"When, UTC.","x-description-ar":"وقت القرار بتوقيت UTC.","format":"date-time"}}},"hr_approval":{"type":"object","description":"HR's decision; null until HR decides.","x-description-ar":"قرار الموارد البشرية؛ null حتى تقرر.","nullable":true,"properties":{"approver":{"type":"object","description":"Who decided.","x-description-ar":"صاحب القرار.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"acted_at":{"type":"string","description":"When, UTC.","x-description-ar":"وقت القرار بتوقيت UTC.","format":"date-time"}}},"answers":{"type":"array","description":"The form as submitted, one entry per field of the type's form at that time.","x-description-ar":"النموذج كما قُدّم، عنصر لكل حقل من حقول نموذج النوع وقت التقديم.","items":{"type":"object","properties":{"key":{"type":"string","description":"Field key.","x-description-ar":"مفتاح الحقل."},"type":{"type":"string","description":"Field type (`short_text`, `long_text`, `number`, `date`, `date_range`, `select`, `multi_select`, `checkbox`, `file`, `employee`).","x-description-ar":"نوع الحقل (`short_text` و`long_text` و`number` و`date` و`date_range` و`select` و`multi_select` و`checkbox` و`file` و`employee`)."},"label_en":{"type":"string","description":"Label in English.","x-description-ar":"التسمية بالإنجليزية."},"label_ar":{"type":"string","description":"Label in Arabic.","x-description-ar":"التسمية بالعربية."},"label":{"type":"string","description":"Label in the requested language.","x-description-ar":"التسمية بلغة الطلب."},"width":{"type":"integer","description":"Layout width on a 12-column grid (12, 6 or 4).","x-description-ar":"العرض في شبكة من ١٢ عموداً (12 أو 6 أو 4)."},"options":{"type":"array","description":"Choices of a `select` / `multi_select` field.","x-description-ar":"خيارات حقل `select` / `multi_select`.","items":{"type":"object"}},"value":{"description":"The answer: text, number, `YYYY-MM-DD`, `{ from, to }`, an option key or keys, true/false, or `{ id, name }` for an employee field. Null when not answered or a file field.","x-description-ar":"الإجابة: نص أو رقم أو `YYYY-MM-DD` أو `{ from, to }` أو مفتاح خيار أو أكثر أو true/false أو `{ id, name }` لحقل الموظف. null إن لم يُجب أو كان الحقل ملفاً.","nullable":true},"files":{"type":"array","description":"Files of a `file` field.","x-description-ar":"ملفات حقل `file`.","items":{"type":"object","description":"An attached file.","x-description-ar":"ملف مرفق.","properties":{"id":{"type":"integer","description":"File id.","x-description-ar":"رقم الملف."},"name":{"type":"string","description":"File name.","x-description-ar":"اسم الملف."},"url":{"type":"string","description":"Temporary download link.","x-description-ar":"رابط تنزيل مؤقت."},"size":{"type":"integer","description":"Size in bytes.","x-description-ar":"الحجم بالبايت."},"content_type":{"type":"string","description":"`application/pdf`, `image/jpeg` or `image/png`.","x-description-ar":"`application/pdf` أو `image/jpeg` أو `image/png`."}}}}}}},"progress":{"type":"array","description":"The progress tracker: `submitted`, then `manager` / `hr` as the flow needs, `department`, `target`. `state` is `done`, `current`, `failed` (it ended there) or `pending`.","x-description-ar":"شريط التقدم: `submitted` ثم `manager` / `hr` حسب مسار الموافقة ثم `department` ثم `target`. `state` إما `done` منجزة أو `current` الحالية أو `failed` توقف عندها أو `pending` لاحقة.","items":{"type":"object","properties":{"step":{"type":"string","description":"Step key.","x-description-ar":"مفتاح الخطوة."},"state":{"type":"string","description":"Step state.","x-description-ar":"حالة الخطوة.","enum":["done","current","failed","pending"]},"label":{"type":"string","description":"Label to show.","x-description-ar":"التسمية المعروضة."},"actor":{"type":"object","description":"Who acted at this step.","x-description-ar":"من تصرّف في هذه الخطوة.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"at":{"type":"string","description":"When (a date for `target`).","x-description-ar":"متى (تاريخ لخطوة `target`).","nullable":true},"note":{"type":"string","description":"Extra note.","x-description-ar":"ملاحظة إضافية.","nullable":true}}}},"can_view_conversation":{"type":"boolean","description":"True when the owner may read the conversation (`ticket_comments.list`).","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع قراءة المحادثة (`ticket_comments.list`)."},"can_comment":{"type":"boolean","description":"True when the owner may post (`ticket_comments.create`).","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع الكتابة (`ticket_comments.create`)."},"requester_active":{"type":"boolean","description":"False when the requester has left the company; HR may then close the request.","x-description-ar":"خطأ إن غادر مقدّم الطلب الشركة؛ وحينها تستطيع الموارد البشرية إغلاق الطلب."}}},"ticket_approval_bulk_result":{"type":"object","description":"What happened to each id: the batch is not all-or-nothing.","x-description-ar":"نتيجة كل رقم على حدة: الدفعة لا تُنفَّذ كلها أو لا شيء.","required":["succeeded","failed"],"properties":{"succeeded":{"type":"array","description":"Ids decided.","x-description-ar":"الأرقام التي اتُّخذ فيها القرار.","items":{"type":"integer"}},"failed":{"type":"array","description":"Ids not decided, each with the reason.","x-description-ar":"الأرقام التي لم يُتخذ فيها القرار مع السبب.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"error":{"type":"string","description":"Why, in the requested language.","x-description-ar":"السبب بلغة الطلب."}}}}}},"ticket_approval_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_approval_row"},"description":"The waiting requests on this page, oldest first.","x-description-ar":"الطلبات المنتظرة في هذه الصفحة، الأقدم أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"ticket_approval_row":{"description":"A request waiting on the caller's decision.","x-description-ar":"طلب ينتظر قرار صاحب الرمز.","allOf":[{"$ref":"#/components/schemas/ticket_row"},{"type":"object","properties":{"stage":{"type":"string","description":"The stage it waits in: `manager` (you are the requester's direct manager) or `hr`.","x-description-ar":"المرحلة التي ينتظر فيها: `manager` (أنت المدير المباشر لمقدّم الطلب) أو `hr` الموارد البشرية.","enum":["manager","hr"]}}}]},"ticket_catalog":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_catalog_category"},"description":"The catalog, category by category.","x-description-ar":"الدليل فئةً فئة."}}},"ticket_catalog_category":{"type":"object","description":"An enabled category and its enabled request types.","x-description-ar":"فئة مفعّلة مع أنواع الطلبات المفعّلة فيها.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة.","enum":["laptop","file-text","building","wallet","scale","users","tool","shield","car","globe"]},"color":{"type":"string","description":"Colour key; null for the default.","x-description-ar":"مفتاح اللون؛ null للون الافتراضي.","enum":["blue","purple","gold","green","cyan","red"],"nullable":true},"position":{"type":"integer","description":"Display order.","x-description-ar":"ترتيب العرض."},"enabled":{"type":"boolean","description":"Always true here.","x-description-ar":"صحيح دائماً هنا."},"types":{"type":"array","items":{"$ref":"#/components/schemas/ticket_catalog_type"},"description":"Its enabled request types, in display order (never empty).","x-description-ar":"أنواع الطلبات المفعّلة فيها بترتيب العرض (لا تكون فارغة)."}}},"ticket_catalog_employee_list":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"At most 20 employees, by name.","x-description-ar":"حتى ٢٠ موظفاً مرتبين بالاسم.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Employee id; the answer to an `employee` form field.","x-description-ar":"رقم الموظف؛ وهو الإجابة عن حقل من نوع `employee`."},"name":{"type":"string","description":"Full name in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Department name.","x-description-ar":"اسم القسم.","nullable":true}}}}}},"ticket_catalog_type":{"type":"object","description":"A request type the employee can raise, with the form to fill in.","x-description-ar":"نوع طلب يستطيع الموظف تقديمه مع النموذج المطلوب تعبئته.","properties":{"id":{"type":"integer","description":"Request type id; send it as `ticket_type_id` to `tickets.create`.","x-description-ar":"رقم نوع الطلب؛ أرسله في `ticket_type_id` إلى `tickets.create`."},"ticket_category_id":{"type":"integer","description":"Its category.","x-description-ar":"فئته."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"description_en":{"type":"string","description":"Description in English.","x-description-ar":"الوصف بالإنجليزية.","nullable":true},"description_ar":{"type":"string","description":"Description in Arabic.","x-description-ar":"الوصف بالعربية.","nullable":true},"description":{"type":"string","description":"Description in the requested language; null when blank.","x-description-ar":"الوصف بلغة الطلب؛ null إن كان فارغاً.","nullable":true},"department":{"$ref":"#/components/schemas/ticket_type_department"},"approval_flow":{"type":"string","description":"Who approves before the department starts: `none`, `manager` (direct manager), `hr` or `manager_and_hr`.","x-description-ar":"من يعتمد قبل أن يبدأ القسم: `none` بلا اعتماد، `manager` المدير المباشر، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["none","manager","hr","manager_and_hr"]},"default_priority":{"type":"string","description":"Priority the request starts with.","x-description-ar":"الأولوية التي يبدأ بها الطلب.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department has to finish, from approval.","x-description-ar":"عدد الأيام المتاحة للقسم للإنجاز بعد الاعتماد."},"position":{"type":"integer","description":"Display order inside the category.","x-description-ar":"ترتيب العرض داخل الفئة."},"enabled":{"type":"boolean","description":"Always true here.","x-description-ar":"صحيح دائماً هنا."},"form_fields":{"type":"array","items":{"$ref":"#/components/schemas/ticket_type_form_field"},"description":"The form, in order. Answer each field by its `key` in `answers` of `tickets.create`.","x-description-ar":"النموذج بالترتيب. أجب عن كل حقل بمفتاحه `key` في `answers` ضمن `tickets.create`."}}},"ticket_category":{"type":"object","description":"A request category: a heading of the request catalog.","x-description-ar":"فئة طلبات: عنوان من عناوين دليل الطلبات.","properties":{"id":{"type":"integer","description":"Category id.","x-description-ar":"رقم الفئة."},"name_en":{"type":"string","description":"Name in English, unique.","x-description-ar":"الاسم بالإنجليزية، فريد."},"name_ar":{"type":"string","description":"Name in Arabic, unique.","x-description-ar":"الاسم بالعربية، فريد."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"icon":{"type":"string","description":"Icon shown next to the category: `laptop`, `file-text`, `building`, `wallet`, `scale`, `users`, `tool`, `shield`, `car` or `globe`.","x-description-ar":"الأيقونة الظاهرة بجانب الفئة: `laptop` أو `file-text` أو `building` أو `wallet` أو `scale` أو `users` أو `tool` أو `shield` أو `car` أو `globe`.","enum":["laptop","file-text","building","wallet","scale","users","tool","shield","car","globe"]},"color":{"type":"string","description":"Colour of the category: `blue`, `purple`, `gold`, `green`, `cyan` or `red`; null for the default.","x-description-ar":"لون الفئة: `blue` أو `purple` أو `gold` أو `green` أو `cyan` أو `red`؛ null للون الافتراضي.","enum":["blue","purple","gold","green","cyan","red"],"nullable":true},"position":{"type":"integer","description":"Display order, from 0.","x-description-ar":"ترتيب العرض، يبدأ من 0."},"enabled":{"type":"boolean","description":"Shown in the request catalog. A disabled category hides all its types.","x-description-ar":"ظاهرة في دليل الطلبات. الفئة المعطّلة تخفي كل أنواعها."},"types_count":{"type":"integer","description":"Request types in the category, enabled or not.","x-description-ar":"عدد أنواع الطلبات في الفئة، مفعّلة أو لا."},"deletable":{"type":"boolean","description":"True while none of its request types has ever been used by a request; a used category can only be disabled.","x-description-ar":"صحيح ما دام لم يُستخدم أي نوع من أنواعها في طلب؛ الفئة المستخدمة يمكن تعطيلها فقط."}}},"ticket_category_input":{"type":"object","required":["ticket_category"],"properties":{"ticket_category":{"type":"object","description":"The category's fields. On update, only the fields you send change.","x-description-ar":"حقول الفئة. عند التعديل تتغير الحقول المرسلة فقط.","properties":{"name_en":{"type":"string","description":"Name in English, required and unique.","x-description-ar":"الاسم بالإنجليزية، مطلوب وفريد."},"name_ar":{"type":"string","description":"Name in Arabic, required and unique.","x-description-ar":"الاسم بالعربية، مطلوب وفريد."},"icon":{"type":"string","description":"Icon, required. Icon shown next to the category: `laptop`, `file-text`, `building`, `wallet`, `scale`, `users`, `tool`, `shield`, `car` or `globe`.","x-description-ar":"الأيقونة، مطلوبة. الأيقونة الظاهرة بجانب الفئة: `laptop` أو `file-text` أو `building` أو `wallet` أو `scale` أو `users` أو `tool` أو `shield` أو `car` أو `globe`.","enum":["laptop","file-text","building","wallet","scale","users","tool","shield","car","globe"]},"color":{"type":"string","description":"Colour of the category: `blue`, `purple`, `gold`, `green`, `cyan` or `red`; null for the default.","x-description-ar":"لون الفئة: `blue` أو `purple` أو `gold` أو `green` أو `cyan` أو `red`؛ null للون الافتراضي.","enum":["blue","purple","gold","green","cyan","red"],"nullable":true},"enabled":{"type":"boolean","description":"Show it in the request catalog. True when omitted on create.","x-description-ar":"إظهارها في دليل الطلبات. صحيح إن لم يُرسل عند الإنشاء."}}}}},"ticket_category_list":{"type":"object","required":["records"],"description":"Every request category, in display order.","x-description-ar":"كل فئات الطلبات بترتيب العرض.","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_category"},"description":"The categories.","x-description-ar":"الفئات."}}},"ticket_comment":{"type":"object","description":"One message of a request's conversation.","x-description-ar":"رسالة واحدة في محادثة الطلب.","properties":{"id":{"type":"integer","description":"Comment id.","x-description-ar":"رقم التعليق."},"body":{"type":"string","description":"The message (up to 5,000 characters).","x-description-ar":"نص الرسالة (حتى ٥٠٠٠ حرف)."},"author":{"type":"object","description":"Who wrote it.","x-description-ar":"كاتبها.","nullable":false,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"files":{"type":"array","description":"Attached files.","x-description-ar":"الملفات المرفقة.","items":{"type":"object","description":"An attached file.","x-description-ar":"ملف مرفق.","properties":{"id":{"type":"integer","description":"File id.","x-description-ar":"رقم الملف."},"name":{"type":"string","description":"File name.","x-description-ar":"اسم الملف."},"url":{"type":"string","description":"Temporary download link.","x-description-ar":"رابط تنزيل مؤقت."},"size":{"type":"integer","description":"Size in bytes.","x-description-ar":"الحجم بالبايت."},"content_type":{"type":"string","description":"`application/pdf`, `image/jpeg` or `image/png`.","x-description-ar":"`application/pdf` أو `image/jpeg` أو `image/png`."}}}},"created_at":{"type":"string","description":"When, UTC.","x-description-ar":"الوقت بتوقيت UTC.","format":"date-time"}}},"ticket_comment_list":{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_comment"},"description":"The conversation, oldest first unless `sort=desc`.","x-description-ar":"المحادثة، الأقدم أولاً ما لم يُرسل `sort=desc`."}}},"ticket_event_list":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"Activity entries, newest first.","x-description-ar":"سجلات النشاط، الأحدث أولاً.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Entry id.","x-description-ar":"رقم السجل."},"event":{"type":"string","description":"What happened: `submitted`, `routed_to_hr`, `manager_approved`, `manager_rejected`, `hr_approved`, `hr_rejected`, `assigned`, `reassigned`, `accepted`, `rejected`, `sent_for_review`, `sent_back`, `closed`, `auto_closed`, `closed_by_hr`, `cancelled`, `priority_changed`, `due_date_changed`, `returned_to_queue`.","x-description-ar":"ما حدث: `submitted` و`routed_to_hr` و`manager_approved` و`manager_rejected` و`hr_approved` و`hr_rejected` و`assigned` و`reassigned` و`accepted` و`rejected` و`sent_for_review` و`sent_back` و`closed` و`auto_closed` و`closed_by_hr` و`cancelled` و`priority_changed` و`due_date_changed` و`returned_to_queue`."},"data":{"type":"object","description":"Details of the event: `reason`, `assignee_id` / `assignee_name`, `from` / `to`, `auto_close_on`…","x-description-ar":"تفاصيل الحدث: `reason` و`assignee_id` / `assignee_name` و`from` / `to` و`auto_close_on`…"},"actor":{"type":"object","description":"Who did it; null for QHR itself (routing to HR, auto-close).","x-description-ar":"من قام به؛ null إن كان QHR نفسه (التحويل إلى الموارد البشرية، الإغلاق التلقائي).","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"created_at":{"type":"string","description":"When, UTC.","x-description-ar":"الوقت بتوقيت UTC.","format":"date-time"}}}}}},"ticket_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_row"},"description":"The requests on this page.","x-description-ar":"الطلبات في هذه الصفحة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"ticket_row":{"type":"object","description":"One request in a list.","x-description-ar":"طلب واحد في قائمة.","properties":{"id":{"type":"integer","description":"Request id.","x-description-ar":"رقم الطلب."},"reference":{"type":"string","description":"Reference people quote, e.g. `TKT-000123`.","x-description-ar":"المرجع الذي يتداوله الناس، مثل `TKT-000123`."},"subject":{"type":"string","description":"Subject the requester wrote (up to 120 characters).","x-description-ar":"العنوان الذي كتبه مقدّم الطلب (حتى ١٢٠ حرفاً)."},"status":{"type":"string","description":"Where the request is: `pending_manager` (waiting for the direct manager), `pending_hr` (waiting for HR), `open` (approved, in the department queue, nobody on it yet), `assigned` (given to someone who has not accepted yet), `in_progress` (someone is working on it), `in_review` (done, waiting for the requester to confirm), `closed`, `rejected` or `cancelled` (the last three are final).","x-description-ar":"مكان الطلب الآن: `pending_manager` بانتظار المدير المباشر، `pending_hr` بانتظار الموارد البشرية، `open` معتمد وفي قائمة القسم ولم يستلمه أحد، `assigned` أُسند إلى شخص لم يقبله بعد، `in_progress` قيد التنفيذ، `in_review` أُنجز وينتظر تأكيد مقدّم الطلب، `closed` مغلق، `rejected` مرفوض، `cancelled` ملغي (الثلاث الأخيرة نهائية).","enum":["pending_manager","pending_hr","open","assigned","in_progress","in_review","closed","rejected","cancelled"]},"priority":{"type":"string","description":"Priority: `low`, `medium`, `high` or `highest`. Set by the request type; only HR changes it.","x-description-ar":"الأولوية: `low` منخفضة، `medium` متوسطة، `high` عالية، `highest` قصوى. يحددها نوع الطلب ولا يغيرها إلا الموارد البشرية.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department has to finish once the request is approved.","x-description-ar":"عدد الأيام المتاحة للقسم لإنجاز الطلب بعد اعتماده."},"type":{"type":"object","description":"The request type.","x-description-ar":"نوع الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"category":{"type":"object","description":"The type's category, with its `icon` and `color`.","x-description-ar":"فئة النوع مع `icon` و`color`.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"icon":{"type":"string","description":"Icon key.","x-description-ar":"مفتاح الأيقونة."},"color":{"type":"string","description":"Colour key; null for the default colour.","x-description-ar":"مفتاح اللون؛ null للون الافتراضي.","nullable":true}}},"department":{"type":"object","description":"The department handling the request.","x-description-ar":"القسم الذي يعالج الطلب.","properties":{"id":{"type":"integer","description":"Id.","x-description-ar":"الرقم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."}}},"requester":{"type":"object","description":"Who raised the request.","x-description-ar":"مقدّم الطلب.","nullable":false,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"assignee":{"type":"object","description":"Who is working on it; null while nobody is.","x-description-ar":"من يعمل عليه؛ null ما دام لم يُسند لأحد.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name, in the requested language.","x-description-ar":"الاسم الكامل بلغة الطلب."},"department_name":{"type":"string","description":"Their department.","x-description-ar":"قسمه.","nullable":true}}},"due_on":{"type":"string","description":"Due date: set when the request is approved (approval day + `target_days`); HR can move it.","x-description-ar":"تاريخ الاستحقاق: يُحدد عند اعتماد الطلب (يوم الاعتماد + `target_days`) ويمكن للموارد البشرية تغييره.","format":"date","nullable":true},"overdue":{"type":"boolean","description":"True when it is `open`, `assigned` or `in_progress` and past its due date.","x-description-ar":"صحيح إن كان `open` أو `assigned` أو `in_progress` وتجاوز تاريخ الاستحقاق."},"last_activity_at":{"type":"string","description":"Last time anything happened on it, UTC.","x-description-ar":"آخر نشاط عليه بتوقيت UTC.","format":"date-time"},"created_at":{"type":"string","description":"When it was submitted, UTC.","x-description-ar":"وقت تقديمه بتوقيت UTC.","format":"date-time"},"available_actions":{"type":"array","description":"What the token's owner may do on this request now, as the operation's last word: `approve`, `reject`, `take`, `assign`, `accept`, `reject_work`, `send_for_review`, `send_back`, `close`, `cancel`, `priority`, `due_date` (e.g. `take` → `tickets.take`). Check it before calling a member action.","x-description-ar":"ما يستطيع صاحب الرمز فعله على هذا الطلب الآن، باسم العملية: `approve` و`reject` و`take` و`assign` و`accept` و`reject_work` و`send_for_review` و`send_back` و`close` و`cancel` و`priority` و`due_date` (مثلاً `take` ← `tickets.take`). تحقق منه قبل استدعاء أي إجراء على الطلب.","items":{"type":"string"}}}},"ticket_type":{"type":"object","description":"A request type, with its form, approval flow and handling department.","x-description-ar":"نوع طلب مع نموذجه ومسار اعتماده والقسم المنفّذ له.","properties":{"id":{"type":"integer","description":"Request type id.","x-description-ar":"رقم نوع الطلب."},"ticket_category_id":{"type":"integer","description":"Its category.","x-description-ar":"فئته."},"name_en":{"type":"string","description":"Name in English, unique in the category.","x-description-ar":"الاسم بالإنجليزية، فريد داخل الفئة."},"name_ar":{"type":"string","description":"Name in Arabic, unique in the category.","x-description-ar":"الاسم بالعربية، فريد داخل الفئة."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"description_en":{"type":"string","description":"Description in English.","x-description-ar":"الوصف بالإنجليزية.","nullable":true},"description_ar":{"type":"string","description":"Description in Arabic.","x-description-ar":"الوصف بالعربية.","nullable":true},"description":{"type":"string","description":"Description in the requested language; null when blank.","x-description-ar":"الوصف بلغة الطلب؛ null إن كان فارغاً.","nullable":true},"department":{"$ref":"#/components/schemas/ticket_type_department"},"approval_flow":{"type":"string","description":"Who approves a request before the department works on it: `none` (goes straight to the department), `manager` (the requester's direct manager), `hr` (HR) or `manager_and_hr` (the manager, then HR).","x-description-ar":"من يعتمد الطلب قبل أن يعمل عليه القسم: `none` يذهب مباشرة إلى القسم، `manager` المدير المباشر لمقدّم الطلب، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["none","manager","hr","manager_and_hr"]},"default_priority":{"type":"string","description":"Priority a new request gets: `low`, `medium`, `high` or `highest`. HR can change it per request later.","x-description-ar":"الأولوية التي يأخذها الطلب الجديد: `low` منخفضة، `medium` متوسطة، `high` عالية، `highest` عاجلة. تستطيع الموارد البشرية تغييرها لكل طلب لاحقاً.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department has to finish, counted from approval; sets the request's due date.","x-description-ar":"عدد الأيام المتاحة للقسم لإنجاز الطلب محسوبة من الاعتماد؛ ومنها يُحدَّد تاريخ الاستحقاق.","minimum":1},"position":{"type":"integer","description":"Display order inside the category, from 0.","x-description-ar":"ترتيب العرض داخل الفئة، يبدأ من 0."},"enabled":{"type":"boolean","description":"Offered in the request catalog.","x-description-ar":"معروض في دليل الطلبات."},"form_fields":{"type":"array","items":{"$ref":"#/components/schemas/ticket_type_form_field"},"description":"The form employees fill in, in order (at most 30 fields).","x-description-ar":"النموذج الذي يعبئه الموظفون بالترتيب (٣٠ حقلاً على الأكثر)."},"tickets_count":{"type":"integer","description":"Requests ever raised with this type.","x-description-ar":"عدد الطلبات المقدَّمة بهذا النوع منذ إنشائه."},"deletable":{"type":"boolean","description":"True while no request uses it; a used type can only be disabled.","x-description-ar":"صحيح ما دام لا يستخدمه أي طلب؛ النوع المستخدم يمكن تعطيله فقط."}}},"ticket_type_department":{"type":"object","description":"The department that handles requests of this type.","x-description-ar":"القسم الذي ينفّذ طلبات هذا النوع.","properties":{"id":{"type":"integer","description":"Department id.","x-description-ar":"رقم القسم."},"name_en":{"type":"string","description":"Name in English.","x-description-ar":"الاسم بالإنجليزية."},"name_ar":{"type":"string","description":"Name in Arabic.","x-description-ar":"الاسم بالعربية."},"name":{"type":"string","description":"Name in the requested language.","x-description-ar":"الاسم بلغة الطلب."},"active_employee_count":{"type":"integer","description":"Employed people in the department, who can take its requests.","x-description-ar":"عدد الموظفين على رأس العمل في القسم، وهم من يستطيعون استلام طلباته."}}},"ticket_type_form_field":{"type":"object","description":"One field of a request type's form. The employee's answer is sent in `answers[\u003ckey\u003e]` of `tickets.create`.","x-description-ar":"حقل واحد في نموذج نوع الطلب. تُرسل إجابة الموظف في `answers[\u003ckey\u003e]` ضمن `tickets.create`.","required":["key","type","label_en","label_ar","width"],"properties":{"key":{"type":"string","description":"Field key, unique in the form: letters, digits, `-` and `_`, up to 40.","x-description-ar":"مفتاح الحقل، فريد في النموذج: حروف وأرقام و`-` و`_`، حتى ٤٠ حرفاً."},"type":{"type":"string","description":"Field type: `short_text`, `long_text`, `number`, `date`, `date_range`, `select`, `multi_select`, `checkbox`, `file` (PDF, JPG or PNG) or `employee` (a colleague, picked with `ticket_catalog.employees`).","x-description-ar":"نوع الحقل: `short_text` نص قصير، `long_text` نص طويل، `number` رقم، `date` تاريخ، `date_range` فترة، `select` اختيار واحد، `multi_select` اختيارات متعددة، `checkbox` مربع اختيار، `file` ملف (PDF أو JPG أو PNG)، `employee` زميل يُختار عبر `ticket_catalog.employees`.","enum":["short_text","long_text","number","date","date_range","select","multi_select","checkbox","file","employee"]},"label_en":{"type":"string","description":"Label in English.","x-description-ar":"التسمية بالإنجليزية."},"label_ar":{"type":"string","description":"Label in Arabic.","x-description-ar":"التسمية بالعربية."},"help_en":{"type":"string","description":"Help text in English.","x-description-ar":"نص المساعدة بالإنجليزية.","nullable":true},"help_ar":{"type":"string","description":"Help text in Arabic.","x-description-ar":"نص المساعدة بالعربية.","nullable":true},"required":{"type":"boolean","description":"The employee must answer it.","x-description-ar":"يجب على الموظف الإجابة عنه."},"width":{"type":"integer","description":"Width on a 12-column grid: 12 (full), 6 (half) or 4 (third).","x-description-ar":"العرض في شبكة من ١٢ عموداً: 12 كامل، 6 نصف، 4 ثلث.","enum":[12,6,4]},"options":{"type":"array","description":"The choices, for `select` and `multi_select` only (at least one, keys unique).","x-description-ar":"الخيارات، لحقلي `select` و`multi_select` فقط (خيار واحد على الأقل بمفاتيح فريدة).","items":{"type":"object","required":["key","label_en","label_ar"],"properties":{"key":{"type":"string","description":"Option key; the value the answer carries.","x-description-ar":"مفتاح الخيار، وهو القيمة التي تحملها الإجابة."},"label_en":{"type":"string","description":"Option label in English.","x-description-ar":"تسمية الخيار بالإنجليزية."},"label_ar":{"type":"string","description":"Option label in Arabic.","x-description-ar":"تسمية الخيار بالعربية."}}}},"validation":{"type":"object","description":"Rules checked on the answer: `min` / `max` for `number`, `max_length` for text, `file_types` and `max_size_mb` for `file`. A rule on another field type is refused.","x-description-ar":"قواعد تُطبَّق على الإجابة: `min` و`max` للرقم، و`max_length` للنص، و`file_types` و`max_size_mb` للملف. أي قاعدة على نوع حقل آخر تُرفض.","properties":{"min":{"type":"number","description":"Smallest number allowed.","x-description-ar":"أصغر رقم مسموح."},"max":{"type":"number","description":"Largest number allowed, not below `min`.","x-description-ar":"أكبر رقم مسموح، لا يقل عن `min`."},"max_length":{"type":"integer","description":"Most characters allowed.","x-description-ar":"أقصى عدد من الأحرف."},"max_size_mb":{"type":"number","description":"Largest file, in MB, at most 10.","x-description-ar":"أكبر حجم للملف بالميغابايت، ١٠ على الأكثر."},"file_types":{"type":"array","items":{"type":"string","enum":["pdf","jpg","png"]},"description":"File types accepted: `pdf`, `jpg`, `png`.","x-description-ar":"أنواع الملفات المقبولة: `pdf` و`jpg` و`png`."}}}}},"ticket_type_input":{"type":"object","required":["ticket_type"],"properties":{"ticket_type":{"type":"object","description":"The type's fields. On update, only the fields you send change; `form_fields`, when sent, replaces the whole form.","x-description-ar":"حقول النوع. عند التعديل تتغير الحقول المرسلة فقط؛ و`form_fields` إن أُرسل يستبدل النموذج كاملاً.","properties":{"ticket_category_id":{"type":"integer","description":"Category, from `ticket_categories.list`; required. Moving a type to another category puts it last there.","x-description-ar":"الفئة، من `ticket_categories.list`؛ مطلوبة. نقل النوع إلى فئة أخرى يضعه في آخرها."},"name_en":{"type":"string","description":"Name in English, required, unique in the category.","x-description-ar":"الاسم بالإنجليزية، مطلوب وفريد داخل الفئة."},"name_ar":{"type":"string","description":"Name in Arabic, required, unique in the category.","x-description-ar":"الاسم بالعربية، مطلوب وفريد داخل الفئة."},"description_en":{"type":"string","description":"Description in English.","x-description-ar":"الوصف بالإنجليزية."},"description_ar":{"type":"string","description":"Description in Arabic.","x-description-ar":"الوصف بالعربية."},"department_id":{"type":"integer","description":"Department that handles the work, required; id from `employees.meta_data` (`departments`).","x-description-ar":"القسم الذي ينفّذ العمل، مطلوب؛ الرقم من `employees.meta_data` (`departments`)."},"approval_flow":{"type":"string","description":"Who approves a request before the department works on it: `none` (goes straight to the department), `manager` (the requester's direct manager), `hr` (HR) or `manager_and_hr` (the manager, then HR).","x-description-ar":"من يعتمد الطلب قبل أن يعمل عليه القسم: `none` يذهب مباشرة إلى القسم، `manager` المدير المباشر لمقدّم الطلب، `hr` الموارد البشرية، `manager_and_hr` المدير ثم الموارد البشرية.","enum":["none","manager","hr","manager_and_hr"]},"default_priority":{"type":"string","description":"Priority a new request gets: `low`, `medium`, `high` or `highest`. HR can change it per request later.","x-description-ar":"الأولوية التي يأخذها الطلب الجديد: `low` منخفضة، `medium` متوسطة، `high` عالية، `highest` عاجلة. تستطيع الموارد البشرية تغييرها لكل طلب لاحقاً.","enum":["low","medium","high","highest"]},"target_days":{"type":"integer","description":"Days the department has to finish, counted from approval; sets the request's due date.","x-description-ar":"عدد الأيام المتاحة للقسم لإنجاز الطلب محسوبة من الاعتماد؛ ومنها يُحدَّد تاريخ الاستحقاق.","minimum":1},"enabled":{"type":"boolean","description":"Offer it in the request catalog. True when omitted on create.","x-description-ar":"عرضه في دليل الطلبات. صحيح إن لم يُرسل عند الإنشاء."},"form_fields":{"type":"array","items":{"$ref":"#/components/schemas/ticket_type_form_field"},"description":"The whole form, in order; at most 30 fields. Unknown keys are dropped.","x-description-ar":"النموذج كاملاً بالترتيب، ٣٠ حقلاً على الأكثر. تُحذف المفاتيح غير المعروفة."}}}}},"ticket_type_list":{"type":"object","required":["records"],"description":"Request types in display order.","x-description-ar":"أنواع الطلبات بترتيب العرض.","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/ticket_type"},"description":"The request types.","x-description-ar":"أنواع الطلبات."}}},"time_incident_own":{"type":"object","description":"One of the employee's own incidents, as they see it.","x-description-ar":"إحدى مخالفات الموظف كما يراها هو.","required":["id","kind","minutes","status","can_justify"],"properties":{"id":{"type":"integer","description":"Incident id.","x-description-ar":"رقم المخالفة."},"kind":{"type":"string","description":"`absence`, `late`, `early_leave`, `short_hours` (a flexible day under its hours) or `incomplete` (check-in or check-out missing; never deductible).","x-description-ar":"`absence` غياب، `late` تأخر، `early_leave` انصراف مبكر، `short_hours` نقص ساعات في يوم مرن، `incomplete` غير مكتمل (ينقصه تسجيل حضور أو انصراف؛ لا يُخصم أبداً).","enum":["absence","late","early_leave","short_hours","incomplete"]},"minutes":{"type":"integer","description":"Minutes at stake.","x-description-ar":"الدقائق المعنية."},"hours":{"type":"number","description":"The same, in hours.","x-description-ar":"الدقائق نفسها بالساعات."},"status":{"type":"string","description":"`pending` (not decided yet), `deducted` or `ignored`.","x-description-ar":"`pending` لم يُبتّ فيها بعد، `deducted` خُصمت، `ignored` تُجووز عنها.","enum":["pending","deducted","ignored"]},"review":{"type":"object","description":"The decision, once there is one.","x-description-ar":"القرار، إن صدر.","properties":{"decision":{"type":"string","description":"`deducted` or `ignored`; null while pending.","x-description-ar":"`deducted` أو `ignored`؛ null قبل القرار.","nullable":true},"decided_by":{"type":"object","description":"Who decided.","x-description-ar":"من قرر.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"decided_at":{"type":"string","description":"When (UTC).","x-description-ar":"متى (UTC).","format":"date-time","nullable":true},"note":{"type":"string","description":"The decider's note.","x-description-ar":"ملاحظة صاحب القرار.","nullable":true}}},"justification":{"type":"object","description":"The employee's reason, or null when they gave none.","x-description-ar":"سبب الموظف، أو null إن لم يذكر سبباً.","nullable":true,"properties":{"reason":{"type":"string","description":"What the employee wrote.","x-description-ar":"ما كتبه الموظف."},"submitted_at":{"type":"string","description":"When it was written (UTC).","x-description-ar":"وقت كتابته (UTC).","format":"date-time"},"conflicted":{"type":"boolean","description":"The incident's minutes changed after the reason was written (the attendance was corrected); read both before deciding.","x-description-ar":"تغيّرت دقائق المخالفة بعد كتابة السبب (صُحّح الحضور)؛ اقرأ الاثنين قبل القرار."}}},"can_justify":{"type":"boolean","description":"The employee may still write, change or withdraw the reason.","x-description-ar":"يستطيع الموظف كتابة السبب أو تغييره أو سحبه."},"blocked_reason":{"type":"string","description":"Why not, when `can_justify` is false: `corrections_disabled`, `window_expired`, `already_decided` or `payroll_locked`.","x-description-ar":"السبب عندما يكون `can_justify` خاطئاً: `corrections_disabled` أو `window_expired` أو `already_decided` أو `payroll_locked`.","nullable":true},"justify_deadline":{"type":"string","description":"Last day to explain; null when the profile allows no corrections.","x-description-ar":"آخر يوم للتبرير؛ null إن كان الملف لا يسمح بالتصحيح.","format":"date","nullable":true},"days_left":{"type":"integer","description":"Days left until the deadline.","x-description-ar":"الأيام المتبقية حتى المهلة.","nullable":true}}},"time_incident_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/time_incident_row"},"description":"The incidents on this page, newest date first.","x-description-ar":"المخالفات في هذه الصفحة، الأحدث تاريخاً أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"time_incident_row":{"type":"object","description":"One time incident as a decider (HR or manager) sees it.","x-description-ar":"مخالفة وقت واحدة كما يراها صاحب القرار (الموارد البشرية أو المدير).","required":["id","employee_id","kind","minutes","status","date"],"properties":{"id":{"type":"integer","description":"Incident id.","x-description-ar":"رقم المخالفة."},"employee_id":{"type":"integer","description":"The employee's id.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"employee_name":{"type":"string","description":"Employee's full name.","x-description-ar":"اسم الموظف الكامل.","nullable":true},"department":{"type":"string","description":"Employee's department.","x-description-ar":"قسم الموظف.","nullable":true},"date":{"type":"string","description":"The day it happened.","x-description-ar":"اليوم الذي وقعت فيه.","format":"date"},"kind":{"type":"string","description":"`absence`, `late`, `early_leave`, `short_hours` (a flexible day under its hours) or `incomplete` (check-in or check-out missing; never deductible).","x-description-ar":"`absence` غياب، `late` تأخر، `early_leave` انصراف مبكر، `short_hours` نقص ساعات في يوم مرن، `incomplete` غير مكتمل (ينقصه تسجيل حضور أو انصراف؛ لا يُخصم أبداً).","enum":["absence","late","early_leave","short_hours","incomplete"]},"minutes":{"type":"integer","description":"Minutes at stake: what a deduction would take off.","x-description-ar":"الدقائق المعنية: ما سيُخصم عند الخصم."},"hours":{"type":"number","description":"The same, in hours.","x-description-ar":"الدقائق نفسها بالساعات."},"status":{"type":"string","description":"`pending_manager` (waiting on the manager), `pending_hr` (waiting on HR), `deducted` or `ignored`.","x-description-ar":"`pending_manager` بانتظار المدير، `pending_hr` بانتظار الموارد البشرية، `deducted` خُصمت، `ignored` تُجووز عنها.","enum":["pending_manager","pending_hr","deducted","ignored"]},"deductible":{"type":"boolean","description":"False for `incomplete`: it can only be ignored, or fixed by correcting the attendance.","x-description-ar":"false للنوع `incomplete`: يمكن التجاوز عنه فقط، أو إصلاحه بتصحيح الحضور."},"can_decide":{"type":"boolean","description":"The token's owner may decide it at its current stage (its manager, or HR at the HR stage).","x-description-ar":"يستطيع صاحب الرمز اتخاذ القرار فيها في مرحلتها الحالية (مديرها، أو الموارد البشرية في مرحلتها)."},"can_act":{"type":"boolean","description":"No payroll run blocks a decision. Act only when both `can_act` and `can_decide` are true.","x-description-ar":"لا يمنع أي مسير رواتب القرار. اتخذ القرار فقط عندما يكون `can_act` و`can_decide` صحيحين."},"lock_reason":{"type":"string","description":"Why `can_act` is false: `already_paid` (a payroll run paid it) or `period_locked` (a run covering the date is past time verification).","x-description-ar":"سبب كون `can_act` خاطئاً: `already_paid` صرفها مسير رواتب، أو `period_locked` مسير يغطي التاريخ تجاوز مرحلة التحقق من الوقت.","nullable":true},"payroll_reference":{"type":"string","description":"Reference of the payroll run behind `lock_reason`.","x-description-ar":"مرجع مسير الرواتب المذكور في `lock_reason`.","nullable":true},"payroll_id":{"type":"integer","description":"The payroll run that paid this deduction.","x-description-ar":"مسير الرواتب الذي صرف هذا الخصم.","nullable":true},"deduct_escalates":{"type":"boolean","description":"Deducting it now passes it to HR instead of ending it (manager stage of a `manager_and_hr` route): the button is \"Send to HR\", not \"Deduct\".","x-description-ar":"الخصم الآن ينقلها إلى الموارد البشرية بدل إنهائها (مرحلة المدير في مسار `manager_and_hr`): الزر «إرسال للموارد البشرية» لا «خصم»."},"manager":{"type":"object","description":"The manager who owes, or gave, the manager-stage decision.","x-description-ar":"المدير المطلوب منه قرار مرحلة المدير أو من اتخذه.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"manager_acted_at":{"type":"string","description":"When the manager recommended a deduction (UTC).","x-description-ar":"وقت توصية المدير بالخصم (UTC).","format":"date-time","nullable":true},"manager_note":{"type":"string","description":"The manager's note with that recommendation.","x-description-ar":"ملاحظة المدير مع التوصية.","nullable":true},"decided_by":{"type":"object","description":"Who made the final decision.","x-description-ar":"من اتخذ القرار النهائي.","nullable":true,"properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"decided_at":{"type":"string","description":"When the final decision was made (UTC).","x-description-ar":"وقت القرار النهائي (UTC).","format":"date-time","nullable":true},"note":{"type":"string","description":"The decider's note.","x-description-ar":"ملاحظة صاحب القرار.","nullable":true},"justification":{"type":"object","description":"The employee's reason, or null when they gave none.","x-description-ar":"سبب الموظف، أو null إن لم يذكر سبباً.","nullable":true,"properties":{"reason":{"type":"string","description":"What the employee wrote.","x-description-ar":"ما كتبه الموظف."},"submitted_at":{"type":"string","description":"When it was written (UTC).","x-description-ar":"وقت كتابته (UTC).","format":"date-time"},"conflicted":{"type":"boolean","description":"The incident's minutes changed after the reason was written (the attendance was corrected); read both before deciding.","x-description-ar":"تغيّرت دقائق المخالفة بعد كتابة السبب (صُحّح الحضور)؛ اقرأ الاثنين قبل القرار."}}},"justification_window":{"type":"object","description":"Whether the employee can still explain the day. Information only: a decision is allowed while it is open.","x-description-ar":"هل ما زال بإمكان الموظف تبرير اليوم. للعلم فقط: القرار مسموح والمهلة مفتوحة.","properties":{"open":{"type":"boolean","description":"The window is still open.","x-description-ar":"المهلة ما زالت مفتوحة."},"deadline":{"type":"string","description":"Last day to explain; null when the profile allows no corrections.","x-description-ar":"آخر يوم للتبرير؛ null إن كان الملف لا يسمح بالتصحيح.","format":"date","nullable":true},"days_left":{"type":"integer","description":"Days left until the deadline.","x-description-ar":"الأيام المتبقية حتى المهلة.","nullable":true}}},"attendance":{"type":"object","description":"The attendance record behind it.","x-description-ar":"سجل الحضور الذي نشأت منه.","properties":{"record_id":{"type":"integer","description":"Attendance record id.","x-description-ar":"رقم سجل الحضور.","nullable":true},"status":{"type":"string","description":"Attendance status of the day (`absent`, `late`, `present`…).","x-description-ar":"حالة الحضور لليوم (`absent`، `late`، `present`…).","nullable":true},"check_in_at":{"type":"string","description":"Check-in (UTC).","x-description-ar":"وقت الحضور (UTC).","format":"date-time","nullable":true},"check_out_at":{"type":"string","description":"Check-out (UTC).","x-description-ar":"وقت الانصراف (UTC).","format":"date-time","nullable":true},"worked_hours":{"type":"number","description":"Hours worked.","x-description-ar":"الساعات المعمولة.","nullable":true}}},"attendance_profile":{"type":"object","description":"The attendance profile and shift the day was judged against.","x-description-ar":"ملف الحضور والوردية التي قيس عليها اليوم.","properties":{"id":{"type":"integer","description":"Profile id.","x-description-ar":"رقم الملف.","nullable":true},"name":{"type":"string","description":"Profile name.","x-description-ar":"اسم الملف.","nullable":true},"daily_target_hours":{"type":"number","description":"Hours expected a day.","x-description-ar":"الساعات المطلوبة يومياً."},"grace_period_minutes":{"type":"integer","description":"Grace period.","x-description-ar":"فترة السماح.","nullable":true},"shift_start":{"type":"string","description":"Shift start, `HH:MM` (null on a flexible day).","x-description-ar":"بداية الوردية `HH:MM` (null في اليوم المرن).","nullable":true},"shift_end":{"type":"string","description":"Shift end, `HH:MM`.","x-description-ar":"نهاية الوردية `HH:MM`.","nullable":true},"day_type":{"type":"string","description":"`working_day`, `weekend`, `holiday` or `on_leave`.","x-description-ar":"`working_day` يوم عمل، `weekend` راحة، `holiday` عطلة، `on_leave` إجازة.","nullable":true},"flexible":{"type":"boolean","description":"A flexible day (hours, no fixed window).","x-description-ar":"يوم مرن (ساعات بلا وقت ثابت)."},"scheduled_hours":{"type":"number","description":"Hours scheduled that day.","x-description-ar":"الساعات المجدولة ذلك اليوم.","nullable":true}}}}},"time_off_balance_card":{"type":"object","description":"One leave policy the employee holds, with this year's balance. `entitled_days` = `accrued_days` + `carryover_days` (when usable); `available_balance` = `entitled_days` − `taken_days` − `pending_days`.","x-description-ar":"سياسة إجازة واحدة مسندة إلى الموظف مع رصيد هذا العام. `entitled_days` = `accrued_days` + `carryover_days` (إن كان قابلاً للاستخدام)؛ `available_balance` = `entitled_days` − `taken_days` − `pending_days`.","properties":{"id":{"type":"integer","description":"Leave policy id (not an assignment id).","x-description-ar":"رقم سياسة الإجازة (وليس رقم الإسناد)."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"duration":{"type":"number","description":"Yearly entitlement the policy grants, in days.","x-description-ar":"الاستحقاق السنوي الذي تمنحه السياسة بالأيام."},"available_balance":{"type":"number","description":"Days the employee can still request.","x-description-ar":"الأيام التي ما زال بإمكان الموظف طلبها."},"requires_document":{"type":"boolean","description":"True when a request under this policy needs a supporting document.","x-description-ar":"صحيح إن كان الطلب في هذه السياسة يحتاج مستنداً داعماً."},"allow_past_dates":{"type":"boolean","description":"True when the employee may request dates already past.","x-description-ar":"صحيح إن كان مسموحاً للموظف طلب تواريخ مضت."},"show_used_balance":{"type":"boolean","description":"True when the employee's app shows the days used.","x-description-ar":"صحيح إن كان تطبيق الموظف يعرض الأيام المستخدمة."},"total_balance":{"type":"number","description":"Deprecated: the same as `accrued_days`.","x-description-ar":"متقادم: يساوي `accrued_days`."},"days_used":{"type":"number","description":"Deprecated: `taken_days` + `pending_days`.","x-description-ar":"متقادم: `taken_days` + `pending_days`."},"accrued_days":{"type":"number","description":"Days earned this year.","x-description-ar":"الأيام المكتسبة هذا العام."},"carryover_days":{"type":"number","description":"Days carried over from last year.","x-description-ar":"الأيام المرحّلة من العام الماضي."},"carryover_usable":{"type":"boolean","description":"False when carried days cannot be taken (they are still paid out when the employee leaves).","x-description-ar":"خطأ إن كانت الأيام المرحّلة غير قابلة للأخذ (وتُصرف مع ذلك عند مغادرة الموظف)."},"entitled_days":{"type":"number","description":"Days the employee is entitled to this year.","x-description-ar":"الأيام المستحقة للموظف هذا العام."},"taken_days":{"type":"number","description":"Days in approved requests.","x-description-ar":"الأيام في الطلبات المعتمدة."},"pending_days":{"type":"number","description":"Days held by requests still waiting on a decision.","x-description-ar":"الأيام المحجوزة لطلبات تنتظر القرار."},"accrued_per":{"type":"string","description":"How the policy grants days: `per_year`, `one_time_only` or `per_event` (no balance: each request is justified on its own, so `available_balance` means nothing).","x-description-ar":"طريقة منح الأيام: `per_year` سنوياً، `one_time_only` مرة واحدة، `per_event` لكل حالة (بلا رصيد، فلا معنى لـ `available_balance`)."},"allow_negative_balance":{"type":"boolean","description":"True when a request may take the balance below zero.","x-description-ar":"صحيح إن كان مسموحاً أن ينزل الطلب بالرصيد تحت الصفر."}}},"time_off_balance_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/time_off_balance_card"},"description":"The employee's active policies.","x-description-ar":"سياسات الموظف الفعّالة."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"time_off_employment_status":{"type":"object","required":["employment_status"],"properties":{"employment_status":{"type":"string","description":"The employee's employment status after the change: `active`, `notice_period` or `inactive`.","x-description-ar":"حالة توظيف الموظف بعد التغيير: `active` على رأس العمل، `notice_period` في فترة الإشعار، `inactive` غادر.","enum":["active","notice_period","inactive"]}}},"time_off_leave_request_page":{"type":"object","required":["records","pagination"],"properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/time_off_leave_request_row"},"description":"The requests on this page, newest first.","x-description-ar":"الطلبات في هذه الصفحة، الأحدث أولاً."},"pagination":{"$ref":"#/components/schemas/pagination"}}},"time_off_leave_request_row":{"type":"object","description":"One of the employee's leave requests.","x-description-ar":"طلب إجازة واحد من طلبات الموظف.","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"start_date":{"type":"string","description":"First day of leave.","x-description-ar":"أول يوم في الإجازة.","format":"date"},"end_date":{"type":"string","description":"Last day of leave.","x-description-ar":"آخر يوم في الإجازة.","format":"date"},"balance":{"type":"string","description":"Working days the request takes from the balance, as a decimal string (`\"3.0\"`).","x-description-ar":"أيام العمل التي يخصمها الطلب من الرصيد، كنص عشري (`\"3.0\"`)."},"status":{"type":"string","description":"Request status: `pending` (waiting on a decision), `approved`, `rejected`, `cancelled` or `revoked` (an approval taken back before the leave started).","x-description-ar":"حالة الطلب: `pending` بانتظار القرار، `approved` معتمد، `rejected` مرفوض، `cancelled` ملغى، `revoked` سُحب اعتماده قبل بدء الإجازة.","enum":["pending","approved","rejected","cancelled","revoked"]},"created_at":{"type":"string","description":"When it was submitted, in UTC (`2026-11-20 08:15:00 UTC`).","x-description-ar":"وقت تقديمه بتوقيت UTC."},"leave_type_name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة.","nullable":true},"on_behalf":{"type":"boolean","description":"True when HR or the manager filed it for the employee; the employee cannot edit it, and cancelling it goes to the approver's review.","x-description-ar":"صحيح إن قدّمته الموارد البشرية أو المدير نيابةً عن الموظف؛ ولا يستطيع الموظف تعديله، وإلغاؤه يذهب إلى مراجعة المعتمِد."},"policy_approver":{"type":"string","description":"Who the policy says approves (Manager, HR, Manager then HR), translated. Not the person holding it now.","x-description-ar":"من تنص السياسة على أنه يعتمد (المدير، الموارد البشرية، المدير ثم الموارد البشرية) مترجماً، وليس الشخص الذي لديه الطلب الآن.","nullable":true},"current_stage":{"type":"string","description":"Where the request waits: `awaiting_manager`, `awaiting_hr`, `cancellation_review` or `terminal` (decided).","x-description-ar":"أين ينتظر الطلب: `awaiting_manager` لدى المدير، `awaiting_hr` لدى الموارد البشرية، `cancellation_review` طلب إلغاء قيد المراجعة، `terminal` حُسم."},"current_approver_name":{"type":"string","description":"Reserved on this list; always null here.","x-description-ar":"محجوز في هذه القائمة؛ دائماً null هنا.","nullable":true},"cancellation_requested_at":{"type":"string","description":"When the employee asked to cancel, if a cancellation is under review.","x-description-ar":"متى طلب الموظف الإلغاء، إن كان هناك طلب إلغاء قيد المراجعة.","nullable":true},"locked":{"type":"boolean","description":"Always false on this list.","x-description-ar":"دائماً false في هذه القائمة."},"lock_reason":{"type":"string","description":"Reserved on this list; always null here.","x-description-ar":"محجوز في هذه القائمة؛ دائماً null هنا.","nullable":true},"submitted_by":{"type":"object","nullable":true,"description":"Who filed an on-behalf request; null when the employee filed it.","x-description-ar":"من قدّم الطلب نيابةً عن الموظف؛ null إن قدّمه الموظف بنفسه.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"revoke_type":{"type":"string","description":"How an approval was taken back: `withdrawn` (by the manager, before HR decided) or `revoked` (a final approval); null otherwise.","x-description-ar":"طريقة سحب الاعتماد: `withdrawn` سحبه المدير قبل قرار الموارد البشرية، أو `revoked` سُحب اعتماد نهائي؛ وإلا null.","nullable":true},"revocation":{"type":"object","nullable":true,"description":"Who took the approval back, when (UTC, ISO 8601) and why; null unless `revoke_type` is set.","x-description-ar":"من سحب الاعتماد ومتى (UTC بصيغة ISO 8601) ولماذا؛ null ما لم يكن `revoke_type` محدداً.","properties":{"by":{"type":"object","nullable":true,"description":"A person: `id` (employee id) and `full_name`.","x-description-ar":"شخص: `id` رقم الموظف و`full_name` اسمه.","properties":{"id":{"type":"integer","description":"Employee id.","x-description-ar":"رقم الموظف."},"full_name":{"type":"string","description":"Full name.","x-description-ar":"الاسم الكامل."}}},"at":{"type":"string","description":"When.","x-description-ar":"متى.","nullable":true},"note":{"type":"string","description":"The reason given.","x-description-ar":"السبب المذكور.","nullable":true}}},"approver_actions":{"type":"object","description":"What the token's owner may do on this request as an approver.","x-description-ar":"ما يستطيع صاحب الرمز فعله في هذا الطلب بصفته معتمِداً.","properties":{"can_withdraw":{"type":"boolean","description":"True when the owner may withdraw their own approval while the request waits for HR.","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع سحب اعتماده بينما ينتظر الطلب الموارد البشرية."},"can_revoke":{"type":"boolean","description":"True when the owner may revoke the final approval of leave that has not started.","x-description-ar":"صحيح إن كان صاحب الرمز يستطيع سحب الاعتماد النهائي لإجازة لم تبدأ."},"revoke_blocked_reason":{"type":"string","description":"Why a revoke is blocked right now: `payroll_locked` (the days are in a processed payroll run) or `cancellation_pending`.","x-description-ar":"سبب منع سحب الاعتماد الآن: `payroll_locked` الأيام ضمن مسير رواتب معالَج، أو `cancellation_pending` يوجد طلب إلغاء قيد المراجعة.","nullable":true}}}}},"time_off_offboarding":{"type":"object","description":"The leave settlement for an employee who is leaving, in days, and the leave it affects.","x-description-ar":"تسوية الإجازات لموظف يغادر، بالأيام، والإجازات التي تتأثر بها.","properties":{"carryover":{"type":"number","description":"Days carried over from earlier years.","x-description-ar":"الأيام المرحّلة من سنوات سابقة."},"pro_rated":{"type":"number","description":"This year's entitlement earned up to the last working day.","x-description-ar":"استحقاق هذا العام حتى آخر يوم عمل."},"used":{"type":"number","description":"Days of approved leave this year, up to the last working day.","x-description-ar":"أيام الإجازة المعتمدة هذا العام حتى آخر يوم عمل."},"to_encash":{"type":"number","description":"Days to be paid out: `carryover` + `pro_rated` − `used`.","x-description-ar":"الأيام التي تُصرف نقداً: `carryover` + `pro_rated` − `used`."},"policies":{"type":"array","description":"The encashable policies (annual leave, fully paid), one row each; rows add up to the totals.","x-description-ar":"السياسات القابلة للصرف النقدي (الإجازة السنوية مدفوعة الأجر بالكامل)، صف لكل منها؛ ومجموع الصفوف يساوي الإجمالي.","items":{"type":"object","properties":{"carryover":{"type":"number","description":"Days carried over from earlier years.","x-description-ar":"الأيام المرحّلة من سنوات سابقة."},"pro_rated":{"type":"number","description":"This year's entitlement earned up to the last working day.","x-description-ar":"استحقاق هذا العام حتى آخر يوم عمل."},"used":{"type":"number","description":"Days of approved leave this year, up to the last working day.","x-description-ar":"أيام الإجازة المعتمدة هذا العام حتى آخر يوم عمل."},"to_encash":{"type":"number","description":"Days to be paid out: `carryover` + `pro_rated` − `used`.","x-description-ar":"الأيام التي تُصرف نقداً: `carryover` + `pro_rated` − `used`."},"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."}}}},"excluded":{"type":"array","description":"Policies the employee holds that are not paid out, and why.","x-description-ar":"سياسات لدى الموظف لا تُصرف نقداً، وسبب ذلك.","items":{"type":"object","properties":{"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."},"reason":{"type":"string","description":"`not_accrued_per_year`, `category_not_encashable` or `policy_not_fully_paid`.","x-description-ar":"`not_accrued_per_year` لا تُستحق سنوياً، `category_not_encashable` فئتها لا تُصرف، `policy_not_fully_paid` ليست مدفوعة بالكامل."}}}},"last_working_day":{"type":"string","description":"The last working day the settlement is worked out for.","x-description-ar":"آخر يوم عمل حُسبت عليه التسوية.","format":"date"},"affected_leave_requests":{"type":"array","description":"Requests that outlive the last working day and what starting the offboarding does to each. Empty once it is finalised.","x-description-ar":"الطلبات التي تمتد بعد آخر يوم عمل وما يفعله بدء إنهاء الخدمة بكل منها. فارغة بعد الاعتماد النهائي.","items":{"type":"object","properties":{"id":{"type":"integer","description":"Leave request id.","x-description-ar":"رقم طلب الإجازة."},"leave_policy_id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"leave_type_name":{"type":"string","description":"Policy name.","x-description-ar":"اسم السياسة.","nullable":true},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"balance":{"type":"number","description":"Working days.","x-description-ar":"أيام العمل."},"status":{"type":"string","description":"`pending` or `approved`.","x-description-ar":"`pending` معلّق أو `approved` معتمد."},"action":{"type":"string","description":"`cancel` (starts after the last day; cancelled for good when the offboarding starts) or `needs_review` (straddles it; left as is for HR to cancel and re-file shorter).","x-description-ar":"`cancel` يبدأ بعد آخر يوم ويُلغى نهائياً عند بدء إنهاء الخدمة، أو `needs_review` يمتد عبره ويبقى كما هو لتلغيه الموارد البشرية وتعيد تقديمه أقصر.","enum":["cancel","needs_review"]}}}},"cancellation_warning":{"type":"string","description":"What HR must know before starting: the cancellations are permanent, and (for unpaid or partly paid leave) they change payroll. Null when nothing is cancelled.","x-description-ar":"ما يجب أن تعرفه الموارد البشرية قبل البدء: الإلغاء نهائي، ويغيّر الرواتب في الإجازات غير المدفوعة أو المدفوعة جزئياً. null إن لم يُلغَ شيء.","nullable":true}}},"time_off_statement":{"type":"object","description":"Every movement on one policy's balance for one year, with a running total.","x-description-ar":"كل حركة على رصيد سياسة واحدة لعام واحد، مع الرصيد الجاري.","properties":{"fiscal_year":{"type":"integer","description":"The leave year (calendar year).","x-description-ar":"سنة الإجازة (السنة الميلادية)."},"policy":{"type":"object","description":"The policy.","x-description-ar":"السياسة.","properties":{"id":{"type":"integer","description":"Leave policy id.","x-description-ar":"رقم سياسة الإجازة."},"name":{"type":"string","description":"Leave policy name.","x-description-ar":"اسم سياسة الإجازة."}}},"unassigned_on":{"type":"string","description":"When the policy was removed from the employee; null while it is assigned.","x-description-ar":"تاريخ إزالة السياسة من الموظف؛ null ما دامت مسندة.","format":"date","nullable":true},"summary":{"type":"object","description":"The year's totals, the same figures as `time_off.balances`.","x-description-ar":"إجماليات العام، وهي أرقام `time_off.balances` نفسها.","properties":{"accrued_days":{"type":"number","description":"Days earned.","x-description-ar":"الأيام المكتسبة."},"carryover_days":{"type":"number","description":"Days carried over.","x-description-ar":"الأيام المرحّلة."},"carryover_usable":{"type":"boolean","description":"False when carried days cannot be taken.","x-description-ar":"خطأ إن كانت الأيام المرحّلة غير قابلة للأخذ."},"entitled_days":{"type":"number","description":"Days entitled.","x-description-ar":"الأيام المستحقة."},"taken_days":{"type":"number","description":"Days in approved requests.","x-description-ar":"الأيام في الطلبات المعتمدة."},"pending_days":{"type":"number","description":"Days held by pending requests.","x-description-ar":"الأيام المحجوزة لطلبات معلّقة."},"available_days":{"type":"number","description":"Days still available.","x-description-ar":"الأيام المتاحة."}}},"entries":{"type":"array","description":"Movements in date order; entitlement before use on the same day.","x-description-ar":"الحركات بترتيب التاريخ؛ الاستحقاق قبل الاستخدام في اليوم نفسه.","items":{"type":"object","properties":{"event_type":{"type":"string","description":"`assignment`, `carryover`, `accrual`, `hire_date_corrected`, `manual_adjustment` (see `time_off.adjust_balance`), `carryover_expiration` or `deduction` (a leave request).","x-description-ar":"`assignment` إسناد، `carryover` ترحيل، `accrual` استحقاق، `hire_date_corrected` تصحيح تاريخ التعيين، `manual_adjustment` تعديل يدوي (انظر `time_off.adjust_balance`)، `carryover_expiration` انتهاء المرحّل، `deduction` طلب إجازة."},"effective_date":{"type":"string","description":"When it counts.","x-description-ar":"تاريخ احتسابها.","format":"date"},"amount":{"type":"number","description":"Days added (positive) or taken (negative).","x-description-ar":"الأيام المضافة (موجب) أو المأخوذة (سالب)."},"counted":{"type":"boolean","description":"False when the row does not move the total (a rejected or cancelled request, unusable carry-over).","x-description-ar":"خطأ إن كانت الحركة لا تغيّر الرصيد (طلب مرفوض أو ملغى، أو ترحيل غير قابل للاستخدام)."},"description":{"type":"string","description":"What happened, in the requested language.","x-description-ar":"ما حدث، بلغة الطلب.","nullable":true},"actor":{"type":"string","description":"Who made a manual adjustment; null for automatic rows.","x-description-ar":"من أجرى التعديل اليدوي؛ null للحركات التلقائية.","nullable":true},"leave_request_id":{"type":"integer","description":"The leave request, on `deduction` rows.","x-description-ar":"طلب الإجازة، في حركات `deduction`.","nullable":true},"status":{"type":"string","description":"The leave request's status, on `deduction` rows.","x-description-ar":"حالة طلب الإجازة، في حركات `deduction`.","nullable":true},"running_total":{"type":"number","description":"Balance after this row.","x-description-ar":"الرصيد بعد هذه الحركة."}}}}}},"time_off_validation":{"type":"object","description":"What submitting these dates would run into.","x-description-ar":"ما سيواجهه تقديم هذه التواريخ.","properties":{"overlaps":{"type":"array","description":"The employee's pending or approved requests that share a day with these dates.","x-description-ar":"طلبات الموظف المعلّقة أو المعتمدة التي تشترك في يوم مع هذه التواريخ.","items":{"type":"object","properties":{"leave_type":{"type":"string","description":"Policy name.","x-description-ar":"اسم السياسة."},"start_date":{"type":"string","description":"First day.","x-description-ar":"أول يوم.","format":"date"},"end_date":{"type":"string","description":"Last day.","x-description-ar":"آخر يوم.","format":"date"},"status":{"type":"string","description":"`pending` or `approved`.","x-description-ar":"`pending` معلّق أو `approved` معتمد."}}}},"balance":{"type":"object","description":"The balance check.","x-description-ar":"فحص الرصيد.","properties":{"available_days":{"type":"number","description":"Days available on the policy now.","x-description-ar":"الأيام المتاحة في السياسة الآن."},"requested_days":{"type":"number","description":"Working days these dates would take (weekends and holidays excluded).","x-description-ar":"أيام العمل التي ستأخذها هذه التواريخ (دون العطل الأسبوعية والرسمية)."},"allow_negative_balance":{"type":"boolean","description":"True when the policy lets the balance go below zero.","x-description-ar":"صحيح إن كانت السياسة تسمح بنزول الرصيد تحت الصفر."},"exceeded":{"type":"boolean","description":"True when `requested_days` is more than `available_days`. Submitting is then refused unless `allow_negative_balance` is true.","x-description-ar":"صحيح إن زادت `requested_days` على `available_days`. ويُرفض التقديم حينها ما لم تكن `allow_negative_balance` صحيحة."}}},"warning":{"type":"string","description":"Overlap warning, present only when `overlaps` is not empty.","x-description-ar":"تنبيه التداخل، يظهر فقط إن لم تكن `overlaps` فارغة.","nullable":true}}},"timesheet":{"type":"object","description":"One employee's time for the run, in minutes. Payroll prices overtime, absence and undertime from it.","x-description-ar":"وقت موظف واحد في المسيّر بالدقائق. يُسعِّر المسيّر منه العمل الإضافي والغياب والنقص.","properties":{"id":{"type":"integer","description":"Timesheet id.","x-description-ar":"رقم سجل الوقت."},"employee_id":{"type":"integer","description":"The employee.","x-description-ar":"رقم الموظف."},"employee_no":{"type":"string","description":"Employee number.","x-description-ar":"الرقم الوظيفي.","nullable":true},"name":{"type":"string","description":"Employee name.","x-description-ar":"اسم الموظف.","nullable":true},"required_mins":{"type":"integer","description":"Minutes the employee was scheduled to work.","x-description-ar":"الدقائق المجدولة للموظف."},"worked_mins":{"type":"integer","description":"Minutes counted as worked: required + overtime − absence − undertime.","x-description-ar":"الدقائق المحتسبة عملاً: المجدولة + الإضافي − الغياب − النقص."},"absence":{"type":"integer","description":"Absence minutes, deducted.","x-description-ar":"دقائق الغياب، تُستقطع."},"overtime":{"type":"integer","description":"Overtime minutes, paid.","x-description-ar":"دقائق العمل الإضافي، تُصرف."},"undertime":{"type":"integer","description":"Lateness and early-leave minutes, deducted.","x-description-ar":"دقائق التأخير والخروج المبكر، تُستقطع."},"manual_override":{"type":"boolean","description":"True once someone typed the figures; a refresh then leaves the row alone.","x-description-ar":"صحيح إن أُدخلت الأرقام يدوياً؛ فلا يغيّرها التحديث بعد ذلك."},"balanced":{"type":"boolean","description":"True when worked = required + overtime − absence − undertime.","x-description-ar":"صحيح إن كان المحتسب = المجدول + الإضافي − الغياب − النقص."},"sources":{"type":"object","description":"How many approved records fed the figures: `overtime_requests`, `absence_incidents`, `undertime_incidents`.","x-description-ar":"عدد السجلات المعتمدة التي غذّت الأرقام: `overtime_requests` و`absence_incidents` و`undertime_incidents`."}}},"user":{"type":"object","description":"A user, in full.","x-description-ar":"مستخدم بكل بياناته.","required":["id","user_id","email","first_name","last_name","is_active","is_owner","portal_access","role","created_at","updated_at"],"properties":{"id":{"type":"integer","description":"The user's id in this company. Use it in the other user operations.","x-description-ar":"رقم المستخدم في هذه الشركة، ويُستخدم في عمليات المستخدمين الأخرى."},"user_id":{"type":"integer","description":"The person's QHR account id, the same in every company they belong to (`user.id` in `me.show`).","x-description-ar":"رقم حساب الشخص في QHR، وهو نفسه في كل الشركات التي ينتمي إليها (`user.id` في `me.show`)."},"email":{"type":"string","description":"Login email.","x-description-ar":"بريد الدخول."},"is_active":{"type":"boolean","description":"`false` once deactivated with `users.deactivate`: the user can no longer sign in here.","x-description-ar":"`false` بعد إيقافه عبر `users.deactivate`، فلا يستطيع الدخول إلى هذه الشركة."},"is_owner":{"type":"boolean","description":"Whether the user owns the company account.","x-description-ar":"هل المستخدم مالك حساب الشركة."},"role":{"type":"object","nullable":true,"description":"The user's role; it decides what they may see and do. Roles come from `roles.list`.","x-description-ar":"دور المستخدم، وهو ما يحدد ما يستطيع رؤيته والقيام به. الأدوار من `roles.list`.","properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name":{"type":"string","description":"Role name in the requested language.","x-description-ar":"اسم الدور بلغة الطلب."}}},"first_name":{"type":"string","description":"First name.","x-description-ar":"الاسم الأول."},"last_name":{"type":"string","description":"Last name.","x-description-ar":"اسم العائلة."},"portal_access":{"type":"string","description":"Sign-in state: `pending` (invited, has not accepted yet), `activated` (can sign in), `cancelled` (deactivated, or invitation withdrawn), `expired` (invitation not accepted within 7 days), `not_invited`.","x-description-ar":"حالة الدخول: `pending` (دُعي ولم يقبل بعد)، `activated` (يستطيع الدخول)، `cancelled` (أُوقف أو سُحبت دعوته)، `expired` (لم يقبل الدعوة خلال ٧ أيام)، `not_invited` (لم يُدعَ).","enum":["not_invited","pending","activated","cancelled","expired"]},"created_at":{"type":"string","description":"When the person's QHR account was created, in UTC, as `YYYY-MM-DD HH:MM:SS UTC`.","x-description-ar":"تاريخ إنشاء حساب الشخص في QHR بتوقيت UTC، بالشكل `YYYY-MM-DD HH:MM:SS UTC`."},"updated_at":{"type":"string","description":"When the account was last changed, in UTC, as `YYYY-MM-DD HH:MM:SS UTC`.","x-description-ar":"تاريخ آخر تعديل على الحساب بتوقيت UTC، بالشكل `YYYY-MM-DD HH:MM:SS UTC`."}}},"user_create_input":{"type":"object","required":["user"],"properties":{"user":{"type":"object","description":"The person to give access to.","x-description-ar":"الشخص الذي ستُمنح له صلاحية الدخول.","required":["email","first_name","last_name"],"properties":{"email":{"type":"string","description":"Login email. The invitation is sent here.","x-description-ar":"بريد الدخول، وإليه تُرسل الدعوة.","format":"email"},"first_name":{"type":"string","description":"First name.","x-description-ar":"الاسم الأول."},"last_name":{"type":"string","description":"Last name.","x-description-ar":"اسم العائلة."},"tenant_role_id":{"type":"integer","description":"Role to give, from `roles.list`; must be active. The company's default employee role when omitted.","x-description-ar":"الدور الممنوح، من `roles.list`، ويجب أن يكون مفعّلاً. إن لم يُرسل فالدور الافتراضي للموظفين."}}}}},"user_input":{"type":"object","required":["user"],"properties":{"user":{"type":"object","description":"The user's details.","x-description-ar":"بيانات المستخدم.","properties":{"email":{"type":"string","description":"Login email.","x-description-ar":"بريد الدخول.","format":"email"},"first_name":{"type":"string","description":"First name.","x-description-ar":"الاسم الأول."},"last_name":{"type":"string","description":"Last name.","x-description-ar":"اسم العائلة."}}}}},"user_row":{"type":"object","description":"A user, as listed.","x-description-ar":"مستخدم كما يظهر في القائمة.","required":["id","user_id","email","full_name","is_active","is_owner","role"],"properties":{"id":{"type":"integer","description":"The user's id in this company. Use it in the other user operations.","x-description-ar":"رقم المستخدم في هذه الشركة، ويُستخدم في عمليات المستخدمين الأخرى."},"user_id":{"type":"integer","description":"The person's QHR account id, the same in every company they belong to (`user.id` in `me.show`).","x-description-ar":"رقم حساب الشخص في QHR، وهو نفسه في كل الشركات التي ينتمي إليها (`user.id` في `me.show`)."},"email":{"type":"string","description":"Login email.","x-description-ar":"بريد الدخول."},"is_active":{"type":"boolean","description":"`false` once deactivated with `users.deactivate`: the user can no longer sign in here.","x-description-ar":"`false` بعد إيقافه عبر `users.deactivate`، فلا يستطيع الدخول إلى هذه الشركة."},"is_owner":{"type":"boolean","description":"Whether the user owns the company account.","x-description-ar":"هل المستخدم مالك حساب الشركة."},"role":{"type":"object","nullable":true,"description":"The user's role; it decides what they may see and do. Roles come from `roles.list`.","x-description-ar":"دور المستخدم، وهو ما يحدد ما يستطيع رؤيته والقيام به. الأدوار من `roles.list`.","properties":{"id":{"type":"integer","description":"Role id.","x-description-ar":"رقم الدور."},"name":{"type":"string","description":"Role name in the requested language.","x-description-ar":"اسم الدور بلغة الطلب."}}},"full_name":{"type":"string","description":"First and last name.","x-description-ar":"الاسم الأول واسم العائلة."}}}},"responses":{"token_error":{"description":"The token is missing, wrong, expired or revoked, or the company is suspended.","x-description-ar":"الرمز مفقود أو خاطئ أو منتهٍ أو ملغى، أو الشركة موقوفة.","x-codes":[{"code":"token_missing","meaning":"No `Authorization: Bearer …` header, or it is malformed.","x-meaning-ar":"لا توجد ترويسة `Authorization: Bearer …` أو صيغتها غير صحيحة.","x-fix":"Send `Authorization: Bearer qhr_…` with the full token.","x-fix-ar":"أرسل `Authorization: Bearer qhr_…` مع الرمز كاملاً."},{"code":"token_invalid","meaning":"The token is unknown or wrong, or its owner's account is locked.","x-meaning-ar":"الرمز غير معروف أو خاطئ، أو حساب صاحبه مقفل.","x-fix":"Check the token was copied in full, or create a new one in QHR › Settings › API \u0026 Integrations.","x-fix-ar":"تأكد من نسخ الرمز كاملاً، أو أنشئ رمزاً جديداً من QHR › الإعدادات › الواجهة البرمجية والتكاملات."},{"code":"token_expired","meaning":"The token is past its expiry date.","x-meaning-ar":"انتهت صلاحية الرمز.","x-fix":"Create a new token.","x-fix-ar":"أنشئ رمزاً جديداً."},{"code":"token_revoked","meaning":"The token was revoked by its owner or an admin, or the owner was removed from the company (which revokes all their tokens).","x-meaning-ar":"أُلغي الرمز من صاحبه أو من مسؤول النظام، أو أُزيل صاحبه من الشركة (فتُلغى كل رموزه).","x-fix":"Create a new token, or ask your admin. If the owner was removed, they must be re-invited to the company first.","x-fix-ar":"أنشئ رمزاً جديداً أو تواصل مع مسؤول النظام. وإن أُزيل صاحب الرمز فيجب إعادة دعوته إلى الشركة أولاً."},{"code":"tenant_inactive","meaning":"The company account is suspended.","x-meaning-ar":"حساب الشركة موقوف.","x-fix":"Contact QHR support.","x-fix-ar":"تواصل مع دعم QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This API token has expired. Create a new one in QHR › Settings › API \u0026 Integrations.","code":"token_expired"}}}},"forbidden":{"description":"The token's owner may not do this.","x-description-ar":"صاحب الرمز لا يملك صلاحية تنفيذ هذا.","x-codes":[{"code":"forbidden","meaning":"The token owner's role lacks the permission this operation needs.","x-meaning-ar":"دور صاحب الرمز لا يملك الصلاحية التي تحتاجها هذه العملية.","x-fix":"Ask an admin to grant the permission shown on this operation (`x-permission`).","x-fix-ar":"اطلب من مسؤول النظام منحك الصلاحية الموضحة في هذه العملية (`x-permission`)."},{"code":"employee_inactive","meaning":"The token owner's employee record is not active.","x-meaning-ar":"سجل صاحب الرمز الوظيفي غير نشط.","x-fix":"HR must reactivate the employee record.","x-fix-ar":"يجب أن تعيد الموارد البشرية تفعيل السجل الوظيفي."},{"code":"tenant_access_revoked","meaning":"The token's owner is no longer an active member of this company. Rare: removing a member normally revokes their tokens, which answers 401 `token_revoked` instead.","x-meaning-ar":"صاحب الرمز لم يعد عضواً نشطاً في هذه الشركة. نادر الحدوث: فإزالة العضو تُلغي رموزه عادةً، فتكون الإجابة 401 بالرمز `token_revoked` بدلاً من ذلك.","x-fix":"The owner must be re-invited to the company, then create a new token. If the owner is still a member, contact QHR support.","x-fix-ar":"يجب إعادة دعوة صاحب الرمز إلى الشركة ثم إنشاء رمز جديد. وإن كان لا يزال عضواً فتواصل مع دعم QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"You do not have permission to do this.","code":"forbidden"}}}},"forbidden_or_read_only":{"description":"The token is read-only, or its owner may not do this.","x-description-ar":"الرمز للقراءة فقط، أو صاحبه لا يملك صلاحية تنفيذ هذا.","x-codes":[{"code":"token_read_only","meaning":"This token can only read; the operation makes changes.","x-meaning-ar":"هذا الرمز للقراءة فقط، والعملية تُجري تغييرات.","x-fix":"Use a token created with \"Allow changes\".","x-fix-ar":"استخدم رمزاً مفعّلاً عليه «السماح بالتعديل»."},{"code":"forbidden","meaning":"The token owner's role lacks the permission this operation needs.","x-meaning-ar":"دور صاحب الرمز لا يملك الصلاحية التي تحتاجها هذه العملية.","x-fix":"Ask an admin to grant the permission shown on this operation (`x-permission`).","x-fix-ar":"اطلب من مسؤول النظام منحك الصلاحية الموضحة في هذه العملية (`x-permission`)."},{"code":"employee_inactive","meaning":"The token owner's employee record is not active.","x-meaning-ar":"سجل صاحب الرمز الوظيفي غير نشط.","x-fix":"HR must reactivate the employee record.","x-fix-ar":"يجب أن تعيد الموارد البشرية تفعيل السجل الوظيفي."},{"code":"tenant_access_revoked","meaning":"The token's owner is no longer an active member of this company. Rare: removing a member normally revokes their tokens, which answers 401 `token_revoked` instead.","x-meaning-ar":"صاحب الرمز لم يعد عضواً نشطاً في هذه الشركة. نادر الحدوث: فإزالة العضو تُلغي رموزه عادةً، فتكون الإجابة 401 بالرمز `token_revoked` بدلاً من ذلك.","x-fix":"The owner must be re-invited to the company, then create a new token. If the owner is still a member, contact QHR support.","x-fix-ar":"يجب إعادة دعوة صاحب الرمز إلى الشركة ثم إنشاء رمز جديد. وإن كان لا يزال عضواً فتواصل مع دعم QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"This API token can only read. Use a token with \"Allow changes\" to make changes.","code":"token_read_only"}}}},"not_found":{"description":"No such record, or you cannot see it.","x-description-ar":"السجل غير موجود أو غير مرئي لك.","x-codes":[{"code":"not_found","meaning":"The record does not exist, or you cannot see it.","x-meaning-ar":"السجل غير موجود أو ليس لديك صلاحية رؤيته.","x-fix":"Check the id. List the records first to get a valid one.","x-fix-ar":"تأكد من الرقم. اعرض القائمة أولاً للحصول على رقم صحيح."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Record not found.","code":"not_found"}}}},"validation_failed":{"description":"The data sent is not valid.","x-description-ar":"البيانات المرسلة غير صحيحة.","x-codes":[{"code":"validation_failed","meaning":"Some fields are missing or not valid.","x-meaning-ar":"بعض الحقول ناقصة أو غير صحيحة.","x-fix":"Fix the fields named in `error` (and `errors` when present), then send again.","x-fix-ar":"صحّح الحقول المذكورة في `error` (و`errors` إن وُجد) ثم أعد الإرسال."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"First name can't be blank","code":"validation_failed"}}}},"bad_request":{"description":"A parameter is missing or malformed.","x-description-ar":"معامل ناقص أو غير صحيح.","x-codes":[{"code":"bad_request","meaning":"A parameter is missing or malformed.","x-meaning-ar":"معامل ناقص أو صيغته غير صحيحة.","x-fix":"Check the parameters against this operation's documentation.","x-fix-ar":"راجع المعاملات حسب توثيق هذه العملية."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"param is missing or the value is empty: email","code":"bad_request"}}}},"rate_limited":{"description":"Too many requests.","x-description-ar":"طلبات كثيرة جداً.","x-codes":[{"code":"rate_limited","meaning":"Too many requests from this token or address.","x-meaning-ar":"طلبات كثيرة من هذا الرمز أو العنوان.","x-fix":"Wait the number of seconds in the `Retry-After` header, then retry.","x-fix-ar":"انتظر عدد الثواني الموجود في ترويسة `Retry-After` ثم أعد المحاولة."}],"headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds to wait before retrying."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Too many requests. Wait a moment and try again.","code":"rate_limited"}}}},"entitlement_not_released":{"description":"The feature hasn't been launched yet.","x-description-ar":"الميزة لم تُطلق بعد.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature hasn't been launched yet (`reason: not_released`).","x-meaning-ar":"هذه الميزة لم تُطلق بعد (`reason: not_released`).","x-fix":"Wait for the launch; nothing to change on your side.","x-fix-ar":"انتظر الإطلاق؛ لا يلزمك أي تغيير."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API is on its way.","code":"entitlement_blocked","reason":"not_released","feature":"open_api","module":"core"}}}},"entitlement_not_in_plan":{"description":"The feature isn't available for the company.","x-description-ar":"الميزة غير متاحة للشركة.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature isn't available for your company.","x-meaning-ar":"هذه الميزة غير متاحة لشركتك.","x-fix":"Contact your QHR account manager.","x-fix-ar":"تواصل مع مدير حسابك في QHR."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API isn't available for your company.","code":"entitlement_blocked","reason":"not_in_plan","feature":"open_api","module":"core"}}}},"entitlement_not_enabled":{"description":"The feature is switched off for the company.","x-description-ar":"الميزة معطّلة للشركة.","x-codes":[{"code":"entitlement_blocked","meaning":"This feature is switched off for your company (`reason: not_enabled`).","x-meaning-ar":"هذه الميزة معطّلة لشركتك (`reason: not_enabled`).","x-fix":"Ask your company's QHR administrator to switch it on.","x-fix-ar":"اطلب من مسؤول QHR في شركتك تفعيلها."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Open API is switched off for your company.","code":"entitlement_blocked","reason":"not_enabled","feature":"open_api","module":"core"}}}},"internal_error":{"description":"Unexpected error.","x-description-ar":"خطأ غير متوقع.","x-codes":[{"code":"internal_error","meaning":"Something went wrong on QHR's side.","x-meaning-ar":"حدث خطأ من جهة QHR.","x-fix":"Retry later. If it keeps happening, contact QHR support with the time of the request.","x-fix-ar":"أعد المحاولة لاحقاً. وإن تكرر فتواصل مع دعم QHR وأرسل وقت الطلب."}],"content":{"application/json":{"schema":{"$ref":"#/components/schemas/error"},"example":{"error":"Something went wrong on our side. Try again later.","code":"internal_error"}}}}}}}