import {TypedSopNode} from "./_Base";
import {InputCloneMode as InputCloneMode2} from "../../poly/InputCloneMode";
import {ScatterSopOperation} from "../../../core/operations/sop/Scatter";
import {NodeParamsConfig, ParamConfig} from "../utils/params/ParamsConfig";
const DEFAULT = ScatterSopOperation.DEFAULT_PARAMS;
class ScatterSopParamsConfig extends NodeParamsConfig {
  constructor() {
    super(...arguments);
    this.pointsCount = ParamConfig.INTEGER(DEFAULT.pointsCount, {
      range: [0, 100],
      rangeLocked: [true, false]
    });
    this.seed = ParamConfig.INTEGER(DEFAULT.seed, {
      range: [0, 100],
      rangeLocked: [false, false]
    });
    this.transferAttributes = ParamConfig.BOOLEAN(DEFAULT.transferAttributes);
    this.attributesToTransfer = ParamConfig.STRING(DEFAULT.attributesToTransfer, {
      visibleIf: {transferAttributes: 1}
    });
    this.addIdAttribute = ParamConfig.BOOLEAN(DEFAULT.addIdAttribute);
    this.addIdnAttribute = ParamConfig.BOOLEAN(DEFAULT.addIdnAttribute);
  }
}
const ParamsConfig2 = new ScatterSopParamsConfig();
export class ScatterSopNode extends TypedSopNode {
  constructor() {
    super(...arguments);
    this.params_config = ParamsConfig2;
  }
  static type() {
    return "scatter";
  }
  static displayedInputNames() {
    return ["geometry to scatter points onto"];
  }
  initializeNode() {
    this.io.inputs.setCount(1);
    this.io.inputs.initInputsClonedState(InputCloneMode2.NEVER);
  }
  async cook(input_contents) {
    this._operation = this._operation || new ScatterSopOperation(this.scene(), this.states);
    const core_group = await this._operation.cook(input_contents, this.pv);
    this.setCoreGroup(core_group);
  }
}
