import { Entity, Property, ManyToOne } from '@mikro-orm/core';
import { BaseEntity } from '../_BaseEntity';
import { User } from '../user/_User';
import { App } from '../app/_App';
import { APIKeyRepository } from '../../repositories/APIKeyRepository';

@Entity()
export class APIKey extends BaseEntity {
    @Property()
    key!: string;

    @ManyToOne(() => User)
    user!: User;

    @ManyToOne(() => App)
    app!: App;

    // Each APIKey is now linked to both a user and an app (system)
}
