import { Module } from "@nestjs/common";
import { SequelizeModule } from "@nestjs/sequelize";
import { Permission } from "src/database/models/permission.model";
import { Role } from "src/database/models/role.model";
import { User } from "../../database/models/user.model";
import { RolesController } from "./roles.controller";
import { RolesService } from "./roles.service";
import { UsersController } from "./users.controller";
import { UsersService } from "./users.service";
import { IsUserEmailUniqueRule } from "./validators/is_user_email_unique";
import { IsUserPhoneUniqueRule } from "./validators/is_user_phone_unique";

@Module({
  imports: [
    SequelizeModule.forFeature([
      User,
      Role,
      Permission,
    ])
  ],
  providers: [
    UsersService,
    RolesService,

    // Validator
    IsUserEmailUniqueRule,
    IsUserPhoneUniqueRule
  ],
  controllers: [
    UsersController, 
    RolesController,
  ],
  exports: [UsersService],
})
export class UsersModule {}
