drop view if exists ems.vw_asset_pool_pump_http_poll;

create view ems.vw_asset_pool_pump_http_poll as
select
  pp.site_id,
  pp.id as pump_id,
  pp.code,
  pp.shelly_switch_id,
  se.protocol,
  se.host,
  se.port
from ems.asset_pool_pump pp
join ems.site_endpoint se on se.id = pp.endpoint_id
where se.enabled = true
  and se.endpoint_type in ('http_api', 'shelly_http');

comment on view ems.vw_asset_pool_pump_http_poll is
  'Bazénová čerpadla se Shelly HTTP endpointem pro telemetry_collector (Gen2 RPC polling, 60 s).';
