openapi: 3.0.3
info:
  title: ''
  version: 1.0.0
paths:
  /accounts/address/{id}:
    get:
      operationId: accounts_address_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - accounts
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAddress'
          description: ''
  /accounts/address/create:
    post:
      operationId: accounts_address_create_create
      tags:
        - accounts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAddress'
          description: ''
  /accounts/address/delete/{id}:
    delete:
      operationId: accounts_address_delete_destroy
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - accounts
      security:
        - jwtAuth: []
      responses:
        '204':
          description: No response body
  /accounts/address/edit/{id}:
    put:
      operationId: accounts_address_edit_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - accounts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UserAddressRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAddress'
          description: ''
    patch:
      operationId: accounts_address_edit_partial_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - accounts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedUserAddressRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedUserAddressRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedUserAddressRequest'
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAddress'
          description: ''
  /accounts/address/list:
    get:
      operationId: accounts_address_list_list
      tags:
        - accounts
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserAddress'
          description: ''
  /accounts/profile:
    get:
      operationId: accounts_profile_retrieve
      tags:
        - accounts
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
          description: ''
    patch:
      operationId: accounts_profile_partial_update
      tags:
        - accounts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedProfileRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedProfileRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedProfileRequest'
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
          description: ''
  /accounts/send_otp:
    post:
      operationId: accounts_send_otp_create
      tags:
        - Authentication
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  type: string
                  example: 09123456789
              required:
                - phone
      security:
        - jwtAuth: []
        - {}
      responses:
        '200':
          description: No response body
  /accounts/verify:
    post:
      operationId: accounts_verify_create
      description: |-
        Takes a token and indicates if it is valid.  This view provides no
        information about a token's fitness for a particular use.
      tags:
        - accounts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenVerifyRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenVerifyRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TokenVerifyRequest'
        required: true
      responses:
        '200':
          description: No response body
  /chat/product/{id}:
    get:
      operationId: chat_product_retrieve
      description: Retrieve all messages for a product chat.
      summary: Retrieve messages for a product chat
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
        - in: query
          name: limit
          schema:
            type: integer
            default: 10
          description: Number of results to return per page.
        - in: query
          name: offset
          schema:
            type: integer
            default: 0
          description: The starting position of the results.
      tags:
        - chat
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: Unspecified response body
          description: ''
    post:
      operationId: chat_product_create
      description: Send a new message in the product chat.
      summary: Send a new message in the product chat
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - chat
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewMessageRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/NewMessageRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/NewMessageRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: Unspecified response body
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: Unspecified response body
          description: ''
  /products/:
    get:
      operationId: products_list
      description: Retrieve products with optional filters and sorting. Provide a
        list of category IDs to filter products by those categories and their subcategories.
      parameters:
        - in: query
          name: category
          schema:
            type: array
            items:
              type: number
          explode: false
          style: form
        - in: query
          name: has_discount
          schema:
            type: boolean
          description: Filter products that have a discount.
        - in: query
          name: in_stock
          schema:
            type: boolean
          description: Filter products that are in stock (positive stock).
        - in: query
          name: limit
          schema:
            type: integer
          description: Number of results to return per page (pagination).
        - in: query
          name: offset
          schema:
            type: integer
          description: The starting position of the results (pagination).
        - in: query
          name: price_gte
          schema:
            type: number
            format: float
          description: Filter products with price greater than or equal to this value.
        - in: query
          name: price_lte
          schema:
            type: number
            format: float
          description: Filter products with price less than or equal to this value.
        - in: query
          name: search
          schema:
            type: string
          description: Search by product name or description.
        - in: query
          name: sort
          schema:
            type: string
          description: |-
            Sort results by one of the following fields:
            `name`, `-name`, `price`, `-price`, `discount`, `-discount`, `created_at`, `-created_at`.
            Prefix with `-` for descending order.
      tags:
        - products
      security:
        - {}
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedProductList'
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
  /products/{id}:
    get:
      operationId: products_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      security:
        - {}
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
          description: ''
  /products/{id}/comments:
    get:
      operationId: products_comments_retrieve_2
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      security:
        - jwtAuth: []
        - {}
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comment'
          description: ''
    post:
      operationId: products_comments_create_2
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommentRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CommentRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CommentRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comment'
          description: ''
    delete:
      operationId: products_comments_destroy_2
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      security:
        - jwtAuth: []
      responses:
        '204':
          description: No response body
  /products/categories:
    get:
      operationId: products_categories_list
      parameters:
        - in: query
          name: search
          schema:
            type: string
          description: Search by category name or description.
      tags:
        - products
      security:
        - {}
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Category'
          description: ''
        '404':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
          description: ''
  /products/comments/{id}:
    get:
      operationId: products_comments_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      security:
        - jwtAuth: []
        - {}
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comment'
          description: ''
    post:
      operationId: products_comments_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommentRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CommentRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CommentRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Comment'
          description: ''
    delete:
      operationId: products_comments_destroy
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - products
      security:
        - jwtAuth: []
      responses:
        '204':
          description: No response body
  /tickets/:
    get:
      operationId: tickets_list
      tags:
        - tickets
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Ticket'
          description: ''
  /tickets/{id}:
    get:
      operationId: tickets_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - tickets
      security:
        - jwtAuth: []
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
          description: ''
  /tickets/{id}/messages:
    post:
      operationId: tickets_messages_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - tickets
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/MessageRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/MessageRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
          description: ''
  /tickets/{id}/update-status:
    post:
      operationId: tickets_update_status_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
      tags:
        - tickets
      security:
        - jwtAuth: []
      responses:
        '200':
          description: No response body
  /tickets/create:
    post:
      operationId: tickets_create_create
      tags:
        - tickets
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TicketRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TicketRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TicketRequest'
        required: true
      security:
        - jwtAuth: []
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticket'
          description: ''
  /token/:
    post:
      operationId: token_create
      description: |-
        Takes a set of user credentials and returns an access and refresh JSON web
        token pair to prove the authentication of those credentials.
      tags:
        - Authentication
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomTokenObtainPairRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CustomTokenObtainPairRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CustomTokenObtainPairRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomTokenObtainPair'
          description: ''
  /token/refresh/:
    post:
      operationId: token_refresh_create
      description: |-
        Takes a refresh type JSON web token and returns an access type JSON web
        token if the refresh token is valid.
      tags:
        - token
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRefreshRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TokenRefreshRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TokenRefreshRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenRefresh'
          description: ''
components:
  schemas:
    Category:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          title: نام دسته‌بندی
          maxLength: 50
        slug:
          type: string
          description: اسم دسته را برای مسیر به انگلیسی و بدون فاصله وارد کنید
          maxLength: 50
          pattern: ^[-a-zA-Z0-9_]+$
        icon:
          type: string
          nullable: true
          title: آیکون دسته‌بندی
          maxLength: 100
        meta_title:
          type: string
          nullable: true
          title: عنوان متا
          description: عنوان متا برای SEO
          maxLength: 60
        meta_description:
          type: string
          nullable: true
          title: توضیحات متا
          description: توضیحات متا برای SEO
          maxLength: 160
        parent:
          type: integer
          nullable: true
          title: دسته‌بندی والد
        children:
          type: string
          readOnly: true
      required:
        - children
        - id
        - name
        - slug
    Comment:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        content:
          type: string
          title: محتوای نظر
        timestamp:
          type: string
          format: date-time
          readOnly: true
          title: زمان ثبت کامنت
        show:
          type: boolean
          readOnly: true
          title: نشان دادن کامنت
        product:
          type: integer
          readOnly: true
          title: محصول
        user:
          type: integer
      required:
        - content
        - id
        - product
        - show
        - timestamp
        - user
    CommentRequest:
      type: object
      properties:
        content:
          type: string
          minLength: 1
          title: محتوای نظر
        user:
          type: integer
      required:
        - content
        - user
    CurrencyEnum:
      enum:
        - dollor
        - toman
        - derham
      type: string
      description: |-
        * `dollor` - دلار
        * `toman` - تومان
        * `derham` - درهم
    CustomTokenObtainPair:
      type: object
      properties:
        otp:
          type: string
    CustomTokenObtainPairRequest:
      type: object
      properties:
        otp:
          type: string
          minLength: 1
        phone:
          type: string
          writeOnly: true
          minLength: 1
      required:
        - phone
    Message:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        content:
          type: string
        created_at:
          type: string
          format: date-time
          readOnly: true
        ticket:
          type: integer
        sender:
          type: integer
      required:
        - content
        - created_at
        - id
        - sender
        - ticket
    MessageRequest:
      type: object
      properties:
        content:
          type: string
          minLength: 1
        ticket:
          type: integer
        sender:
          type: integer
      required:
        - content
        - sender
        - ticket
    NewMessageRequest:
      type: object
      properties:
        new_message:
          type: string
          minLength: 1
          description: The message content to send to the chat.
      required:
        - new_message
    PaginatedProductList:
      type: object
      required:
        - count
        - results
      properties:
        count:
          type: integer
          example: 123
        next:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?offset=400&limit=100
        previous:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?offset=200&limit=100
        results:
          type: array
          items:
            $ref: '#/components/schemas/Product'
    PatchedProfileRequest:
      type: object
      properties:
        first_name:
          type: string
          title: نام
          maxLength: 50
        last_name:
          type: string
          title: نام خانوادگی
          maxLength: 50
        email:
          type: string
          format: email
          nullable: true
          title: ایمیل
          maxLength: 255
        profile_photo:
          type: string
          format: binary
          nullable: true
          title: عکس پروفایل
    PatchedUserAddressRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 30
        address:
          type: string
          minLength: 1
        postal_code:
          type: string
          minLength: 1
          maxLength: 10
        phone:
          type: string
          minLength: 1
          maxLength: 11
    Product:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        price:
          type: string
          readOnly: true
        is_new:
          type: string
          readOnly: true
        name:
          type: string
          maxLength: 255
        description:
          type: string
        currency:
          allOf:
            - $ref: '#/components/schemas/CurrencyEnum'
          title: نوع ارز
        image:
          type: string
          format: uri
        rating:
          type: integer
          maximum: 2147483647
          minimum: 0
        view:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: بازدید
        sell:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: فروش
        in_stock:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: تعداد موجود
        discount:
          type: integer
          maximum: 32767
          minimum: -32768
          title: تخفیف
        slug:
          type: string
          nullable: true
          title: نام یکتا
          description: این فیلد را خالی بگذارید
          pattern: ^[-\w]+$
          maxLength: 50
        meta_description:
          type: string
          nullable: true
          description: این فیلد را حتما پر کنید
          maxLength: 300
        meta_keywords:
          type: string
          nullable: true
          description: این فیلد را حتما پر کنید
          maxLength: 300
        meta_rating:
          type: number
          format: double
          description: امتیاز محصول
        created_at:
          type: string
          format: date-time
          readOnly: true
          title: زمان ثبت محصول
        category:
          type: integer
          nullable: true
      required:
        - created_at
        - currency
        - description
        - id
        - image
        - is_new
        - name
        - price
    Profile:
      type: object
      properties:
        first_name:
          type: string
          title: نام
          maxLength: 50
        last_name:
          type: string
          title: نام خانوادگی
          maxLength: 50
        email:
          type: string
          format: email
          nullable: true
          title: ایمیل
          maxLength: 255
        profile_photo:
          type: string
          format: uri
          nullable: true
          title: عکس پروفایل
        phone:
          type: string
          readOnly: true
          title: شماره تماس
      required:
        - phone
    StatusEnum:
      enum:
        - open
        - in_progress
        - resolved
        - closed
      type: string
      description: |-
        * `open` - Open
        * `in_progress` - In Progress
        * `resolved` - Resolved
        * `closed` - Closed
    Ticket:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
          readOnly: true
        subject:
          type: string
          maxLength: 255
        status:
          $ref: '#/components/schemas/StatusEnum'
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
        customer:
          type: integer
        admin:
          type: integer
          nullable: true
      required:
        - created_at
        - customer
        - id
        - messages
        - subject
        - updated_at
    TicketRequest:
      type: object
      properties:
        subject:
          type: string
          minLength: 1
          maxLength: 255
        status:
          $ref: '#/components/schemas/StatusEnum'
        customer:
          type: integer
        admin:
          type: integer
          nullable: true
      required:
        - customer
        - subject
    TokenRefresh:
      type: object
      properties:
        access:
          type: string
          readOnly: true
        refresh:
          type: string
      required:
        - access
        - refresh
    TokenRefreshRequest:
      type: object
      properties:
        refresh:
          type: string
          minLength: 1
      required:
        - refresh
    TokenVerifyRequest:
      type: object
      properties:
        token:
          type: string
          writeOnly: true
          minLength: 1
      required:
        - token
    UserAddress:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        name:
          type: string
          maxLength: 30
        address:
          type: string
        postal_code:
          type: string
          maxLength: 10
        phone:
          type: string
          maxLength: 11
      required:
        - address
        - id
        - name
        - phone
        - postal_code
    UserAddressRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 30
        address:
          type: string
          minLength: 1
        postal_code:
          type: string
          minLength: 1
          maxLength: 10
        phone:
          type: string
          minLength: 1
          maxLength: 11
      required:
        - address
        - name
        - phone
        - postal_code
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
