import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm';
import { BaseEntity } from '../database/base.entity';
import { QueryQuoteEntity } from './query-quote.entity';

@Entity('query_quote_specials')
export class QueryQuoteSpecialEntity extends BaseEntity {
  @ManyToOne(() => QueryQuoteEntity, (q) => q.special_items, { onDelete: 'CASCADE' })
  @JoinColumn({ name: 'quote_id' })
  quote: QueryQuoteEntity;

  @Column({ type: 'uuid' })
  quote_id: string;

  @Column({ type: 'varchar', length: 255 })
  service_name: string;

  @Column({ type: 'decimal', precision: 12, scale: 2 })
  total_price: number;

  @Column({ type: 'date', nullable: true })
  date: string | null;

  @Column({ type: 'int', default: 0 })
  sort_order: number;

  @Column({ type: 'text', nullable: true })
  comments: string | null;

  @Column({ type: 'boolean', default: false })
  is_day_item: boolean;
}
