import express, { Router } from "express";
import { Routes } from "../../core/interfaces/router";
import { autowired } from "first-di";
import { AssemblyController } from "./assembly_create_controller";
import validationMiddleware from "../../core/middlewares/ValidationMiddleware";
import { CadFilesModel } from "./model/zip_files_model";

export class AssemblyRoute implements Routes {
  public path = "/assembly";
  public router = Router();
  
  @autowired()
  private readonly assemblyController: AssemblyController;
  
  constructor() {
    this.initializeRoutes();
  }

  private initializeRoutes() {
    this.router.post(
      `${this.path}`,
      validationMiddleware(CadFilesModel, "files"),
      this.assemblyController.createAssembly
    );
    this.router.post(
      `${this.path}/save/out`,
      // validationMiddleware(CadFilesModel, "files"),
      this.assemblyController.test
    );

    this.router.get(`${this.path}`, this.assemblyController.getAllAssembly);

    this.router.post(
      `${this.path}/create`,
      this.assemblyController.createRootEntity
    );
    this.router.post(
      `${this.path}/stability/write/computed`,
      this.assemblyController.stabilityComputed
    );
    this.router.post(
      `${this.path}/stabilty/create/`,
      this.assemblyController.stabilityCreate
    );
  }
}
