{
  "name": "HR Payrolls 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,
    "testYear": 2024,
    "testMonth": 11
  },
  "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_summary",
      "name": "2. 급여 요약 조회",
      "method": "GET",
      "endpoint": "/api/v1/payrolls/summary?year={{testYear}}&month={{testMonth}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "list_payrolls",
      "name": "3. 급여 목록 조회",
      "method": "GET",
      "endpoint": "/api/v1/payrolls?year={{testYear}}&month={{testMonth}}&page=1&per_page=10",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      }
    },
    {
      "id": "create_payroll",
      "name": "4. 급여 수동 등록",
      "method": "POST",
      "endpoint": "/api/v1/payrolls",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "user_id": "{{testUserId}}",
        "pay_year": "{{testYear}}",
        "pay_month": "{{testMonth}}",
        "base_salary": 3500000,
        "overtime_pay": 250000,
        "bonus": 0,
        "allowances": [
          {"name": "식대", "amount": 100000},
          {"name": "교통비", "amount": 100000}
        ],
        "income_tax": 120000,
        "resident_tax": 12000,
        "health_insurance": 115000,
        "pension": 157500,
        "employment_insurance": 31500,
        "note": "TC 테스트 급여"
      },
      "expect": {
        "status": [200, 201],
        "jsonPath": {
          "$.success": true,
          "$.data.id": "@isNumber"
        }
      },
      "extract": {
        "payrollId": "$.data.id"
      },
      "continueOnFailure": true
    },
    {
      "id": "get_payroll",
      "name": "5. 급여 상세 조회",
      "method": "GET",
      "endpoint": "/api/v1/payrolls/{{create_payroll.payrollId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "update_payroll",
      "name": "6. 급여 수정",
      "method": "PUT",
      "endpoint": "/api/v1/payrolls/{{create_payroll.payrollId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "body": {
        "bonus": 500000,
        "note": "성과급 추가"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "get_payslip",
      "name": "7. 급여명세서 조회",
      "method": "GET",
      "endpoint": "/api/v1/payrolls/{{create_payroll.payrollId}}/payslip",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "confirm_payroll",
      "name": "8. 급여 확정",
      "method": "POST",
      "endpoint": "/api/v1/payrolls/{{create_payroll.payrollId}}/confirm",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200],
        "jsonPath": {
          "$.success": true
        }
      },
      "continueOnFailure": true
    },
    {
      "id": "delete_payroll",
      "name": "9. 급여 삭제",
      "method": "DELETE",
      "endpoint": "/api/v1/payrolls/{{create_payroll.payrollId}}",
      "headers": {
        "Authorization": "Bearer {{login.token}}"
      },
      "expect": {
        "status": [200, 204]
      },
      "continueOnFailure": true
    }
  ]
}
