import { Column, Entity, PrimaryColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

@Entity('files', { schema: 'public' })
export class FileEntity {
  @PrimaryColumn('varchar', {
    name: 'store',
  })
  @ApiProperty({})
  store: string;

  @PrimaryColumn({
    name: 'id',
    type: 'uuid',
  })
  id: string;

  @PrimaryColumn({
    name: 'content_id',
    type: 'uuid',
  })
  contentId: string;

  @Column('varchar', {
    name: 'title',
  })
  @ApiProperty({})
  title: string;

  @Column('boolean', {
    name: 'is_secret',
  })
  isSecret: boolean;

  @Column('varchar', {
    name: 'dir',
  })
  @ApiProperty({})
  dir: string | null;

  @Column('varchar', {
    name: 'uploaded_by',
  })
  @ApiProperty({})
  uploadedBy: string | null;

  @Column('timestamp with time zone', {
    name: 'uploaded_at',
    nullable: false,
    default: () => 'CURRENT_TIMESTAMP',
  })
  @ApiProperty({})
  uploadedAt: Date;
}
