import { Schema, Types, model } from "mongoose"

const guildSchema = new Schema({
	_id: Types.ObjectId,
	guildId: { type: String, required: true },
	guildName: { type: String, required: true },
	guildIcon: { type: String, required: true },
	guildLocale: { type: String, required: true },
	guildPlayer: {
		instances: [{
			botId: { type: String, required: true },
			replay: {
				textChannelId: { type: String, required: false },
				voiceChannelId: { type: String, required: false },
				trackUrl: { type: String, required: false },
				progress: { type: Number, required: false }
			}
		}],
		disco: {
			enabled: { type: Boolean, required: true },
			channelId: { type: String, required: false }
		}
	},
	guildAmp: {
		enabled: { type: Boolean, required: true },
		host: { type: String, required: false },
		username: { type: String, required: false },
		sessionID: { type: String, required: false },
		rememberMeToken: { type: String, required: false }
	},
	guildFbx: {
		enabled: { type: Boolean, required: true },
		host: { type: String, required: false },
		version: { type: Number, required: false },
		appToken: { type: String, required: false },
		sessionToken: { type: String, required: false },
		password_salt: { type: String, required: false },
		lcd: {
			enabled: { type: Boolean, required: true },
			botId: { type: String, required: false },
			morningTime: { type: String, required: false },
			nightTime: { type: String, required: false }
		}
	},
	guildTwitch: {
		enabled: { type: Boolean, required: true },
		botId: { type: String, required: false },
		channelId: { type: String, required: false },
		streamers: [
			{
				twitchUserId: { type: String, required: true },
				discordUserId: { type: String, required: false },
				messageId: { type: String, required: false }
			}
		]
	}
})

export default model("Guild", guildSchema, "guilds")
