export interface MetaCryptoType {
  id?: number;
  name?: string;
  key?: string;
  createDate?: Date;
}

export enum MetaCryptoTypeEnum {
  NONE = 'NONE',
  UNKNOWN = 'UNKNOWN',
  AES = 'AES',
  CIPHER = 'CIPHER',
  DES = 'DES',
  DSA = 'DSA',
  ECDSA = 'ECDSA',
  ELLIPTIC = 'ELLIPTIC',
  HMAC = 'HMAC',
  MD5 = 'MD5',
  RAND = 'RAND',
  RC4 = 'RC4',
  RSA = 'RSA',
  SHA1 = 'SHA1',
  SHA256 = 'SHA256',
  SUBTLE = 'SUBTLE',
  TLS = 'TLS',
  X509 = 'X509',
  PKIX = 'PKIX',
}

export const toMetaCryptoTypeEnum = (v: MetaCryptoType): MetaCryptoTypeEnum => {
  return MetaCryptoTypeEnum[v.key];
};

export const toMetaCryptoType = (v: MetaCryptoTypeEnum): MetaCryptoType => {
  return {
    key: v,
  };
};
