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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68fe061
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
openapi: 3.0.0
info:
  title: Express API Documentation
  version: 1.0.0
  description: This is the API documentation for my Express application.
servers:
  - url: https://934a-45-119-30-178.ngrok-free.app
paths:
  /_healthz:
    get:
      operationId: getHealthZ
      description: Check server health
      responses:
        '200':
          description: Server is healthy
          content:
            text/plain:
              schema:
                type: string
                example: Hello World!
  /company/{companyId}:
    get:
      operationId: getOrVerifyCompanyCredentials
      description: Retrieve company credentials
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The company ID
      responses:
        '200':
          description: Company credentials retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyCreds'
        '404':
          description: Company credentials not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    put:
      operationId: updateCompanyCredentials
      description: Update company credentials
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The company ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompanyCreds'
      responses:
        '200':
          description: Company credentials updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /company/{companyId}/applications:
    get:
      operationId: getSalesChannelByCompany
      description: Retrieve applications for a specific company
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The ID of the company to retrieve applications for
      responses:
        '200':
          description: List of applications for the specified company
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Name of the application
                    id:
                      type: string
                      description: ID of the application
                    token:
                      type: string
                      description: Token associated with the application
                    domain:
                      type: string
                      description: Primary domain of the application
                    logo:
                      type: string
                      description: Logo URL of the application
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /company/{companyId}/brands:
    get:
      summary: Retrieves a list of brands for a specific company
      tags:
        - Brands
      operationId: getCompanyBrands
      description: Fetches a list of brands associated with the given company ID.
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The unique identifier of the company
      responses:
        '200':
          description: A list of brands
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Brand'
    post:
      summary: Creates a new brand for a specific company
      tags:
        - Brands
      operationId: createCompanyBrand
      description: Adds a new brand to the company profile.
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The unique identifier of the company
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BrandCreation'
      responses:
        '200':
          description: Brand created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  id:
                    type: string
  /company/{companyId}/brands/{brandId}:
    put:
      summary: Creates a new brand for a specific company
      tags:
        - Brands
      operationId: updateCompanyBrand
      description: updated an existing brand.
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The unique identifier of the company
        - in: path
          name: brandId
          required: true
          schema:
            type: number
          description: The unique identifier of the brand
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BrandCreation'
      responses:
        '200':
          description: Brand updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  id:
                    type: string
  /company/{companyId}/locations:
    get:
      operationId: getLocationsByCompany
      description: get all company locations
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The ID of the company to add a location for
      responses:
        '200':
          description: location list
          content:
            application/json:
              schema:
                type: array
                items:
                  properties:
                    id:
                      type: number
                      description: Location id
                    code:
                      type: string
                      description: Location code
                    name:
                      type: string
                      description: Location code
                    documents:
                      type: array
                      description: Location gst documents
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            description: document type
                          value:
                            type: string
                            description: document number
                          verified:
                            type: boolean
                            description: document number verification status
                          legal_name:
                            type: boolean
                            description: document owner
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    post:
      operationId: createLocationsForCompany
      description: Add a new location for a specific company
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The ID of the company to add a location for
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUpdateLocation'
      responses:
        '200':
          description: Location created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  id:
                    type: string
                    description: Location id
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /company/{companyId}/locations/{locationId}:
    put:
      operationId: updateLocationByCompany
      description: update a location for a specific company
      tags:
        - Company
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The ID of the company to add a location for
        - in: path
          name: locationId
          required: true
          schema:
            type: string
          description: The ID of the location to be updated
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUpdateLocation'
      responses:
        '200':
          description: Location updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  id:
                    type: string
                    description: Location id
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /company/{companyId}/products:
    post:
      summary: Creates a new product for a given company.
      description: >-
        This endpoint creates a new product with various attributes including
        name, slug, pricing, and more.
      operationId: createProduct
      tags:
        - Products
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: Unique identifier of the company.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - slug
                - seller_identifier
                - brand_id
              properties:
                name:
                  type: string
                  description: Name of the product.
                slug:
                  type: string
                  description: URL-friendly identifier for the product.
                seller_identifier:
                  type: string
                  description: Unique identifier for the seller.
                brand_id:
                  type: string
                  description: Unique identifier for the brand.
                location_id:
                  type: string
                  description: Location identifier for the product.
                mrp:
                  type: number
                  default: 999
                  description: Maximum retail price of the product.
                selling_price:
                  type: number
                  default: 499
                  description: Selling price of the product.
      responses:
        '200':
          description: Successful creation of the product.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  id:
                    type: string
                  seller_identifier:
                    type: string
  /company/{companyId}/products/{productId}/inventory:
    post:
      summary: Updates inventory for a specific product.
      description: >-
        This endpoint updates the inventory details for a given product,
        including location, pricing, and quantity.
      operationId: updateInventory
      tags:
        - Inventory
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: Unique identifier of the company.
        - in: path
          name: productId
          required: true
          schema:
            type: string
          description: Unique identifier of the product.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - location_id
                - seller_identifier
              properties:
                location_id:
                  type: string
                  description: Location identifier where the inventory is stored.
                mrp:
                  type: number
                  default: 999
                  description: Maximum retail price of the product.
                selling_price:
                  type: number
                  default: 499
                  description: Selling price of the product.
                seller_identifier:
                  type: string
                  description: Unique identifier for the seller.
      responses:
        '200':
          description: Successful update of inventory.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
  /company/{companyId}/sales_channel:
    post:
      operationId: addSalesChannel
      summary: Create a sales channel for a given company
      description: This endpoint creates a new sales channel for the specified company.
      tags:
        - Sales Channel
      parameters:
        - in: path
          name: companyId
          required: true
          schema:
            type: string
          description: The ID of the company
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                brand_ids:
                  type: array
                  items:
                    type: integer
                  description: Array of brand IDs to be associated with the sales channel
                name:
                  type: string
                  description: Name of the sales channel
                subdomain:
                  type: string
                  description: subdomain associated with the sales channel
      responses:
        '200':
          description: Sales channel successfully created
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  app:
                    type: object
                    description: Details of the created sales channel
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    CompanyCreds:
      type: object
      properties:
        clientId:
          type: string
          description: Client ID for the company
        clientSecret:
          type: string
          description: Client secret for the company
      required:
        - clientId
        - clientSecret
    CreateUpdateLocation:
      type: object
      required:
        - code
        - name
        - gst
        - manager
        - address
      properties:
        code:
          type: string
          description: Unique code for the location
        name:
          type: string
          description: Name of the location
        gst:
          type: object
          required:
            - legal_name
            - value
          properties:
            legal_name:
              type: string
              description: Legal name for GST purposes
            value:
              type: string
              description: GST value
        manager:
          type: object
          required:
            - manager_name
            - email
            - number
            - country_code
          properties:
            manager_name:
              type: string
              description: Name of the manager
            email:
              type: string
              description: Email of the manager
            number:
              type: string
              description: Contact number of the manager
            country_code:
              type: string
              description: Country code for the manager's contact number
        address:
          type: object
          required:
            - address1
            - country
            - pincode
            - city
            - state
          properties:
            address1:
              type: string
              description: Primary address line
            address2:
              type: string
              description: Secondary address line
            country:
              type: string
              description: Country of the location
            pincode:
              type: string
              description: Postal code of the location
            city:
              type: string
              description: City of the location
            state:
              type: string
              description: State of the location
            latitude:
              type: number
              description: Latitude for the location
            longitude:
              type: number
              description: Longitude for the location
            landmark:
              type: string
              description: Landmark near the location
    Brand:
      type: object
      properties:
        name:
          type: string
        logo:
          type: string
        id:
          type: string
    BrandCreation:
      type: object
      required:
        - name
        - logo
        - description
      properties:
        name:
          type: string
        logo:
          type: string
        description:
          type: string
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
tags: []