{
  "name": "HR Employees CRUD Test",
  "description": "사원 관리 CRUD 테스트 (생성, 조회, 수정, 삭제)",
  "version": "1.0",
  "config": {
    "baseUrl": "",
    "timeout": 30000,
    "stopOnFailure": false
  },
  "variables": {
    "user_id": "{{$env.FLOW_TESTER_USER_ID}}",
    "user_pwd": "{{$env.FLOW_TESTER_USER_PWD}}"
  },
  "steps": [
    {
      "id": "login",
      "name": "1. 로그인",
      "method": "POST",
      "endpoint": "/api/v1/login",
      "body": {
        "user_id": "{{user_id}}",
        "user_pwd": "{{user_pwd}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.access_token": "@isString"
        }
      },
      "extract": {
        "token": "$.access_token"
      }
    },
    {
      "id": "get_stats",
      "name": "2. 사원 통계 조회",
      "method": "GET",
      "endpoint": "/api/v1/employees/stats",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "list_employees",
      "name": "3. 사원 목록 조회",
      "method": "GET",
      "endpoint": "/api/v1/employees?page=1&per_page=10",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "create_employee",
      "name": "4. 사원 등록",
      "method": "POST",
      "endpoint": "/api/v1/employees",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "name": "{{$faker.koreanName}}",
        "email": "{{$faker.email:test}}",
        "phone": "{{$faker.phone}}",
        "employee_code": "{{$faker.employeeCode:EMP}}",
        "position_key": "staff",
        "employment_type_key": "regular",
        "employee_status": "active",
        "hire_date": "{{$faker.date:2024-01-01:2024-12-31}}",
        "work_type": "regular",
        "salary": 4500000,
        "is_active": true
      },
      "expect": {
        "status": [200, 201],
        "jsonPath": {
          "$.success": true,
          "$.data.id": "@isNumber"
        }
      },
      "extract": {
        "employeeId": "$.data.id",
        "employeeName": "$.data.name"
      },
      "continueOnFailure": true
    },
    {
      "id": "get_employee",
      "name": "5. 사원 상세 조회",
      "method": "GET",
      "endpoint": "/api/v1/employees/{{create_employee.employeeId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "update_employee",
      "name": "6. 사원 정보 수정",
      "method": "PATCH",
      "endpoint": "/api/v1/employees/{{create_employee.employeeId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "position_key": "manager",
        "salary": 5500000
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "delete_employee",
      "name": "7. 사원 삭제 (퇴직 처리)",
      "method": "DELETE",
      "endpoint": "/api/v1/employees/{{create_employee.employeeId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200, 204]
      },
      "continueOnFailure": true
    }
  ]
}
