openapi: 3.0.3
info:
  title: 'IT Plus API Documentation / وثائق واجهة برمجة تطبيقات IT Plus'
  description: 'RESTful API for IT Plus System - Software Solutions Company / واجهة برمجة تطبيقات RESTful لنظام IT Plus - شركة حلول البرمجيات'
  version: 1.0.0
servers:
  -
    url: 'http://localhost:8000'
tags:
  -
    name: 'Admin / Dashboard'
    description: ''
  -
    name: 'Admin Authentication'
    description: "\nAPIs for admin authentication"
  -
    name: Endpoints
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: "    <h4>كيفية الحصول على الرمز / How to Get a Token</h4>\n    <ol>\n        <li>قم بإرسال طلب POST إلى <code>/api/admin/auth/login</code> مع اسم المستخدم وكلمة المرور.</li>\n        <li>Send a POST request to <code>/api/admin/auth/login</code> with your username and password.</li>\n        <li>ستحصل على رمز في الاستجابة. / You will receive a token in the response.</li>\n        <li>استخدم هذا الرمز في رأس Authorization: <code>Bearer YOUR_TOKEN</code></li>\n        <li>Use this token in the Authorization header: <code>Bearer YOUR_TOKEN</code></li>\n    </ol>"
security:
  -
    default: []
paths:
  /api/admin/dashboard/stats:
    get:
      summary: 'Get dashboard statistics'
      operationId: getDashboardStatistics
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            text/plain:
              schema:
                type: string
                example: "{\n  \"success\": true,\n  \"message\": \"تم جلب الإحصائيات بنجاح\",\n  \"message_en\": \"Statistics retrieved successfully\",\n  \"data\": {\n    \"overview\": {\n      \"total_users\": 100,\n      \"active_users\": 85,\n      \"total_orders\": 150,\n      \"pending_orders\": 10,\n      \"total_revenue\": 50000.00,\n      \"monthly_revenue\": 5000.00\n    },\n    \"services\": {\n      \"total_hosting\": 50,\n      \"active_hosting\": 40,\n      \"total_domains\": 30,\n      \"active_domains\": 25,\n      \"total_products\": 20,\n      \"active_products\": 18\n    },\n    \"support\": {\n      \"total_tickets\": 100,\n      \"open_tickets\": 15,\n      \"pending_tickets\": 5,\n      \"resolved_tickets\": 80\n    },\n    \"content\": {\n      \"total_pages\": 10,\n      \"total_services\": 8,\n      \"total_projects\": 15,\n      \"total_testimonials\": 25,\n      \"total_slideshow\": 5\n    },\n    \"financial\": {\n      \"total_invoices\": 200,\n      \"paid_invoices\": 150,\n      \"unpaid_invoices\": 30,\n      \"overdue_invoices\": 20,\n      \"total_amount\": 75000.00,\n      \"paid_amount\": 50000.00,\n      \"unpaid_amount\": 25000.00\n    },\n    \"recent_activity\": {\n      \"recent_orders\": [...],\n      \"recent_tickets\": [...],\n      \"recent_users\": [...]\n    },\n    \"charts\": {\n      \"monthly_revenue\": [...],\n      \"orders_by_status\": {...},\n      \"tickets_by_status\": {...}\n    },\n    \"currency\": {\n      \"total_currencies\": 5,\n      \"last_update\": \"2024-01-01 10:00:00\"\n    }\n  }\n}"
      tags:
        - 'Admin / Dashboard'
  /api/admin/dashboard/update-currency:
    post:
      summary: 'Update currency rates'
      operationId: updateCurrencyRates
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message: 'تم تحديث أسعار العملات بنجاح'
                  message_en: 'Currency rates updated successfully'
                  data:
                    updated_count: 5
                    last_update: '2024-01-01 10:00:00'
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'تم تحديث أسعار العملات بنجاح'
                  message_en:
                    type: string
                    example: 'Currency rates updated successfully'
                  data:
                    type: object
                    properties:
                      updated_count:
                        type: integer
                        example: 5
                      last_update:
                        type: string
                        example: '2024-01-01 10:00:00'
      tags:
        - 'Admin / Dashboard'
  /api/admin/dashboard/recent-activity:
    get:
      summary: 'Get recent activities'
      operationId: getRecentActivities
      description: ''
      parameters:
        -
          in: query
          name: limit
          description: 'Number of items to return. Default: 10'
          example: 16
          required: false
          schema:
            type: integer
            description: 'Number of items to return. Default: 10'
            example: 16
            nullable: false
        -
          in: query
          name: type
          description: 'Type of activity (orders|tickets|users|all). Default: all'
          example: architecto
          required: false
          schema:
            type: string
            description: 'Type of activity (orders|tickets|users|all). Default: all'
            example: architecto
            nullable: false
      responses:
        200:
          description: ''
          content:
            text/plain:
              schema:
                type: string
                example: "{\n  \"success\": true,\n  \"message\": \"تم جلب الأنشطة الأخيرة بنجاح\",\n  \"message_en\": \"Recent activities retrieved successfully\",\n  \"data\": {\n    \"activities\": [...]\n  }\n}"
      tags:
        - 'Admin / Dashboard'
  /api/admin/auth/login:
    post:
      summary: 'Admin Login'
      operationId: adminLogin
      description: 'تسجيل دخول الإداري'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message: 'تم تسجيل الدخول بنجاح'
                  message_en: 'Login successful'
                  data:
                    user:
                      id: 1
                      username: admin
                      email: admin@itplus.co
                      full_name: 'Admin User'
                      level_id: 1
                      level_name: 'Super Admin'
                      language: arabic
                      permissions:
                        - all
                    token: 1|abc123...
                    token_type: Bearer
                    expires_at: '2025-11-04T12:00:00.000000Z'
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'تم تسجيل الدخول بنجاح'
                  message_en:
                    type: string
                    example: 'Login successful'
                  data:
                    type: object
                    properties:
                      user:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          username:
                            type: string
                            example: admin
                          email:
                            type: string
                            example: admin@itplus.co
                          full_name:
                            type: string
                            example: 'Admin User'
                          level_id:
                            type: integer
                            example: 1
                          level_name:
                            type: string
                            example: 'Super Admin'
                          language:
                            type: string
                            example: arabic
                          permissions:
                            type: array
                            example:
                              - all
                            items:
                              type: string
                      token:
                        type: string
                        example: 1|abc123...
                      token_type:
                        type: string
                        example: Bearer
                      expires_at:
                        type: string
                        example: '2025-11-04T12:00:00.000000Z'
        401:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  message: 'بيانات الدخول غير صحيحة'
                  message_en: 'Invalid credentials'
                  code: INVALID_CREDENTIALS
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'بيانات الدخول غير صحيحة'
                  message_en:
                    type: string
                    example: 'Invalid credentials'
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
        403:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  message: 'الحساب غير مفعل'
                  message_en: 'Account is inactive'
                  code: ACCOUNT_INACTIVE
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: 'الحساب غير مفعل'
                  message_en:
                    type: string
                    example: 'Account is inactive'
                  code:
                    type: string
                    example: ACCOUNT_INACTIVE
      tags:
        - 'Admin Authentication'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: 'اسم المستخدم أو البريد الإلكتروني.'
                  example: admin
                  nullable: false
                password:
                  type: string
                  description: 'كلمة المرور.'
                  example: password123
                  nullable: false
              required:
                - username
                - password
      security: []
  /api/admin/auth/logout:
    post:
      summary: 'Admin Logout'
      operationId: adminLogout
      description: 'تسجيل خروج الإداري'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message: 'تم تسجيل الخروج بنجاح'
                  message_en: 'Logout successful'
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'تم تسجيل الخروج بنجاح'
                  message_en:
                    type: string
                    example: 'Logout successful'
      tags:
        - 'Admin Authentication'
  /api/admin/auth/me:
    get:
      summary: 'Get Current Admin Info'
      operationId: getCurrentAdminInfo
      description: 'الحصول على معلومات الإداري الحالي'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message: 'تم جلب البيانات بنجاح'
                  message_en: 'Data retrieved successfully'
                  data:
                    user:
                      id: 1
                      username: admin
                      email: admin@itplus.co
                      full_name: 'Admin User'
                      level_id: 1
                      level_name: 'Super Admin'
                      language: arabic
                      permissions:
                        - all
                      last_login: '2025-11-03T12:00:00.000000Z'
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'تم جلب البيانات بنجاح'
                  message_en:
                    type: string
                    example: 'Data retrieved successfully'
                  data:
                    type: object
                    properties:
                      user:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          username:
                            type: string
                            example: admin
                          email:
                            type: string
                            example: admin@itplus.co
                          full_name:
                            type: string
                            example: 'Admin User'
                          level_id:
                            type: integer
                            example: 1
                          level_name:
                            type: string
                            example: 'Super Admin'
                          language:
                            type: string
                            example: arabic
                          permissions:
                            type: array
                            example:
                              - all
                            items:
                              type: string
                          last_login:
                            type: string
                            example: '2025-11-03T12:00:00.000000Z'
      tags:
        - 'Admin Authentication'
  /api/admin/auth/refresh:
    post:
      summary: 'Refresh Token'
      operationId: refreshToken
      description: 'تجديد رمز الوصول'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  success: true
                  message: 'تم تجديد الرمز بنجاح'
                  message_en: 'Token refreshed successfully'
                  data:
                    token: 2|xyz789...
                    token_type: Bearer
                    expires_at: '2025-11-11T12:00:00.000000Z'
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: 'تم تجديد الرمز بنجاح'
                  message_en:
                    type: string
                    example: 'Token refreshed successfully'
                  data:
                    type: object
                    properties:
                      token:
                        type: string
                        example: 2|xyz789...
                      token_type:
                        type: string
                        example: Bearer
                      expires_at:
                        type: string
                        example: '2025-11-11T12:00:00.000000Z'
      tags:
        - 'Admin Authentication'
  /api/health:
    get:
      summary: ''
      operationId: getApiHealth
      description: ''
      parameters: []
      responses:
        500:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Server Error'
                properties:
                  message:
                    type: string
                    example: 'Server Error'
      tags:
        - Endpoints
      security: []
  '/api/{fallbackPlaceholder}':
    get:
      summary: ''
      operationId: getApiFallbackPlaceholder
      description: ''
      parameters: []
      responses:
        500:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Server Error'
                properties:
                  message:
                    type: string
                    example: 'Server Error'
      tags:
        - Endpoints
      security: []
    parameters:
      -
        in: path
        name: fallbackPlaceholder
        description: ''
        example: '|{+-0p'
        required: true
        schema:
          type: string
