-- @param {String} $1:regionCode
-- @param {DateTime} $2:startDate
-- @param {DateTime} $3:endDate
SELECT
  gw.fuel_type,
  gw.week AS timestamp,
  gw.avg_generation AS generation_mw,
  r.code AS region_code,
  r.name AS region_name
FROM generation_mix_weekly gw
JOIN grid_regions r ON gw.region_id = r.id
WHERE r.code = $1
  AND gw.week BETWEEN $2 AND $3
ORDER BY gw.week ASC, gw.fuel_type
