package se.koc.trader.struct;

import se.koc.trader.api.ExchangeConfig;
import zutil.db.DBConnection;
import zutil.db.bean.DBBean;
import zutil.db.bean.DBBeanObjectDSO;

import java.sql.SQLException;
import java.util.List;

/**
 * Object representing a single exchange endpoint.
 */
@DBBean.DBTable(value = "exchange", superBean = true)
public class Exchange extends DBBeanObjectDSO<ExchangeConfig> {

    private String name;


    public static List<Exchange> getExchanges(DBConnection db) throws SQLException {
        return DBBean.load(db, Exchange.class);
    }
    public static Exchange getExchange(DBConnection db, long id) throws SQLException {
        return DBBean.load(db, Exchange.class, id);
    }


    public Exchange() { }
    public Exchange(ExchangeConfig exchangeConfig) {
        this.setObject(exchangeConfig);
    }


    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
