openapi: 3.0.3
info:
  title: WAZEN
  description: ''
  version: 1.0.0
servers:
  -
    url: 'http://erp.wazen.test'
paths:
  /api/v1/base/settings/branches:
    get:
      summary: 'List Branches.'
      operationId: listBranches
      description: ''
      parameters:
        -
          in: query
          name: page
          description: 'The page number.'
          example: 1
          required: false
          schema:
            type: integer
            description: 'The page number.'
            example: 1
        -
          in: query
          name: per_page
          description: 'The number of items per page.'
          example: 15
          required: false
          schema:
            type: integer
            description: 'The number of items per page.'
            example: 15
        -
          in: query
          name: company_no
          description: 'The company number.'
          example: 123
          required: false
          schema:
            type: integer
            description: 'The company number.'
            example: 123
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    -
                      id: 1
                      'no': 101
                      name: 'Main Branch'
                      name_ar: 'الفرع الرئيسي'
                      name_en: 'Main Branch'
                      company:
                        id: 1
                        company_no: 123
                        name_ar: شركة
                        name_en: Company
                  message: 'Branches list'
                  pagination:
                    count: 1
                    total: 1
                    perPage: 15
                    currentPage: 1
                    totalPages: 1
                    links: {  }
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        'no': 101
                        name: 'Main Branch'
                        name_ar: 'الفرع الرئيسي'
                        name_en: 'Main Branch'
                        company:
                          id: 1
                          company_no: 123
                          name_ar: شركة
                          name_en: Company
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        'no':
                          type: integer
                          example: 101
                        name:
                          type: string
                          example: 'Main Branch'
                        name_ar:
                          type: string
                          example: 'الفرع الرئيسي'
                        name_en:
                          type: string
                          example: 'Main Branch'
                        company:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            company_no:
                              type: integer
                              example: 123
                            name_ar:
                              type: string
                              example: شركة
                            name_en:
                              type: string
                              example: Company
                  message:
                    type: string
                    example: 'Branches list'
                  pagination:
                    type: object
                    properties:
                      count:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                      perPage:
                        type: integer
                        example: 15
                      currentPage:
                        type: integer
                        example: 1
                      totalPages:
                        type: integer
                        example: 1
                      links:
                        type: object
                        properties: {  }
      tags:
        - Branches
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                company_no:
                  type: integer
                  description: ''
                  example: 2
                per_page:
                  type: integer
                  description: ''
                  example: 19
                page:
                  type: integer
                  description: ''
                  example: 13
    post:
      summary: 'Create Branch'
      operationId: createBranch
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    id: 1
                    'no': 101
                    name: 'Main Branch'
                    name_ar: 'الفرع الرئيسي'
                    name_en: 'Main Branch'
                    company:
                      id: 1
                      company_no: 123
                      name_ar: شركة
                      name_en: Company
                  message: 'Branch created successfully'
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      'no':
                        type: integer
                        example: 101
                      name:
                        type: string
                        example: 'Main Branch'
                      name_ar:
                        type: string
                        example: 'الفرع الرئيسي'
                      name_en:
                        type: string
                        example: 'Main Branch'
                      company:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          company_no:
                            type: integer
                            example: 123
                          name_ar:
                            type: string
                            example: شركة
                          name_en:
                            type: string
                            example: Company
                  message:
                    type: string
                    example: 'Branch created successfully'
      tags:
        - Branches
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                nameAr:
                  type: string
                  description: 'The Arabic name of the branch.'
                  example: 'الفرع الرئيسي'
                nameEn:
                  type: string
                  description: 'The English name of the branch. Defaults to the Arabic name if not provided.'
                  example: 'Main Branch'
                longitude:
                  type: number
                  description: 'The longitude of the branch.'
                  example: 46.6753
                latitude:
                  type: number
                  description: 'The latitude of the branch.'
                  example: 24.7136
                address:
                  type: string
                  description: 'The address of the branch.'
                  example: '1234 Main St'
                phone:
                  type: string
                  description: 'The phone number of the branch.'
                  example: '+966123456789'
                clone:
                  type: boolean
                  description: 'Whether to clone the branch from another branch.'
                  example: true
                clone_from_branch_id:
                  type: integer
                  description: 'required_if:clone,true The ID of the branch to clone from.'
                  example: 1
              required:
                - nameAr
                - clone
  '/api/v1/base/settings/branches/{id}':
    get:
      summary: 'Branch Details'
      operationId: branchDetails
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            text/plain:
              schema:
                type: string
                example: "{\n  \"status\": \"success\",\n  \"message\": \"Branch Details\",\n{\n\"id\": 1,\n\"no\": 101,\n\"name\": \"Main Branch\",\n\"name_ar\": \"الفرع الرئيسي\",\n\"name_en\": \"Main Branch\",\n\"company\": {\n\"id\": 1,\n\"company_no\": 123,\n\"name_ar\": \"شركة\",\n\"name_en\": \"Company\"\n}\n}"
      tags:
        - Branches
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the branch.'
        example: 1
        required: true
        schema:
          type: integer
  /api/v1/base/customers:
    get:
      summary: 'List Customers.'
      operationId: listCustomers
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    -
                      id: 1
                      customer_no: '25100001'
                      name_ar: العميل
                      name_en: Customer
                      mobile: '123456789'
                      address: '123 Main St'
                      active: true
                      customer_class: VIP
                      account_no: ACC123
                      created_at: '2023-01-01T00:00:00Z'
                      updated_at: '2023-01-01T00:00:00Z'
                      company:
                        id: 1
                        company_no: 123
                        name_ar: شركة
                        name_en: Company
                      branch:
                        id: 1
                        branch_no: '123'
                        name_ar: فرع
                        name_en: Branch
                      user:
                        id: 1
                        email: user@example.com
                        username: user1
                  message: 'customers list'
                  pagination:
                    count: 1
                    total: 1
                    perPage: 15
                    currentPage: 1
                    totalPages: 1
                    links: {  }
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        customer_no: '25100001'
                        name_ar: العميل
                        name_en: Customer
                        mobile: '123456789'
                        address: '123 Main St'
                        active: true
                        customer_class: VIP
                        account_no: ACC123
                        created_at: '2023-01-01T00:00:00Z'
                        updated_at: '2023-01-01T00:00:00Z'
                        company:
                          id: 1
                          company_no: 123
                          name_ar: شركة
                          name_en: Company
                        branch:
                          id: 1
                          branch_no: '123'
                          name_ar: فرع
                          name_en: Branch
                        user:
                          id: 1
                          email: user@example.com
                          username: user1
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        customer_no:
                          type: string
                          example: '25100001'
                        name_ar:
                          type: string
                          example: العميل
                        name_en:
                          type: string
                          example: Customer
                        mobile:
                          type: string
                          example: '123456789'
                        address:
                          type: string
                          example: '123 Main St'
                        active:
                          type: boolean
                          example: true
                        customer_class:
                          type: string
                          example: VIP
                        account_no:
                          type: string
                          example: ACC123
                        created_at:
                          type: string
                          example: '2023-01-01T00:00:00Z'
                        updated_at:
                          type: string
                          example: '2023-01-01T00:00:00Z'
                        company:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            company_no:
                              type: integer
                              example: 123
                            name_ar:
                              type: string
                              example: شركة
                            name_en:
                              type: string
                              example: Company
                        branch:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            branch_no:
                              type: string
                              example: '123'
                            name_ar:
                              type: string
                              example: فرع
                            name_en:
                              type: string
                              example: Branch
                        user:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            email:
                              type: string
                              example: user@example.com
                            username:
                              type: string
                              example: user1
                  message:
                    type: string
                    example: 'customers list'
                  pagination:
                    type: object
                    properties:
                      count:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                      perPage:
                        type: integer
                        example: 15
                      currentPage:
                        type: integer
                        example: 1
                      totalPages:
                        type: integer
                        example: 1
                      links:
                        type: object
                        properties: {  }
      tags:
        - Customers
      security: []
  /api/v1/base/journals:
    get:
      summary: 'List Journals.'
      operationId: listJournals
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    -
                      id: 1
                      journal_no: 25100001
                      journal_type:
                        id: 1
                        reference_no: 6
                        name_ar: نوع
                        name_en: Type
                      date:
                        gregorian: '2024-08-11'
                        islamic: '1445-01-28'
                      source: dashboard
                      amounts:
                        debit: 1000.0
                        credit: 1000.0
                      company:
                        id: 1
                        company_no: 123
                        name_ar: شركة
                        name_en: Company
                      branch:
                        id: 1
                        branch_no: 123
                        name_ar: فرع
                        name_en: Branch
                      user:
                        id: 1
                        email: user@example.com
                        username: user1
                  message: 'journals list'
                  pagination:
                    count: 1
                    total: 1
                    perPage: 15
                    currentPage: 1
                    totalPages: 1
                    links: {  }
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: array
                    example:
                      -
                        id: 1
                        journal_no: 25100001
                        journal_type:
                          id: 1
                          reference_no: 6
                          name_ar: نوع
                          name_en: Type
                        date:
                          gregorian: '2024-08-11'
                          islamic: '1445-01-28'
                        source: dashboard
                        amounts:
                          debit: 1000
                          credit: 1000
                        company:
                          id: 1
                          company_no: 123
                          name_ar: شركة
                          name_en: Company
                        branch:
                          id: 1
                          branch_no: 123
                          name_ar: فرع
                          name_en: Branch
                        user:
                          id: 1
                          email: user@example.com
                          username: user1
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        journal_no:
                          type: integer
                          example: 25100001
                        journal_type:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            reference_no:
                              type: integer
                              example: 6
                            name_ar:
                              type: string
                              example: نوع
                            name_en:
                              type: string
                              example: Type
                        date:
                          type: object
                          properties:
                            gregorian:
                              type: string
                              example: '2024-08-11'
                            islamic:
                              type: string
                              example: '1445-01-28'
                        source:
                          type: string
                          example: dashboard
                        amounts:
                          type: object
                          properties:
                            debit:
                              type: number
                              example: 1000.0
                            credit:
                              type: number
                              example: 1000.0
                        company:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            company_no:
                              type: integer
                              example: 123
                            name_ar:
                              type: string
                              example: شركة
                            name_en:
                              type: string
                              example: Company
                        branch:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            branch_no:
                              type: integer
                              example: 123
                            name_ar:
                              type: string
                              example: فرع
                            name_en:
                              type: string
                              example: Branch
                        user:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            email:
                              type: string
                              example: user@example.com
                            username:
                              type: string
                              example: user1
                  message:
                    type: string
                    example: 'journals list'
                  pagination:
                    type: object
                    properties:
                      count:
                        type: integer
                        example: 1
                      total:
                        type: integer
                        example: 1
                      perPage:
                        type: integer
                        example: 15
                      currentPage:
                        type: integer
                        example: 1
                      totalPages:
                        type: integer
                        example: 1
                      links:
                        type: object
                        properties: {  }
      tags:
        - Journals
      security: []
    post:
      summary: 'Create Journal'
      operationId: createJournal
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    id: 1
                    journal_no: 25100001
                    journal_type:
                      id: 1
                      reference_no: 6
                      name_ar: نوع
                      name_en: Type
                    date:
                      gregorian: '2024-08-11'
                      islamic: '1445-01-28'
                    source: dashboard
                    amounts:
                      debit: 1000.0
                      credit: 1000.0
                    company:
                      id: 1
                      company_no: '123'
                      name_ar: شركة
                      name_en: Company
                    branch:
                      id: 1
                      branch_no: '123'
                      name_ar: فرع
                      name_en: Branch
                    user:
                      id: 1
                      email: user@example.com
                      username: user1
                  message: 'journals created successfully'
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      journal_no:
                        type: integer
                        example: 25100001
                      journal_type:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          reference_no:
                            type: integer
                            example: 6
                          name_ar:
                            type: string
                            example: نوع
                          name_en:
                            type: string
                            example: Type
                      date:
                        type: object
                        properties:
                          gregorian:
                            type: string
                            example: '2024-08-11'
                          islamic:
                            type: string
                            example: '1445-01-28'
                      source:
                        type: string
                        example: dashboard
                      amounts:
                        type: object
                        properties:
                          debit:
                            type: number
                            example: 1000.0
                          credit:
                            type: number
                            example: 1000.0
                      company:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          company_no:
                            type: string
                            example: '123'
                          name_ar:
                            type: string
                            example: شركة
                          name_en:
                            type: string
                            example: Company
                      branch:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          branch_no:
                            type: string
                            example: '123'
                          name_ar:
                            type: string
                            example: فرع
                          name_en:
                            type: string
                            example: Branch
                      user:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          email:
                            type: string
                            example: user@example.com
                          username:
                            type: string
                            example: user1
                  message:
                    type: string
                    example: 'journals created successfully'
        400:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: error
                  errors:
                    header.type:
                      - 'The journal type is required.'
                      - 'The journal type must be a number.'
                      - 'Invalid journal type.'
                    header.date:
                      - 'The date must be a valid date.'
                    'lines.*.debit':
                      - 'Debit value is required.'
                      - 'Debit value must be a valid number with up to 8 decimal places.'
                    'lines.*.credit':
                      - 'Credit value is required.'
                      - 'Credit value must be a valid number with up to 8 decimal places.'
                    'lines.*.desc':
                      - 'Description must be a string.'
                    'lines.*.cost_center':
                      - 'Cost center must be a number.'
                    'lines.*.line_no':
                      - 'Line number is required.'
                      - 'Line number must be a number.'
                    'lines.*.account_no':
                      - 'Account number is required.'
                      - 'The account number does not exist for the given account type.'
                    'lines.*.account_type':
                      - 'Account type is required.'
                      - 'Account type must be a number.'
                    lines:
                      - 'The sum of debits must equal the sum of credits.'
                      - 'A line cannot have both debit and credit values.'
                      - 'A line must have either a debit or a credit value.'
                properties:
                  status:
                    type: string
                    example: error
                  errors:
                    type: object
                    properties:
                      header.type:
                        type: array
                        example:
                          - 'The journal type is required.'
                          - 'The journal type must be a number.'
                          - 'Invalid journal type.'
                        items:
                          type: string
                      header.date:
                        type: array
                        example:
                          - 'The date must be a valid date.'
                        items:
                          type: string
                      'lines.*.debit':
                        type: array
                        example:
                          - 'Debit value is required.'
                          - 'Debit value must be a valid number with up to 8 decimal places.'
                        items:
                          type: string
                      'lines.*.credit':
                        type: array
                        example:
                          - 'Credit value is required.'
                          - 'Credit value must be a valid number with up to 8 decimal places.'
                        items:
                          type: string
                      'lines.*.desc':
                        type: array
                        example:
                          - 'Description must be a string.'
                        items:
                          type: string
                      'lines.*.cost_center':
                        type: array
                        example:
                          - 'Cost center must be a number.'
                        items:
                          type: string
                      'lines.*.line_no':
                        type: array
                        example:
                          - 'Line number is required.'
                          - 'Line number must be a number.'
                        items:
                          type: string
                      'lines.*.account_no':
                        type: array
                        example:
                          - 'Account number is required.'
                          - 'The account number does not exist for the given account type.'
                        items:
                          type: string
                      'lines.*.account_type':
                        type: array
                        example:
                          - 'Account type is required.'
                          - 'Account type must be a number.'
                        items:
                          type: string
                      lines:
                        type: array
                        example:
                          - 'The sum of debits must equal the sum of credits.'
                          - 'A line cannot have both debit and credit values.'
                          - 'A line must have either a debit or a credit value.'
                        items:
                          type: string
      tags:
        - Journals
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                header:
                  type: object
                  description: ''
                  example: []
                  properties:
                    type:
                      type: integer
                      description: 'The journal type.'
                      example: 6
                    date:
                      type: date
                      description: 'The date of the journal.'
                      example: '2024-01-01'
                lines:
                  type: array
                  description: ''
                  example:
                    - []
                  items:
                    type: object
                    properties:
                      debit:
                        type: string
                        description: 'Must match the regex /^\d+(\.\d{1,8})?$/.'
                        example: '63'
                      credit:
                        type: string
                        description: 'Must match the regex /^\d+(\.\d{1,8})?$/.'
                        example: '99307'
                      desc:
                        type: string
                        description: ''
                        example: sit
                      cost_center:
                        type: number
                        description: ''
                        example: 66791.98932
                      line_no:
                        type: number
                        description: ''
                        example: 2920117.895
                      account_type:
                        type: number
                        description: ''
                        example: 131119305.0987
                      account_no:
                        type: string
                        description: ''
                        example: deleniti
                      '*':
                        type: object
                        description: ''
                        example:
                          debit: '100.00'
                        properties:
                          debit:
                            type: numeric
                            description: 'Debit amount.'
                            example: '100.00'
                          credit:
                            type: numeric
                            description: 'Credit amount.'
                            example: '100.00'
                          desc:
                            type: string
                            description: 'Description of the journal entry.'
                            example: '"Purchase of office supplies"'
                          cost_center:
                            type: integer
                            description: 'The cost center ID.'
                            example: 1
                          line_no:
                            type: integer
                            description: 'Line number.'
                            example: 1
                          account_type:
                            type: integer
                            description: 'Account type ID.'
                            example: 2
                          account_no:
                            type: integer
                            description: 'Account number.'
                            example: 123456
                    required:
                      - debit
                      - credit
                      - line_no
                      - account_type
                      - account_no
      security: []
  /api/v1/base/journals/import:
    post:
      summary: 'Import journals.'
      operationId: importJournals
      description: ''
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  status: success
                  data:
                    id: 1
                    journal_no: 25100001
                    journal_type:
                      id: 1
                      reference_no: 6
                      name_ar: نوع
                      name_en: Type
                    date:
                      gregorian: '2024-08-11'
                      islamic: '1445-01-28'
                    source: dashboard
                    amounts:
                      debit: 1000.0
                      credit: 1000.0
                    company:
                      id: 1
                      company_no: '123'
                      name_ar: شركة
                      name_en: Company
                    branch:
                      id: 1
                      branch_no: '123'
                      name_ar: فرع
                      name_en: Branch
                    user:
                      id: 1
                      email: user@example.com
                      username: user1
                  message: 'journals created successfully'
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      journal_no:
                        type: integer
                        example: 25100001
                      journal_type:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          reference_no:
                            type: integer
                            example: 6
                          name_ar:
                            type: string
                            example: نوع
                          name_en:
                            type: string
                            example: Type
                      date:
                        type: object
                        properties:
                          gregorian:
                            type: string
                            example: '2024-08-11'
                          islamic:
                            type: string
                            example: '1445-01-28'
                      source:
                        type: string
                        example: dashboard
                      amounts:
                        type: object
                        properties:
                          debit:
                            type: number
                            example: 1000.0
                          credit:
                            type: number
                            example: 1000.0
                      company:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          company_no:
                            type: string
                            example: '123'
                          name_ar:
                            type: string
                            example: شركة
                          name_en:
                            type: string
                            example: Company
                      branch:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          branch_no:
                            type: string
                            example: '123'
                          name_ar:
                            type: string
                            example: فرع
                          name_en:
                            type: string
                            example: Branch
                      user:
                        type: object
                        properties:
                          id:
                            type: integer
                            example: 1
                          email:
                            type: string
                            example: user@example.com
                          username:
                            type: string
                            example: user1
                  message:
                    type: string
                    example: 'journals created successfully'
      tags:
        - Journals
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                header:
                  type: object
                  description: ''
                  example: []
                  properties:
                    type:
                      type: integer
                      description: 'The type of the journal.'
                      example: 6
                    date:
                      type: date
                      description: 'The date of the journal entry in YYYY-MM-DD format.'
                      example: '2024-08-11'
                lines:
                  type: array
                  description: 'The journal lines containing debit, credit, description, and account details.'
                  example:
                    - non
                  items:
                    type: string
              required:
                - lines
      security: []
tags:
  -
    name: Branches
    description: 'Branches Api'
  -
    name: Customers
    description: ''
  -
    name: Journals
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: 'You can retrieve your token by visiting your dashboard and clicking <b>Generate API token</b>.'
security:
  -
    default: []
