/*
	WRTeam Developers
*/

API URL -->> 
	http://eshopweb.store/admin/app/v1/api/{METHOD_NAME}  - (all APIs in one file only)

---------------------------------------------------------------------------
Defined API Methods:-
---------------------------------------------------------------------------

1. login
2  get_orders
3. update_order_status
4. update_order_item_status
5. get_categories
6. get_products
7. get_customers
8. get_transactions
9. get_statistics
10. forgot_password
11. delete_order
12. get_delivery_boys
13. verify_user
14. get_settings
15. update_fcm
16. send_message
17. edit_ticket
18. get_ticket_types
19. get_tickets
20. get_messages
21. get_cities
22. get_areas_by_city_id
23. delete_order_receipt
24. get_order_tracking
25. edit_order_tracking
26. update_receipt_status
27. get_return_requests
28. update_return_request
29. manage_delivery_boy_cash_collection
30. get_delivery_boy_cash_collection
31. add_product
32. upload_media
33. get_media
34. get_zipcodes
35. get_attribute_set
36. get_attributes
37. get_attribute_values
38. get_taxes
39. delete_product
------------------------------------------
What parameters to be Passed?  See here >>
------------------------------------------


Use POST method to pass the parameters

1.login
    mobile: 9874565478
    password: 12345678
    fcm_id: FCM_ID //{ optional }

2. get_orders
    id:101 { optional }
    user_id:101 { optional }
    active_status:received  {received,delivered,cancelled,processed,returned}     // optional
    start_date:2020-09-07 or 2020/09/07 { optional }
    end_date:2021-03-15 or 2021/03/15 { optional }
    search:keyword { optional }
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort: id / date_added // { default - id } optional
    order:DESC/ASC      // { default - DESC } optional
    download_invoice:0 // { default - 0 } optional        
    order_type : digital/simple

3. update_order_status
    order_id:1
    status : received / processed / shipped / delivered / cancelled / returned
    delivery_boy_id: 15 {optional}

4. update_order_item_status
    order_item_id:1
    status : received / processed / shipped / delivered / cancelled / returned

5. get_categories
    id:15               // optional
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:               id / name // { default - id } optional
    order:DESC/ASC      // { default - ASC } optional
    has_child_or_item:false { default - true}  optional

6. get_products
    id:101              // optional
    category_id:29      // optional
    user_id:15          // optional
    search:keyword      // optional
    tags:multiword tag1, tag2, another tag      // optional
    flag:low/sold      // optional
    attribute_value_ids : 34,23,12 // { Use only for filteration } optional
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:p.id / p.date_added / pv.price // { default - p.id } optional
    order:DESC/ASC      // { default - DESC } optional
    is_similar_products:1 // { default - 0 } optional
    top_rated_product: 1 // { default - 0 } optional
    show_only_active_products:false { default - true } optional

7. get_customers
    id: 1001                // { optional}
    search : Search keyword // { optional }
    limit:25                // { default - 25 } optional
    offset:0                // { default - 0 } optional
    sort: id/username/email/mobile/area_name/city_name/date_created // { default - id } optional
    order:DESC/ASC          // { default - DESC } optional

8. get_transactions
    user_id:73              // { optional}
    id: 1001                // { optional}
    transaction_type:transaction / wallet // { default - transaction } optional
    type : COD / stripe / razorpay / paypal / paystack / flutterwave - for transaction | credit / debit - for wallet // { optional }
    search : Search keyword // { optional }
    limit:25                // { default - 25 } optional
    offset:0                // { default - 0 } optional
    sort: id / date_created // { default - id } optional
    order:DESC/ASC          // { default - DESC } optional

9. get_statistics

10. forgot_password
    mobile_no:7894561235            
    new: pass@123

11. delete_order
    order_id:1

12. get_delivery_boys
    id: 1001                // { optional}
    search : Search keyword // { optional }
    limit:25                // { default - 25 } optional
    offset:0                // { default - 0 } optional
    sort: id/username/email/mobile/area_name/city_name/date_created // { default - id } optional
    order:DESC/ASC          // { default - DESC } optional

13. verify_user
    mobile: 9874565478
    email: test@gmail.com // { optional }

14. get_settings
    type : payment_method // { default : all  } optional            
    user_id:  15 { optional }

15. update_fcm
    user_id:12
    fcm_id: FCM_ID

16. delete_order_receipt
    id=57 

17. get_order_tracking
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:               // { id } optional
    order:DESC/ASC      // { default - DESC } optional
    search:value        // {optional} 

18. edit_order_tracking
    order_id:57 
    order_item_id:123
    courier_agency:asd agency
    tracking_id:t_id123
    url:http://test.com

19. update_receipt_status

    order_id:57 
    user_id:123
    status:1        // { 0:pending|1:rejected|2:accepted }  

27. get_return_requests
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:               // { id } optional
    order:DESC/ASC      // { default - DESC } optional
    search:value        // {optional} 
    
28. update_return_request
    return_request_id:57 
    order_item_id:123 
    status:1        // { 0:pending|1:accepted|2:rejected }  
    update_remarks:  //{optional}

29. manage_delivery_boy_cash_collection
    delivery_boy_id:57 
    amount:123 
    transaction_date: 2021-12-08T16:13  // {optional}
    message:test  //{optional}

30. get_delivery_boy_cash_collection
    delivery_boy_id:15  // {optional}
    status:             // {delivery_boy_cash (delivery boy collected) | delivery_boy_cash_collection (admin collected)}
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:               // { id } optional
    order:DESC/ASC      // { default - DESC } optional
    search:value        // {optional} 

31. add_product
    user_id:1
    pro_input_name: product name
    short_description: description
    product_identity:product identity
    tags:tag1,tag2,tag3     //{comma saprated}
    pro_input_tax:tax_id
    indicator:1             //{ 0 - none | 1 - veg | 2 - non-veg }
    made_in: india          //{optional}
    brand: Adidas          //{optional}
    total_allowed_quantity:100
    minimum_order_quantity:12
    quantity_step_size:1
    warranty_period:1 month     {optional}
    guarantee_period:1 month   {optional}
    deliverable_type:1        //{0:none, 1:all, 2:include, 3:exclude}
    deliverable_zipcodes:1,2,3  //{NULL: if deliverable_type = 0 or 1}
    is_prices_inclusive_tax:0   //{1: inclusive | 0: exclusive}
    cod_allowed:1               //{ 1:allowed | 0:not-allowed }

   if(product_type == digital_product){

    download_allowed:1               //{ 1:allowed | 0:not-allowed }
    download_link_type:self_hosted             //{ values : self_hosted | add_link }
    pro_input_zip:file              //when download type is self_hosted add file for download
    download_link : url             //{URL of download file}
   
   }

    is_returnable:1             // { 1:returnable | 0:not-returnable } 
    is_cancelable:1             //{1:cancelable | 0:not-cancelable}
    cancelable_till:            //{received,processed,shipped}
    pro_input_image:file
    other_images: files
    video_type:                 // {values: vimeo | youtube}
    video:                      //{URL of video}
    pro_input_video: file
    pro_input_description:product's description 
    category_id:99
    attribute_values:1,2,3,4,5
    --------------------------------------------------------------------------------
    till above same params
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    common param for simple and variable product
    --------------------------------------------------------------------------------          
    product_type:simple_product | variable_product | digital_product 
    variant_stock_level_type:product_level | variable_level
    
    if(product_type == digital_product):
        simple_price:100
        simple_special_price:90

    if(product_type == variable_product):
        variants_ids:3 5,4 5,1 2
        variant_price:100,200
        variant_special_price:90,190
        variant_images:files              //{optional}

        sku_variant_type:test            //{if (variant_stock_level_type == product_level)}
        total_stock_variant_type:100     //{if (variant_stock_level_type == product_level)}
        variant_status:1                 //{if (variant_stock_level_type == product_level)}

        variant_sku:test,test             //{if(variant_stock_level_type == variable_level)}
        variant_total_stock:120,300       //{if(variant_stock_level_type == variable_level)}
        variant_level_stock_status:1,1    //{if(variant_stock_level_type == variable_level)}

    if(product_type == simple_product):
        simple_product_stock_status:null|0|1   {1=in stock | 0=out stock}
        simple_price:100
        simple_special_price:90
        product_sku:test                    {optional}
        product_total_stock:100             {optional}
        variant_stock_status: 0             {optional}//{0 =>'Simple_Product_Stock_Active' 1 => "Product_Level" 2 => "Variable_Level"	}

32. upload_media
    user_id:1
    documents[]:FILES

33. get_media
    limit:25            // { default - 25 } optional
    offset:0            // { default - 0 } optional
    sort:               // { id } optional
    order:DESC/ASC      // { default - DESC } optional
    search:value        // {optional} 
    type:image          // {documents,spreadsheet,archive,video,audio,image}

34. get_zipcodes
    limit:10 {optional}
    offset:0 {optional}
    search:0 {optional}

35. get_attribute_set
    sort: ats.name              // { ats.name / ats.id } optional
    order:DESC/ASC      // { default - ASC } optional
    search:value        // {optional} 
    limit:10  {optional}
    offset:10  {optional}

36. get_attributes
    attribute_set_id:1  // {optional}
    sort: a.name              // { a.name / a.id } optional
    order:DESC/ASC      // { default - ASC } optional
    search:value        // {optional} 
    limit:10  {optional}
    offset:10  {optional}

37. get_attribute_values
    attribute_id:1  // {optional}
    sort:a.name               // { a.name / a.id } optional
    order:DESC/ASC      // { default - ASC } optional
    search:value        // {optional} 
    limit:10  {optional}
    offset:10  {optional}

38. get_taxes

39. delete_product
    product_id:1
    

40. add_brand
     
    brand_input_name : test
    brand_input_image : relative_path_of_image (uploads/media/2022/9624-2022-02-241.jpeg)

    if : edit brand

    edit_brand : 24 (brand_id)
    brand_input_name : test
    brand_input_image : relative_path_of_image (uploads/media/2022/9624-2022-02-241.jpeg)

41. get_brands_data

42.delete_brand
    id : 1

43. send_digital_product_mail
    
    order_id : 1
    order_item_id : 101
    customer_email: abc123@gmail.com
    subject : this is test mail
    message : this is our first test mail for digital product
    username : Admin
    attachment : file url for attachment

44. get_digital_order_mails

    order_id:156 {optional}
    order_item_id:5 {optional}

45. manage_stock

    product_variant_id:156
    quantity:5
    type:add/subtract 

    if type is subtract then need to pass current_stock
    current_stock:102