import { Column, Entity, PrimaryColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import {
  encodeBigNumberKey,
  decodeBigNumberKey,
} from '../utils/big-number-key';

@Entity('asset_imports', { schema: 'public' })
export class AssetImportEntity {
  @PrimaryColumn({
    name: 'project_id',
    nullable: false,
    transformer: {
      from: (x) => encodeBigNumberKey(x),
      to: (x) => decodeBigNumberKey(x),
    },
  })
  @ApiProperty({})
  projectId: string;

  @PrimaryColumn('uuid', {
    name: 'imported_id',
  })
  @ApiProperty({})
  importedId: string;

  @PrimaryColumn('uuid', {
    name: 'new_id',
  })
  @ApiProperty({})
  newId: string;
}
