import { ConfigService } from "@nestjs/config";
import { Sequelize } from "sequelize-typescript";

const configService = new ConfigService

export function eventAttributes(): any[]{
  return [
    'id',
    'thumbnailType',
    [
      Sequelize.fn('CONCAT',
        `${configService.get("MEDIA_HOST")}/`,
        Sequelize.col('thumbnail_file'),
      ),
      'thumbnailFile'
    ],
    'bannerType',
    [
      Sequelize.fn('CONCAT',
        `${configService.get("MEDIA_HOST")}/`,
        Sequelize.col('banner_file'),
      ),
      'bannerFile'
    ],
    'name',
    'type',
    'description',
    'termsAndConditions',
    'location',
    'coordinate',
    'deposit',
    'registerStartAt',
    'registerFinishAt',
    'eventStartAt',
    'eventFinishAt',
    'active'
  ]
}

export function registrationAttributes(): any[]{
  return [
    'id',
    'customerId',
    'eventId',
    'transactionId',
    'eventAt',
    [
      Sequelize.fn('CONCAT',
        `${configService.get("MEDIA_HOST")}/`,
        Sequelize.col('qr'),
      ),
      'qr'
    ],
    'code',
    'name',
    'phoneNumber',
    'eventPriceId',
    'eventPriceName',
    'eventPriceAmount',
    'deposit',
    'redeemBy',
    'inquiryAt',
    'registrationAt',
    'redeemAt',
    'terminateAt',
    'status',
    'createdAt',
    'updatedAt'
  ]
}

export function mediaAttributes(): any[]{
  return [
    'id',
    'file_name',
    [
      Sequelize.fn('CONCAT',
        `${configService.get("MEDIA_HOST")}/`,
        Sequelize.col('url'),
      ),
      'url'
    ],
    'type',
    'status',
    'owner_id',
    'createdAt',
    'updatedAt',
    'deletedAt'
  ]
}