{
  "name": "품목기준관리 통합 테스트",
  "description": "품목기준관리 API의 전체 CRUD 플로우를 테스트합니다.",
  "version": "1.0",
  "config": {
    "apiKey": "42Jfwc6EaRQ04GNRmLR5kzJp5UudSOzGGqjmdk1a",
    "baseUrl": "https://api.sam.kr/api/v1",
    "timeout": 30000,
    "stopOnFailure": true
  },
  "variables": {
    "user_id": "codebridgex",
    "user_pwd": "code1234",
    "testItemCode": "TEST-ITEM-{{$timestamp}}",
    "testItemName": "테스트 품목",
    "testItemSpec": "100x100x10",
    "updatedItemName": "수정된 테스트 품목",
    "updatedItemSpec": "200x200x20"
  },
  "steps": [
    {
      "id": "login",
      "name": "로그인",
      "method": "POST",
      "endpoint": "/login",
      "body": {
        "user_id": "{{variables.user_id}}",
        "user_pwd": "{{variables.user_pwd}}"
      },
      "extract": {
        "accessToken": "$.access_token"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.access_token": "@isString"
        }
      }
    },
    {
      "id": "create_item",
      "name": "품목 생성",
      "method": "POST",
      "endpoint": "/item-master-data",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "body": {
        "item_code": "{{variables.testItemCode}}",
        "item_name": "{{variables.testItemName}}",
        "item_spec": "{{variables.testItemSpec}}",
        "item_type": "PRODUCT",
        "unit": "EA",
        "is_active": true
      },
      "dependsOn": ["login"],
      "extract": {
        "createdItemId": "$.data.id",
        "createdItemCode": "$.data.item_code"
      },
      "expect": {
        "status": [201],
        "jsonPath": {
          "$.data.id": "@exists"
        }
      }
    },
    {
      "id": "get_item",
      "name": "품목 단건 조회",
      "method": "GET",
      "endpoint": "/item-master-data/{{create_item.createdItemId}}",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "dependsOn": ["create_item"],
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.data.id": "@exists"
        }
      }
    },
    {
      "id": "list_items",
      "name": "품목 목록 조회",
      "method": "GET",
      "endpoint": "/item-master-data",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "dependsOn": ["create_item"],
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.data": "@isArray"
        }
      }
    },
    {
      "id": "update_item",
      "name": "품목 수정",
      "method": "PUT",
      "endpoint": "/item-master-data/{{create_item.createdItemId}}",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "body": {
        "item_name": "{{variables.updatedItemName}}",
        "item_spec": "{{variables.updatedItemSpec}}"
      },
      "dependsOn": ["get_item"],
      "expect": {
        "status": [200]
      }
    },
    {
      "id": "verify_update",
      "name": "수정 확인",
      "method": "GET",
      "endpoint": "/item-master-data/{{create_item.createdItemId}}",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "dependsOn": ["update_item"],
      "expect": {
        "status": [200]
      }
    },
    {
      "id": "delete_item",
      "name": "품목 삭제",
      "method": "DELETE",
      "endpoint": "/item-master-data/{{create_item.createdItemId}}",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "dependsOn": ["verify_update"],
      "expect": {
        "status": [200]
      }
    },
    {
      "id": "verify_delete",
      "name": "삭제 확인",
      "method": "GET",
      "endpoint": "/item-master-data/{{create_item.createdItemId}}",
      "headers": {
        "Authorization": "Bearer {{login.accessToken}}"
      },
      "dependsOn": ["delete_item"],
      "expect": {
        "status": [404]
      }
    }
  ]
}