import {TypedSopNode} from "./_Base";
import {AddSopOperation} from "../../../core/operations/sop/Add";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
const DEFAULT = AddSopOperation.DEFAULT_PARAMS;
class AddSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.createPoint = ParamConfig.BOOLEAN(DEFAULT.createPoint);
    this.pointsCount = ParamConfig.INTEGER(DEFAULT.pointsCount, {
      range: [1, 100],
      rangeLocked: [true, false],
      visibleIf: {createPoint: true}
    });
    this.position = ParamConfig.VECTOR3(DEFAULT.position, {visibleIf: {createPoint: true}});
    this.connectInputPoints = ParamConfig.BOOLEAN(DEFAULT.connectInputPoints);
    this.connectToLastPoint = ParamConfig.BOOLEAN(DEFAULT.connectToLastPoint);
  }
}
const ParamsConfig2 = new AddSopParamsConfig();
export class AddSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "add";
  }
  static displayedInputNames() {
    return ["geometry to create polygons from (optional)"];
  }
  initializeNode() {
    this.io.inputs.setCount(0, 1);
  }
  cook(input_contents) {
    this._operation = this._operation || new AddSopOperation(this.scene(), this.states);
    const core_group = this._operation.cook(input_contents, this.pv);
    this.setCoreGroup(core_group);
  }
}
