{
  "name": "HR Attendances CRUD Test",
  "description": "근태 관리 테스트 (출퇴근, 조회, 수정, 통계)",
  "version": "1.0",
  "config": {
    "baseUrl": "",
    "timeout": 30000,
    "stopOnFailure": false
  },
  "variables": {
    "user_id": "{{$env.FLOW_TESTER_USER_ID}}",
    "user_pwd": "{{$env.FLOW_TESTER_USER_PWD}}",
    "testUserId": 1
  },
  "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": "monthly_stats",
      "name": "2. 월별 근태 통계 조회",
      "method": "GET",
      "endpoint": "/api/v1/attendances/monthly-stats?year=2024&month=12",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "list_attendances",
      "name": "3. 근태 목록 조회",
      "method": "GET",
      "endpoint": "/api/v1/attendances?page=1&per_page=10",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "check_in",
      "name": "4. 출근 체크인",
      "method": "POST",
      "endpoint": "/api/v1/attendances/check-in",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "check_in": "09:00:00",
        "gps_data": {
          "latitude": 37.5665,
          "longitude": 126.9780,
          "accuracy": 10
        }
      },
      "expect": {
        "status": [200, 201]
      },
      "extract": {
        "attendanceId": "$.data.id"
      },
      "continueOnFailure": true
    },
    {
      "id": "check_out",
      "name": "5. 퇴근 체크아웃",
      "method": "POST",
      "endpoint": "/api/v1/attendances/check-out",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "check_out": "18:00:00",
        "gps_data": {
          "latitude": 37.5665,
          "longitude": 126.9780,
          "accuracy": 10
        }
      },
      "expect": {
        "status": [200]
      },
      "continueOnFailure": true
    },
    {
      "id": "create_attendance",
      "name": "6. 근태 수동 등록",
      "method": "POST",
      "endpoint": "/api/v1/attendances",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "user_id": "{{testUserId}}",
        "base_date": "2024-11-15",
        "status": "onTime",
        "check_in": "09:00:00",
        "check_out": "18:00:00",
        "work_minutes": 540,
        "remarks": "TC 테스트 데이터"
      },
      "expect": {
        "status": [200, 201],
        "jsonPath": {
          "$.success": true,
          "$.data.id": "@isNumber"
        }
      },
      "extract": {
        "createdAttendanceId": "$.data.id"
      },
      "continueOnFailure": true
    },
    {
      "id": "get_attendance",
      "name": "7. 근태 상세 조회",
      "method": "GET",
      "endpoint": "/api/v1/attendances/{{create_attendance.createdAttendanceId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "update_attendance",
      "name": "8. 근태 수정",
      "method": "PATCH",
      "endpoint": "/api/v1/attendances/{{create_attendance.createdAttendanceId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "status": "late",
        "late_minutes": 30,
        "remarks": "지각 - 교통 체증"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "delete_attendance",
      "name": "9. 근태 삭제",
      "method": "DELETE",
      "endpoint": "/api/v1/attendances/{{create_attendance.createdAttendanceId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200, 204]
      },
      "continueOnFailure": true
    }
  ]
}
