import { Entity, Property, ManyToMany, Collection } from '@mikro-orm/core';
import { BaseEntity } from '../_BaseEntity';
import { User } from './_User';

import type { UserRoleType } from '@/constants/roles';

@Entity()
export class UserRole extends BaseEntity {
    @Property()
    name!: UserRoleType;

    @ManyToMany(() => User, (user) => user.roles)
    users = new Collection<User>(this);
}
