import * as selectors from '../redux/selectors';

import { createSupplyTagPricingInput } from './createSupplyTagRequestBody';

const createSupplyTagPriceRequestBody = (state, pricing, key = 'pricing') => {
  const pageConfig = selectors.pageConfigSelector(state);

  const [price] = createSupplyTagPricingInput([pricing]);
  const body = {
    id: pageConfig.id,
    [key]: price,
  };

  return body;
};

export default createSupplyTagPriceRequestBody;
