import { Entity, Column, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";

@Entity("roleKeycloak")
export class RoleKeycloak extends EntityBase {
  @Column({
    nullable: true,
    comment: "ชื่อ role",
    length: 255,
    default: null,
  })
  name: string;

  @Column({
    nullable: true,
    comment: "คำอธิบาย",
    length: 255,
    default: null,
  })
  description: string;

  @ManyToMany(() => Profile, (profile) => profile.roleKeycloaks)
  profiles: Profile[];

  @ManyToMany(() => ProfileEmployee, (profileEmployee) => profileEmployee.roleKeycloaks)
  profileEmployees: ProfileEmployee[];
}
