import ChatRight from "../models/chat/rights.js";
import RoomType from "../models/chat/room_type.js";

const initializeChat = async () => {
    initializeChatRights();
    initializeRoomTypes();
}

const RoomTypes = [
    'chat',
    'dice',
    'poker',
    'hangman'
];

const ChatRights = [
    'talk',
    'scream',
    'whisper',
    'start game',
    'open room',
    'systemmessage'
];

const initializeChatRights = async () => {
    for (const right of ChatRights) {
        await ChatRight.findOrCreate({ 
            where: { tr: right },
            defaults: { tr: right }
        });
    }
}
 
const initializeRoomTypes = async () => {
    for (const type of RoomTypes) {
        await RoomType.findOrCreate({
            where: { tr: type },
            defaults: { tr: type }
        });
    }
}

export default initializeChat;