I repaid a retention bonus (> $3000) in 2017 that was included as income in 2015. Am I eligible to claim a deduction or credit or neither?

The cash bonus had a stipulation that I remain with the company for 2 years.  I ended up leaving before the 2 year period was up, so I paid it back in 2017 (gross amount).  I've been reading about this in Pub 525, and my questions are really around eligibility, not the mechanics of how to claim a deduction or credit.

1. Pub 525 says to be eligible for a deduction or credit, the repayment must qualify as business/trade expense/loss, or a for-profit transaction.  Is that the case here?  I suppose I could consider my prior employment with the company as my "trade", and the repayment of the bonus as an "expense"...

2. The tax credit option is available if the income was included under a claim of right, which implies an "unrestricted right" to the income.  I'm not sure how to interpret this.  The bonus was included as wages on my W-2 for 2015, and taxes were deducted.  I could have spent the net amount however I wanted.  But there was the condition of repayment if I didn't stay for the full 2 years, which sounds like a restriction.  So did this income qualify as "claim of right"?