import * as plugins from '../../plugins.js';
import { DcRouterDb } from '../classes.dcrouter-db.js';

const getDb = () => DcRouterDb.getInstance().getDb();

@plugins.smartdata.Collection(() => getDb())
export class VpnServerKeysDoc extends plugins.smartdata.SmartDataDbDoc<VpnServerKeysDoc, VpnServerKeysDoc> {
  @plugins.smartdata.unI()
  @plugins.smartdata.svDb()
  public configId: string = 'vpn-server-keys';

  @plugins.smartdata.svDb()
  public noisePrivateKey!: string;

  @plugins.smartdata.svDb()
  public noisePublicKey!: string;

  @plugins.smartdata.svDb()
  public wgPrivateKey!: string;

  @plugins.smartdata.svDb()
  public wgPublicKey!: string;

  constructor() {
    super();
  }

  public static async load(): Promise<VpnServerKeysDoc | null> {
    return await VpnServerKeysDoc.getInstance({ configId: 'vpn-server-keys' });
  }
}
