### ----------------------------------------------------
### -- Red
### -- Licenses: Artistic-2.0
### -- Authors: Fernando Correa de Oliveira
### -- File: lib/Red/AST/Insert.rakumod
### ----------------------------------------------------
use Red::AST;
use Red::AST::Value;
use Red::Column;
use Red::Model;

#| Represents an insert
unit class Red::AST::Insert does Red::AST;

has Red::Model  $.into;
has             %.values;

method returns { Nil }

method args { |%!values.keys }

multi method new(Red::Model $model) {
    ::?CLASS.bless: :into($model.WHAT), :values($model.^columns.map(-> $column {
        $column.column.name => Red::AST::Value.new: :column($column.column), :value($column.get_value: $model)
    }).Hash)
}
method find-column-name {}


