val tradeTable = """create table trade (
id bigserial NOT NULL
, trade_id varchar(255) NOT NULL
-- columns below this point have same values between records with the same trade_id.
, contract_date DATE NOT NULL
, amount decimal(30, 8) NOT NULL
, status trade_status NOT NULL -- A:active, D:deleted
, buysell buysell_kind NOT NULL -- B or S
, term_of_tenor int -- number of months.
-- columns below this point have different values even between records with the same trade_id.
, customer_code varchar(4) NOT NULL -- e.g. 0123
, customer_name varchar(64) NOT NULL -- e.g. MIZUHO
, agency_code varchar(4) NOT NULL -- e.g. 0729
, agency_name varchar(64) NOT NULL -- e.g. TTK
, CONSTRAINT PKEY_trade PRIMARY KEY (
    id
  )
);
"""
val assumptions = List(
 "The table always contains two records per trade_id, one with 'B' in the buysell column and the other with 'S'.",
 "the counter trade is a buy/sell opposite-side trade with the same trade_id.",
 "1Y means 1 year. thus it is 12 months."
)
val constraints = List(
 "returns all columns in trade table.",
 "take active trade only.",
 "tenor is 2Y or less."
)
println(QueryGenerator.attachAssumptions(assumptions).generateSelectQuery(from=tradeTable, constraints))
