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

@Entity('property_permit_type_available_items')
export class PropertyPermitTypeAvailableItemEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int', nullable: false }) permit_type_id: number;
    @Column({ type: 'int', nullable: true }) item_type_id: number;
    @Column({ type: 'int', nullable: true }) item_category_id: number;

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

    @ManyToOne(() => ItemCategoryEntity, (category) => category.stockAccess)
    @JoinColumn({ name: 'item_category_id' })
    itemCategory: ItemCategoryEntity;
}
