import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { PhoneConversationEntity } from './phone-conversation.entity';

@Entity('phone_conversation_members')
export class PhoneConversationMemberEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() conversation_id: number;
    @Column() phone_id: number;
    @Column({ type: 'varchar', length: 16 }) phone_number: string;
    @Column({ type: 'tinyint', width: 1 }) read: boolean;
    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) created: Date;

    @ManyToOne(() => PhoneConversationEntity, (convo) => convo.members)
    @JoinColumn({ name: 'conversation_id' })
    conversation: PhoneConversationEntity;
}
