CREATE TABLE equipment(
id VARCHAR(50) NOT NULL PRIMARY KEY
);

CREATE TABLE cable(
id VARCHAR(50) NOT NULL PRIMARY KEY,
FOREIGN KEY (id) REFERENCES equipment (id)
);

CREATE TABLE coax(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (id) REFERENCES cable (id)
);

CREATE TABLE crossOver(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (id) REFERENCES cable (id)
);

CREATE TABLE straightThrough(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (id) REFERENCES cable (id)
);

CREATE TABLE networkNode(
id VARCHAR(50) NOT NULL PRIMARY KEY,
FOREIGN KEY (id) REFERENCES equipment (id)
);

CREATE TABLE centralHub(
id VARCHAR(50) NOT NULL PRIMARY KEY,
FOREIGN KEY (id) REFERENCES networkNode (id)
);

CREATE TABLE hub(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
connectedTo VARCHAR(50),
FOREIGN KEY (id) REFERENCES centralHub (id),
FOREIGN KEY (connectedTo) REFERENCES networkNode (id)
);

CREATE TABLE router(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
connectedTo VARCHAR(50),
FOREIGN KEY (id) REFERENCES centralHub (id),
FOREIGN KEY (connectedTo) REFERENCES networkNode (id)
);

CREATE TABLE switch(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
connectedTo VARCHAR(50),
FOREIGN KEY (id) REFERENCES centralHub (id),
FOREIGN KEY (connectedTo) REFERENCES networkNode (id)
);

CREATE TABLE computer(
id VARCHAR(50) NOT NULL PRIMARY KEY,
FOREIGN KEY (id) REFERENCES networkNode (id)
);

CREATE TABLE pc(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
connectedTo VARCHAR(50),
FOREIGN KEY (id) REFERENCES computer (id),
FOREIGN KEY (connectedTo) REFERENCES networkNode (id)
);

CREATE TABLE server(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
connectedTo VARCHAR(50),
FOREIGN KEY (id) REFERENCES computer (id),
FOREIGN KEY (connectedTo) REFERENCES networkNode (id)
);

CREATE TABLE wirelessDevice(
id VARCHAR(50) NOT NULL PRIMARY KEY,
FOREIGN KEY (id) REFERENCES equipment (id)
);

CREATE TABLE WAP(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (id) REFERENCES wirelessDevice (id)
);

CREATE TABLE wirelessBridge(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
FOREIGN KEY (id) REFERENCES wirelessDevice (id)
);

CREATE TABLE software(
id VARCHAR(50) NOT NULL PRIMARY KEY,
name VARCHAR(50),
type VARCHAR(50),
);

CREATE TABLE hasSoftware(
computerID VARCHAR(50) NOT NULL,
softwareID VARCHAR(50) NOT NULL,
PRIMARY KEY (computerID,softwareID),
FOREIGN KEY (computerID) REFERENCES computer (id),
FOREIGN KEY (softwareID) REFERENCES software (id)
);

CREATE TABLE pairOfNode(
id VARCHAR(50) NOT NULL PRIMARY KEY,
connectThrough VARCHAR(50),
node1 VARCHAR(50),
node2 VARCHAR(50),
FOREIGN KEY (connectThrough) REFERENCES cable (id),
FOREIGN KEY (node1) REFERENCES networkNode (id),
FOREIGN KEY (node2) REFERENCES networkNode (id)
);
