generate model code