When(/^the client sets the orchard pricing tier for the film product$/) do
  @pricing_family_id = 1
  @orchard_pricing_tier_id = 1
  @response = OwsPricing.set_product_orchard_pricing_tier(
    @product_id, @pricing_family_id, @orchard_pricing_tier_id
  )
end

When(/^the client sets the orchard pricing tier for the music product at the album level$/) do # rubocop:disable Metrics/LineLength
  @pricing_family_id = 2
  @orchard_pricing_tier_id = 8
  @response = OwsPricing.set_product_orchard_pricing_tier(
    @product_id, @pricing_family_id, @orchard_pricing_tier_id
  )
end

When(/^the client sets the orchard pricing tier for the music product at the track level$/) do # rubocop:disable Metrics/LineLength
  @pricing_family_id = 3
  @orchard_pricing_tier_id = 26
  @response = OwsPricing.set_product_orchard_pricing_tier(
    @product_id, @pricing_family_id, @orchard_pricing_tier_id
  )
end

When(/^the client creates a product pricing override for the film product$/) do
  @pricing_family_id = 1
  @response = OwsPricing.create_product_pricing_override(
    @product_id, @pricing_family_id
  )
end

When(/^the client creates a product pricing override for the music product at the album level$/) do # rubocop:disable Metrics/LineLength
  @pricing_family_id = 2
  @response = OwsPricing.create_product_pricing_override(
    @product_id, @pricing_family_id
  )
end

When(/^the client creates a product pricing override for the music product at the track level$/) do # rubocop:disable Metrics/LineLength
  @pricing_family_id = 3
  @response = OwsPricing.create_product_pricing_override(
    @product_id, @pricing_family_id
  )
end

When(/^the client creates a track pricing override for the track$/) do
  @response = OwsPricing.create_track_pricing_override(@track_id)
end

Then(/^the orchard pricing tier is set$/) do
  payload = JSON.parse(@response.body)
  assert_equal @product_id, payload['product_id']
  assert_equal @orchard_pricing_tier_id, payload['orchard_pricing_tier_id']
end

Then(/^the product pricing override is created$/) do
  payload = JSON.parse(@response.body)
  assert_equal @product_id, payload['product_id']
  assert_equal @pricing_family_id, payload['pricing_family_id']
end

Then(/^the track pricing override is created$/) do
  payload = JSON.parse(@response.body)
  assert_equal @track_id, payload['track_id']
end
