-- [STATUS]

CREATE TYPE STATUS_PIPE_PUMP_STATUS AS ENUM ('OPEN', 'CLOSED');

CREATE TABLE STATUS_PIPE
(
  ID VARCHAR(32) PRIMARY KEY REFERENCES PIPES(ID)
, Status STATUS_PIPE_PUMP_STATUS NOT NULL
);

CREATE TABLE STATUS_PUMP
(
  ID VARCHAR(32) PRIMARY KEY REFERENCES PUMPS(ID)
, Status STATUS_PIPE_PUMP_STATUS NOT NULL
);

CREATE TYPE STATUS_VALVE_STATUS AS ENUM ('OPEN', 'CLOSED', 'ACTIVE');

CREATE TABLE STATUS_VALVE
(
  ID VARCHAR(32) PRIMARY KEY REFERENCES VALVES(ID)
, Status STATUS_VALVE_STATUS NOT NULL
);

CREATE TABLE STATUS_LINK
(
  ID VARCHAR(32) PRIMARY KEY REFERENCES _LINK(ID)
, Setting NUMERIC NOT NULL
);
