import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { DarknetOrderEntity } from './darknet-order.entity';
import { ItemTypeEntity } from './item-type.entity';

@Entity('darknet_order_items')
export class DarknetOrderItemEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() order_id: number;
    @Column() item_type_id: number;
    @Column() amount: number;
    @Column() unit_amount: number;

    @ManyToOne(() => DarknetOrderEntity, (order) => order.items)
    @JoinColumn({ name: 'order_id' })
    order: DarknetOrderEntity;

    @ManyToOne(() => ItemTypeEntity, (itemType) => itemType.darknetOrderItems)
    @JoinColumn({ name: 'item_type_id' })
    itemType: ItemTypeEntity;
}
