{
  "openapi": "3.1.0",
  "info": {
    "title": "Videm Panel API",
    "version": "1.0.0",
    "description": "مشخصات endpointهای __panel مطابق مستندات پنل. برای تمام فیلدهای فایل، ابتدا فایل را با endpoint آپلود تک‌فایل ارسال کنید و سپس مقدار data.path پاسخ را در فیلد مربوطه قرار دهید؛ برای نمونه image مسیر آموزشی یا Template باید همین path باشد، نه URL یا فایل multipart."
  },
  "servers": [
    {
      "url": "https://panel-api.videm.ir",
      "description": "دامنهٔ API پنل Videm"
    }
  ],
  "security": [
    {
      "BasicAuth": []
    }
  ],
  "tags": [
    {
      "name": "Panel API",
      "description": "API پنل با Basic authentication"
    },
    {
      "name": "Learning paths",
      "description": "مسیرهای آموزشی اختصاصی"
    }
  ],
  "paths": {
    "/api/__panel/media/uploads/single": {
      "post": {
        "tags": [
          "Panel API"
        ],
        "summary": "آپلود یک فایل در فضای موقت",
        "description": "فایل را در فیلد multipart با نام file ارسال کنید. سپس مقدار data.path پاسخ را بدون تغییر در فیلد فایل درخواست اصلی قرار دهید. برای نمونه، image مسیر آموزشی و image الگوی مسیر آموزشی (Template) هر دو همین قرارداد را دارند؛ URL یا خود فایل را در image ارسال نکنید.",
        "operationId": "panel_single_file_upload",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "فایل در فضای temp ذخیره شد",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "message",
                    "data"
                  ],
                  "properties": {
                    "status": {
                      "type": "boolean",
                      "const": true
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "path فایل موقت؛ این مقدار را بدون تغییر در فیلد مربوط به فایل، مانند image مسیر آموزشی یا Template، ارسال کنید."
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "فایل ارسال نشده یا آپلود ناموفق بوده است"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/__panel/courses": {
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CourseController@index",
        "operationId": "App_Http_Controllers_ApiToken_CourseController_index_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}": {
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CourseController@show",
        "operationId": "App_Http_Controllers_ApiToken_CourseController_show_get",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/assistants": {
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CourseController@staff",
        "operationId": "App_Http_Controllers_ApiToken_CourseController_staff_get",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/customers": {
      "post": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@store",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_store_post",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      },
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@index",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_index_get",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/customers/{customer}": {
      "put": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@update",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_update_put",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      },
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@show",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_show_get",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/customers/{customer}/drip_start": {
      "post": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@dripStart",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_dripStart_post",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/customers/{customer}/drip_stop": {
      "post": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@dripStop",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_dripStop_post",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/courses/{course}/customers/{customer}/installments/{installmentNumber}/payment": {
      "put": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\CustomerController@markInstallmentPaid",
        "operationId": "App_Http_Controllers_ApiToken_CustomerController_markInstallmentPaid_put",
        "parameters": [
          {
            "name": "course",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "installmentNumber",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/learning-path-templates": {
      "get": {
        "tags": [
          "Learning paths"
        ],
        "summary": "دریافت الگوهای مسیر آموزشی",
        "operationId": "App_Http_Controllers_ApiToken_LearningPathController_templates_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "فهرست templateها",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthenticated",
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation error"
          }
        },
        "description": "فقط templateهای متعلق به owner فعلی را برمی‌گرداند.",
        "security": [
          {
            "BasicAuth": []
          }
        ]
      }
    },
    "/api/__panel/learning-paths": {
      "get": {
        "tags": [
          "Learning paths"
        ],
        "summary": "دریافت لیست مسیرهای آموزشی",
        "description": "فقط مسیرهای متعلق به owner فعلی را به‌صورت paginated برمی‌گرداند. فیلتر title روی عنوان و فیلتر customer روی نام یا موبایل شرکت‌کننده اعمال می‌شود. هر آیتم UUID دوره، تعداد شرکت‌کننده‌ها و نام حداکثر دو شرکت‌کننده را دارد و شناسهٔ عددی مسیر ارسال نمی‌شود.",
        "operationId": "App_Http_Controllers_ApiToken_LearningPathController_index_get",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "title",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          },
          {
            "name": "customer",
            "in": "query",
            "required": false,
            "description": "بخشی از نام یا موبایل شرکت‌کننده؛ موبایل با صفر ابتدایی نیز پذیرفته می‌شود.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 15
            }
          }
        ],
        "responses": {
          "200": {
            "description": "فهرست صفحه‌بندی‌شده مسیرهای آموزشی",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "links",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "uuid",
                          "title",
                          "customers_count",
                          "customers"
                        ],
                        "properties": {
                          "uuid": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "title": {
                            "type": "string"
                          },
                          "customers_count": {
                            "type": "integer"
                          },
                          "customers": {
                            "type": "array",
                            "maxItems": 2,
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "links": {
                      "type": "object"
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      },
      "post": {
        "tags": [
          "Learning paths"
        ],
        "summary": "ساخت مسیر آموزشی مستقیم",
        "operationId": "App_Http_Controllers_ApiToken_LearningPathController_store_post",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "$ref": "#/components/responses/LearningPathResponse"
          },
          "401": {
            "description": "Unauthenticated",
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation error",
            "$ref": "#/components/responses/ValidationError"
          }
        },
        "description": "یک مسیر مستقل می‌سازد و همان لحظه به مشتریِ پیدا شده یا ساخته‌شده با mobile اختصاص می‌دهد؛ customer_id در بدنه دریافت نمی‌شود. چون دوره در این عملیات ساخته می‌شود UUID ورودی ندارد و UUID دورهٔ ساخته‌شده در data.uuid پاسخ برمی‌گردد؛ تمام عملیات بعدی با همان UUID انجام می‌شوند. هر lesson باید فقط یک بار بیاید، به course_content_id همان course_id تعلق داشته باشد و دورهٔ مبدأ متعلق به owner باشد. installment_count و drip.lessons_per_release نمی‌توانند از تعداد lessonهای مسیر بیشتر باشند.",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLearningPathRequest"
              }
            }
          }
        }
      }
    },
    "/api/__panel/learning-paths/with_template": {
      "post": {
        "tags": [
          "Learning paths"
        ],
        "summary": "اختصاص مسیر آموزشی به مشتری از روی template",
        "operationId": "App_Http_Controllers_ApiToken_LearningPathController_assign_post",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response",
            "$ref": "#/components/responses/LearningPathResponse"
          },
          "401": {
            "description": "Unauthenticated",
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "description": "Validation error",
            "$ref": "#/components/responses/ValidationError"
          }
        },
        "description": "از snapshot الگوی انتخاب‌شده مسیر مستقلی برای مشتری می‌سازد. template باید متعلق به owner احراز هویت‌شده باشد؛ مشتری با mobile پیدا یا ساخته می‌شود و customer_id در بدنه دریافت نمی‌شود. UUID دورهٔ ساخته‌شده در data.uuid پاسخ برمی‌گردد و تمام عملیات بعدی با همان UUID انجام می‌شوند. installment_count و drip.lessons_per_release نمی‌توانند از تعداد lessonهای الگو بیشتر باشند. تغییر بعدی template روی مسیر ساخته‌شده اثری ندارد.",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssignTemplateLearningPathRequest"
              }
            }
          }
        }
      }
    },
    "/api/__panel/me": {
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\UserController@get",
        "operationId": "App_Http_Controllers_ApiToken_UserController_get_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/tags": {
      "get": {
        "tags": [
          "Panel API"
        ],
        "summary": "App\\Http\\Controllers\\ApiToken\\TagController@index",
        "operationId": "App_Http_Controllers_ApiToken_TagController_index_get",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful response"
          },
          "401": {
            "description": "Unauthenticated"
          },
          "422": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/__panel/learning-paths/{uuid}": {
      "get": {
        "tags": [
          "Learning paths"
        ],
        "summary": "دریافت مسیر آموزشی",
        "description": "مسیر آموزشی را با UUID دوره دریافت می‌کند. پاسخ شامل تنظیمات، وضعیت شرکت‌کننده‌ها و استادیارهای متصل به هر شرکت‌کننده است و id یا course_id عددی برنمی‌گرداند.",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "UUID دورهٔ مسیر آموزشی؛ شناسهٔ عددی پذیرفته نمی‌شود.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LearningPathResponse"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "مسیر یافت نشد"
          }
        }
      },
      "put": {
        "tags": [
          "Learning paths"
        ],
        "summary": "ویرایش مسیر آموزشی",
        "description": "learning_path کامل اجباری است و ساختار موجود را جایگزین می‌کند. هر lesson باید فقط یک بار بیاید، به course_content_id همان course_id تعلق داشته باشد و دورهٔ مبدأ متعلق به owner باشد. installment_count و drip.lessons_per_release نمی‌توانند از تعداد lessonهای مسیر بیشتر باشند.",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateLearningPathRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/LearningPathResponse"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "مسیر یافت نشد"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      },
      "delete": {
        "tags": [
          "Learning paths"
        ],
        "summary": "حذف مسیر آموزشی",
        "description": "مسیر آموزشی را حذف می‌کند و ثبت‌نام‌های course_customer، اقساط، ارتباط مشتری با استادیار و دورهٔ ثبت‌شده در فهرست استادیار را پاک‌سازی می‌کند.",
        "security": [
          {
            "BasicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "مسیر حذف شد"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "مسیر یافت نشد"
          }
        }
      }
    },
    "/api/__panel/learning-paths/{uuid}/courses/{sourceCourseUuid}": {
      "delete": {
        "tags": [
          "Learning paths"
        ],
        "summary": "حذف درس‌های یک دوره از مسیر آموزشی",
        "description": "تمام lessonهای دورهٔ مبدأ با UUID ارسالی را حذف می‌کند؛ بخش‌های خالی حذف و state و metrics مسیر بازسازی می‌شوند.",
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sourceCourseUuid",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/LearningPathResponse"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "مسیر یافت نشد"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BasicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "نام کاربری و گذرواژه را از پنل دریافت و در Basic Authentication وارد کنید. این تنظیم به‌صورت global به همهٔ endpointهای پنل اعمال می‌شود."
      }
    },
    "responses": {
      "LearningPathResponse": {
        "description": "مسیر آموزشی",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/LearningPathResponse"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "اطلاعات Basic authentication نامعتبر است"
      },
      "ValidationError": {
        "description": "ورودی نامعتبر است"
      }
    },
    "schemas": {
      "LearningPathStructure": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 5000,
            "description": "توضیحات مسیر آموزشی؛ برای الگو نیز داخل learning_path ارسال و دریافت می‌شود."
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/LearningPathSection"
            }
          }
        }
      },
      "LearningPathSection": {
        "type": "object",
        "required": [
          "type",
          "title",
          "sort",
          "lessons"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "section"
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "sort": {
            "type": "integer",
            "minimum": 1
          },
          "lessons": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/LearningPathLesson"
            }
          }
        }
      },
      "LearningPathLesson": {
        "type": "object",
        "required": [
          "type",
          "title",
          "sort",
          "course_id",
          "course_content_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "lesson"
          },
          "title": {
            "type": "string",
            "maxLength": 255
          },
          "sort": {
            "type": "integer",
            "minimum": 1
          },
          "course_id": {
            "type": "integer",
            "minimum": 1
          },
          "course_content_id": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "Drip": {
        "type": "object",
        "required": [
          "interval_days",
          "lessons_per_release"
        ],
        "properties": {
          "interval_days": {
            "type": "integer",
            "minimum": 1,
            "description": "فاصلهٔ انتشارها برحسب روز"
          },
          "lessons_per_release": {
            "type": "integer",
            "minimum": 1,
            "description": "تعداد درس‌هایی که در هر نوبت منتشر می‌شوند"
          }
        }
      },
      "Settings": {
        "type": "object",
        "properties": {
          "devices_limit": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "has_pwa": {
            "type": "boolean"
          },
          "downloadable": {
            "type": "boolean"
          }
        }
      },
      "ExecutionSettings": {
        "type": "object",
        "properties": {
          "expire_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "first_login_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "installment_count": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 2
          },
          "drip": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Drip"
              },
              {
                "type": "null"
              }
            ]
          },
          "settings": {
            "$ref": "#/components/schemas/Settings"
          }
        }
      },
      "CreateLearningPathRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionSettings"
          },
          {
            "type": "object",
            "required": [
              "idempotency_key",
              "name",
              "mobile",
              "code",
              "learning_path"
            ],
            "properties": {
              "idempotency_key": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "maxLength": 128
              },
          "mobile": {
            "type": "string",
            "pattern": "^0?9\\d{9}$",
            "description": "شماره موبایل بدون کد کشور؛ صفر ابتدای شماره پذیرفته و پیش از اعتبارسنجی حذف می‌شود، مانند 09123456789"
              },
              "code": {
                "type": "string",
                "maxLength": 5,
                "description": "کد کشور؛ مانند +98"
              },
              "assistant_id": {
                "type": "array",
                "uniqueItems": true,
                "description": "شناسه‌های استادیارهای متعلق به همان owner؛ هر مورد باید نقش assistant داشته باشد.",
                "items": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "image": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "اختیاری؛ ابتدا فایل را با POST /api/__panel/media/uploads/single آپلود کنید و مقدار data.path پاسخ را بدون تغییر در image قرار دهید. URL یا فایل multipart ارسال نکنید."
              },
              "learning_path": {
                "$ref": "#/components/schemas/LearningPathStructure"
              }
            }
          }
        ]
      },
      "AssignTemplateLearningPathRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionSettings"
          },
          {
            "type": "object",
            "required": [
              "idempotency_key",
              "name",
              "mobile",
              "code",
              "template_id"
            ],
            "properties": {
              "idempotency_key": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string",
                "maxLength": 128
              },
              "mobile": {
                "type": "string",
                "pattern": "^0?9\\d{9}$",
                "description": "شماره موبایل بدون کد کشور؛ مانند 09123456789"
              },
              "code": {
                "type": "string",
                "maxLength": 5,
                "description": "کد کشور؛ مانند +98"
              },
          "template_id": {
            "type": "integer",
            "minimum": 1,
            "description": "شناسهٔ الگو؛ باید متعلق به owner احراز هویت‌شده باشد"
              },
              "assistant_id": {
                "type": "array",
                "uniqueItems": true,
                "description": "شناسه‌های استادیارهای متعلق به همان owner؛ هر مورد باید نقش assistant داشته باشد.",
                "items": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        ]
      },
      "UpdateLearningPathRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ExecutionSettings"
          },
          {
            "type": "object",
            "required": [
              "learning_path"
            ],
            "properties": {
              "assistant_id": {
                "type": "array",
                "uniqueItems": true,
                "description": "شناسه‌های استادیارهای متعلق به همان owner؛ هر مورد باید نقش assistant داشته باشد.",
                "items": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "image": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "نبودن کلید تصویر فعلی را حفظ می‌کند. برای جایگزینی، فایل را با POST /api/__panel/media/uploads/single آپلود و مقدار data.path پاسخ را در image ارسال کنید؛ null تصویر را حذف می‌کند."
              },
              "learning_path": {
                "$ref": "#/components/schemas/LearningPathStructure"
              }
            }
          }
        ]
      },
      "Media": {
        "type": "object",
        "required": [
          "id",
          "name",
          "url",
          "size",
          "mime"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "size": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          }
        }
      },
      "LearningPath": {
        "type": "object",
        "required": [
          "uuid",
          "learning_path"
        ],
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "UUID دوره‌ای که مسیر آموزشی را نمایندگی می‌کند"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Media"
              },
              {
                "type": "null"
              }
            ],
            "description": "تصویر دورهٔ مسیر آموزشی"
          },
          "template_id": {
            "type": [
              "integer",
              "null"
            ]
          },
          "drip": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Drip"
              },
              {
                "type": "null"
              }
            ]
          },
          "learning_path": {
            "$ref": "#/components/schemas/LearningPathStructure"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "LearningPathResponse": {
        "type": "object",
        "required": [
          "status",
          "message",
          "data"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "const": true
          },
          "message": {
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/LearningPath"
          }
        }
      },
      "LearningPathTemplate": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "owner_id": {
            "type": "integer"
          },
          "image": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Media"
              },
              {
                "type": "null"
              }
            ],
            "description": "تصویر Template. در ساخت یا ویرایش، فایل ابتدا با آپلودر تک‌فایل ارسال و مقدار data.path پاسخ در فیلد image قرار می‌گیرد."
          },
          "learning_path": {
            "$ref": "#/components/schemas/LearningPathStructure"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TemplateListResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "boolean",
            "const": true
          },
          "message": {
            "type": "string"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LearningPathTemplate"
            }
          }
        }
      }
    }
  }
}
