{
    "openapi": "3.1.0",
    "info": {
        "title": "Okta Partners API",
        "description": "Partner-app runtime API hosted by okta-web. Authenticate with a per-installation Bearer token.",
        "version": "1.0.0",
        "contact": {
            "email": "partners@getokta.io"
        }
    },
    "servers": [
        {
            "url": "https://getokta.io/api/apps",
            "description": "Production"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Per-installation token issued when a tenant installs your app."
            }
        }
    },
    "paths": {
        "/whoami": {
            "get": {
                "operationId": "get_whoami",
                "summary": "من أنا",
                "description": "معلومات الـ installation الحالي (المستأجر، التطبيق، النطاقات).",
                "tags": [
                    "الهوية"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "tenant_id": 42,
                                    "module": "your-app",
                                    "scopes": [
                                        "education.students.read",
                                        "education.students.write"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/students": {
            "get": {
                "operationId": "get_education_students",
                "summary": "قائمة الطلاب",
                "description": "قائمة الطلاب (مُرقّمة).\n\nRequired scope: `education.students.read`.",
                "tags": [
                    "الطلاب"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 123,
                                            "full_name": "Sara Al-Otaibi",
                                            "national_id": "1098765432",
                                            "birth_date": "2012-04-18",
                                            "gender": "female",
                                            "grade_id": 7,
                                            "section_id": 3
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "post_education_students",
                "summary": "إنشاء طالب",
                "description": "إنشاء طالب.\n\nRequired scope: `education.students.write`.",
                "tags": [
                    "الطلاب"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "full_name": {
                                        "type": "string",
                                        "description": "الاسم الكامل للطالب."
                                    },
                                    "national_id": {
                                        "type": "string",
                                        "description": "رقم الهوية/الإقامة."
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "description": "تاريخ الميلاد (YYYY-MM-DD)."
                                    },
                                    "gender": {
                                        "type": "string",
                                        "description": "male أو female."
                                    },
                                    "grade_id": {
                                        "type": "integer",
                                        "description": "مُعرّف الصف."
                                    },
                                    "section_id": {
                                        "type": "integer",
                                        "description": "مُعرّف الشُعبة."
                                    },
                                    "guardian_id": {
                                        "type": "integer",
                                        "description": "مُعرّف وليّ الأمر."
                                    }
                                },
                                "required": [
                                    "full_name"
                                ]
                            },
                            "example": {
                                "full_name": "Sara Al-Otaibi",
                                "national_id": "1098765432",
                                "birth_date": "2012-04-18",
                                "gender": "female",
                                "grade_id": 7,
                                "section_id": 3
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "example": {
                                    "student": {
                                        "id": 123,
                                        "full_name": "Sara Al-Otaibi",
                                        "national_id": "1098765432",
                                        "birth_date": "2012-04-18",
                                        "gender": "female",
                                        "grade_id": 7,
                                        "section_id": 3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/students/{id}": {
            "get": {
                "operationId": "get_education_students_id",
                "summary": "طالب واحد",
                "description": "طالب واحد.\n\nRequired scope: `education.students.read`.",
                "tags": [
                    "الطلاب"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "مُعرّف المورد في أوكتا.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "student": {
                                        "id": 123,
                                        "full_name": "Sara Al-Otaibi",
                                        "national_id": "1098765432",
                                        "birth_date": "2012-04-18",
                                        "gender": "female",
                                        "grade_id": 7,
                                        "section_id": 3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Resource not found.",
                                    "error": "not_found"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "patch_education_students_id",
                "summary": "تعديل طالب",
                "description": "تعديل طالب.\n\nRequired scope: `education.students.write`.",
                "tags": [
                    "الطلاب"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "مُعرّف المورد في أوكتا.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "full_name": {
                                        "type": "string",
                                        "description": "الاسم الكامل للطالب."
                                    },
                                    "national_id": {
                                        "type": "string",
                                        "description": "رقم الهوية/الإقامة."
                                    },
                                    "birth_date": {
                                        "type": "string",
                                        "description": "تاريخ الميلاد (YYYY-MM-DD)."
                                    },
                                    "gender": {
                                        "type": "string",
                                        "description": "male أو female."
                                    },
                                    "grade_id": {
                                        "type": "integer",
                                        "description": "مُعرّف الصف."
                                    },
                                    "section_id": {
                                        "type": "integer",
                                        "description": "مُعرّف الشُعبة."
                                    },
                                    "guardian_id": {
                                        "type": "integer",
                                        "description": "مُعرّف وليّ الأمر."
                                    }
                                }
                            },
                            "example": {
                                "section_id": 4
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "student": {
                                        "id": 123,
                                        "full_name": "Sara Al-Otaibi",
                                        "national_id": "1098765432",
                                        "birth_date": "2012-04-18",
                                        "gender": "female",
                                        "grade_id": 7,
                                        "section_id": 3
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Resource not found.",
                                    "error": "not_found"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/guardians": {
            "get": {
                "operationId": "get_education_guardians",
                "summary": "قائمة أولياء الأمور",
                "description": "قائمة أولياء الأمور.\n\nRequired scope: `education.guardians.read`.",
                "tags": [
                    "أولياء الأمور"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 45,
                                            "full_name": "Khaled Al-Otaibi",
                                            "phone": "+966500000000",
                                            "email": "khaled@example.com",
                                            "relation": "father"
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "post_education_guardians",
                "summary": "إنشاء وليّ أمر",
                "description": "إنشاء وليّ أمر.\n\nRequired scope: `education.guardians.write`.",
                "tags": [
                    "أولياء الأمور"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "full_name": {
                                        "type": "string",
                                        "description": "الاسم الكامل لوليّ الأمر."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "رقم الجوال بصيغة E.164."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "البريد الإلكتروني."
                                    },
                                    "relation": {
                                        "type": "string",
                                        "description": "father | mother | other."
                                    }
                                },
                                "required": [
                                    "full_name",
                                    "phone"
                                ]
                            },
                            "example": {
                                "full_name": "Khaled Al-Otaibi",
                                "phone": "+966500000000",
                                "email": "khaled@example.com",
                                "relation": "father"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "example": {
                                    "guardian": {
                                        "id": 45,
                                        "full_name": "Khaled Al-Otaibi",
                                        "phone": "+966500000000",
                                        "email": "khaled@example.com",
                                        "relation": "father"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/guardians/{id}": {
            "get": {
                "operationId": "get_education_guardians_id",
                "summary": "وليّ أمر واحد",
                "description": "وليّ أمر واحد.\n\nRequired scope: `education.guardians.read`.",
                "tags": [
                    "أولياء الأمور"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "مُعرّف المورد في أوكتا.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "guardian": {
                                        "id": 45,
                                        "full_name": "Khaled Al-Otaibi",
                                        "phone": "+966500000000",
                                        "email": "khaled@example.com",
                                        "relation": "father"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Resource not found.",
                                    "error": "not_found"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "operationId": "patch_education_guardians_id",
                "summary": "تعديل وليّ أمر",
                "description": "تعديل وليّ أمر.\n\nRequired scope: `education.guardians.write`.",
                "tags": [
                    "أولياء الأمور"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "مُعرّف المورد في أوكتا.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "full_name": {
                                        "type": "string",
                                        "description": "الاسم الكامل لوليّ الأمر."
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "رقم الجوال بصيغة E.164."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "البريد الإلكتروني."
                                    },
                                    "relation": {
                                        "type": "string",
                                        "description": "father | mother | other."
                                    }
                                }
                            },
                            "example": {
                                "phone": "+966511111111"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "guardian": {
                                        "id": 45,
                                        "full_name": "Khaled Al-Otaibi",
                                        "phone": "+966500000000",
                                        "email": "khaled@example.com",
                                        "relation": "father"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Resource not found.",
                                    "error": "not_found"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/subjects": {
            "get": {
                "operationId": "get_education_subjects",
                "summary": "قائمة المواد",
                "description": "المواد.\n\nRequired scope: `education.subjects.read`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 9,
                                            "name": "Mathematics",
                                            "code": "MATH"
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "post_education_subjects",
                "summary": "إنشاء مادة",
                "description": "إنشاء مادة (idempotent).\n\nRequired scope: `education.subjects.write`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "اسم المادة."
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "رمز المادة."
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            },
                            "example": {
                                "name": "Mathematics",
                                "code": "MATH"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "example": {
                                    "subject": {
                                        "id": 9,
                                        "name": "Mathematics",
                                        "code": "MATH"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/grades": {
            "get": {
                "operationId": "get_education_grades",
                "summary": "قائمة الصفوف",
                "description": "الصفوف.\n\nRequired scope: `education.grades.read`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 7,
                                            "name": "Grade 7",
                                            "level": 7
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/sections": {
            "get": {
                "operationId": "get_education_sections",
                "summary": "قائمة الشُعب",
                "description": "الشُعب.\n\nRequired scope: `education.sections.read`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 3,
                                            "name": "7-A",
                                            "grade_id": 7
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/academic-years": {
            "get": {
                "operationId": "get_education_academic_years",
                "summary": "الأعوام الدراسية",
                "description": "الأعوام الدراسية.\n\nRequired scope: `education.academic_years.read`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 2,
                                            "name": "2025/2026",
                                            "starts_on": "2025-08-24",
                                            "ends_on": "2026-06-25"
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/education/terms": {
            "get": {
                "operationId": "get_education_terms",
                "summary": "الفصول الدراسية",
                "description": "الفصول الدراسية.\n\nRequired scope: `education.terms.read`.",
                "tags": [
                    "المنهج الدراسي"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 5,
                                            "name": "First term",
                                            "academic_year_id": 2
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/employees/directory": {
            "get": {
                "operationId": "get_employees_directory",
                "summary": "دليل الموظفين",
                "description": "دليل الموظفين.\n\nRequired scope: `employees.directory.read`.",
                "tags": [
                    "الموظفون"
                ],
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "رقم الصفحة (يبدأ من 1).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "عدد العناصر لكل صفحة (حد أقصى 100).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "بحث نصّي اختياري.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "id": 88,
                                            "full_name": "Mona Al-Harbi",
                                            "job_title": "Teacher",
                                            "email": "mona@example.com"
                                        }
                                    ],
                                    "total": 1242,
                                    "per_page": 20,
                                    "current_page": 1,
                                    "last_page": 63
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "post_employees_directory",
                "summary": "إضافة موظف",
                "description": "إضافة موظف (idempotent).\n\nRequired scope: `employees.directory.write`.",
                "tags": [
                    "الموظفون"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "full_name": {
                                        "type": "string",
                                        "description": "الاسم الكامل للموظف."
                                    },
                                    "job_title": {
                                        "type": "string",
                                        "description": "المسمى الوظيفي."
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "البريد الإلكتروني."
                                    }
                                },
                                "required": [
                                    "full_name"
                                ]
                            },
                            "example": {
                                "full_name": "Mona Al-Harbi",
                                "job_title": "Teacher",
                                "email": "mona@example.com"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "example": {
                                    "employee": {
                                        "id": 88,
                                        "full_name": "Mona Al-Harbi",
                                        "job_title": "Teacher",
                                        "email": "mona@example.com"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/employees/directory/{id}": {
            "get": {
                "operationId": "get_employees_directory_id",
                "summary": "موظف واحد",
                "description": "موظف واحد.\n\nRequired scope: `employees.directory.read`.",
                "tags": [
                    "الموظفون"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "مُعرّف المورد في أوكتا.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "employee": {
                                        "id": 88,
                                        "full_name": "Mona Al-Harbi",
                                        "job_title": "Teacher",
                                        "email": "mona@example.com"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Resource not found.",
                                    "error": "not_found"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reports/builder": {
            "get": {
                "operationId": "get_reports_builder",
                "summary": "كتالوج التقارير",
                "description": "كتالوج التقارير المتاحة.\n\nRequired scope: `reports.builder.read`.",
                "tags": [
                    "التقارير"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": [
                                        {
                                            "key": "attendance_summary",
                                            "name": "Attendance summary"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/reports/builder/{key}/run": {
            "post": {
                "operationId": "post_reports_builder_key_run",
                "summary": "تنفيذ تقرير",
                "description": "تنفيذ تقرير (idempotent).\n\nRequired scope: `reports.builder.read`.",
                "tags": [
                    "التقارير"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "description": "مفتاح التقرير من الكتالوج.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "parameters": {
                                        "type": "object",
                                        "description": "مُعطيات التقرير (تعتمد على نوعه)."
                                    }
                                }
                            },
                            "example": {
                                "parameters": {
                                    "term_id": 5
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "data": {
                                        "rows": []
                                    },
                                    "generated_at": "2026-04-26T10:30:15+03:00"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notifications/capabilities": {
            "get": {
                "operationId": "get_notifications_capabilities",
                "summary": "قدرات الإشعار",
                "description": "قدرات قناة الإشعار.\n\nRequired scope: `notifications.providers.send`.",
                "tags": [
                    "الإشعارات"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "example": {
                                    "channels": [
                                        "whatsapp",
                                        "sms"
                                    ],
                                    "features": {
                                        "templates": true
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/notifications/send": {
            "post": {
                "operationId": "post_notifications_send",
                "summary": "إرسال إشعار",
                "description": "إرسال رسالة (idempotent).\n\nRequired scope: `notifications.providers.send`.",
                "tags": [
                    "الإشعارات"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient": {
                                        "type": "string",
                                        "description": "المُستلِم (رقم جوال أو مُعرّف مستخدم)."
                                    },
                                    "message": {
                                        "type": "string",
                                        "description": "نص الرسالة."
                                    },
                                    "channel": {
                                        "type": "string",
                                        "description": "قناة محدّدة (اختياري)."
                                    }
                                },
                                "required": [
                                    "recipient",
                                    "message"
                                ]
                            },
                            "example": {
                                "recipient": "+966500000000",
                                "message": "Welcome to Okta!",
                                "channel": "whatsapp"
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Accepted",
                        "content": {
                            "application/json": {
                                "example": {
                                    "id": "msg_9f2c",
                                    "status": "queued"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "Unauthenticated.",
                                    "error": "unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given scope is not granted for this installation.",
                                    "error": "scope_not_granted"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Unprocessable",
                        "content": {
                            "application/json": {
                                "example": {
                                    "message": "The given data was invalid.",
                                    "errors": {
                                        "full_name": [
                                            "The full name field is required."
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}