import { FSDB_COLLECTION } from '@andyburke/fsdb';
import { FSDB_INDEXER_SYMLINKS } from '@andyburke/fsdb/indexers';
import { by_lurid } from '@andyburke/fsdb/organizers';

export type SIGNUP = {
	id: string;
	invite_code_id: string;
	referring_user_id: string;
	user_id: string;
	timestamps: {
		created: string;
	};
};

export const SIGNUPS = new FSDB_COLLECTION<SIGNUP>({
	name: 'signups',
	indexers: {
		user_id: new FSDB_INDEXER_SYMLINKS<SIGNUP>({
			name: 'user_id',
			field: 'user_id',
			organize: by_lurid
		}),
		invite_code_id: new FSDB_INDEXER_SYMLINKS<SIGNUP>({
			name: 'invite_code_id',
			field: 'invite_code_id',
			to_many: true,
			organize: by_lurid
		}),
		referring_user_id: new FSDB_INDEXER_SYMLINKS<SIGNUP>({
			name: 'referring_user_id',
			field: 'referring_user_id',
			to_many: true,
			organize: by_lurid
		})
	}
});
