import { Schema, model } from 'mongoose';

const currencySchema = new Schema(
	{
		currency: { type: String }, // USDT, BTC, RUB, GBP
		currencyProps: [
			{
				coinId: { type: String, default: '' }, // "11"
				coinName: { type: String, default: '' },
				exchangeId: { type: String, default: '' },
				switchedOn: { type: Boolean, default: false },
			},
		],
		currencyName: { type: String, default: '' }, // bitcoin, etherium
		currencyType: {
			type: String,
			enum: ['coin', 'fiat'],
			default: 'coin',
		},
		symbol: { type: String, default: '' }, // "₽", "$"
		iconUrl: { type: String, default: '' }, // `RUB.png`
		tickerUSDT: { type: String, default: '' }, // `ETHUSDT.png`
	},
	{
		timestamps: true,
	}
);

export const Currency = model('Currency', currencySchema);
