{
  "version": "1.0",
  "meta": {
    "name": "Items CRUD Test",
    "description": "CRUD test with Faker",
    "tags": ["items", "crud", "faker"]
  },
  "config": {
    "baseUrl": "https://api.sam.kr/api/v1",
    "timeout": 30000,
    "stopOnFailure": false,
    "headers": {
      "Accept": "application/json",
      "Content-Type": "application/json"
    }
  },
  "variables": {},
  "steps": [
    {
      "id": "create_item",
      "name": "Create Item",
      "method": "POST",
      "endpoint": "/items",
      "body": {
        "code": "{{$faker.itemCode:TEST}}",
        "name": "{{$faker.productName}}",
        "item_type": "PRODUCT",
        "unit": "{{$faker.unit}}",
        "unit_price": "{{$faker.price:1000:50000}}",
        "description": "{{$faker.sentence}}",
        "is_active": true
      },
      "expect": {
        "status": [200, 201],
        "jsonPath": {
          "$.success": true,
          "$.data.code": "@isString"
        }
      },
      "extract": {
        "itemCode": "$.data.code",
        "itemId": "$.data.id"
      }
    },
    {
      "id": "get_item",
      "name": "Get Item by Code",
      "dependsOn": ["create_item"],
      "method": "GET",
      "endpoint": "/items/code/{{create_item.itemCode}}",
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "update_item",
      "name": "Update Item",
      "dependsOn": ["get_item"],
      "method": "PUT",
      "endpoint": "/items/{{create_item.itemCode}}",
      "body": {
        "name": "Updated Product",
        "unit_price": "{{$faker.price:50000:100000}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "delete_item",
      "name": "Delete Item",
      "dependsOn": ["update_item"],
      "method": "DELETE",
      "endpoint": "/items/{{create_item.itemCode}}",
      "expect": {
        "status": [200, 204]
      }
    },
    {
      "id": "verify_delete",
      "name": "Verify Delete",
      "dependsOn": ["delete_item"],
      "method": "GET",
      "endpoint": "/items/code/{{create_item.itemCode}}",
      "expect": {
        "status": [404]
      },
      "continueOnFailure": true
    }
  ]
}