import { Column, Model, Table, DataType } from "sequelize-typescript";

@Table({
  timestamps: false,
  tableName: 'cron_stocks_logs'
})
export class CronStocksLog extends Model {

    @Column
    cycle_id: string;

    @Column(DataType.ENUM('paid', 'free'))
    type: 'paid' | 'free';

    @Column(DataType.ENUM('running', 'completed', 'failed'))
    status: 'running' | 'completed' | 'failed';

    @Column
    started_at: Date;

    @Column
    finished_at: Date;

    @Column
    duration_ms: number;

    @Column
    total_stocks: number;

    @Column
    total_calls: number;

    @Column
    successful_updates: number;

    @Column
    failed_calls: number;

    @Column(DataType.TEXT)
    error_message: string;

    @Column
    created_at: Date;
}
