import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Member } from './Member';

@Entity('member_label')
export class MemberLabel {
  @PrimaryGeneratedColumn()
  label_id: number;

  @Column({ type: 'int', default: 0, comment: '站点ID' })
  site_id: number;

  @Column({ type: 'int', comment: '会员ID' })
  member_id: number;

  @Column({ type: 'varchar', length: 50, comment: '标签名称' })
  label_name: string;

  @Column({ type: 'varchar', length: 255, comment: '标签描述' })
  label_description: string;

  @Column({ type: 'varchar', length: 7, comment: '标签颜色' })
  label_color: string;

  @Column({ type: 'int', default: 0, comment: '排序' })
  sort: number;

  @Column({ type: 'tinyint', default: 1, comment: '状态 1:启用 0:禁用' })
  status: number;

  @Column({ type: 'tinyint', default: 0, comment: '是否删除 0:否 1:是' })
  is_del: number;

  @CreateDateColumn({ comment: '创建时间' })
  create_time: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  update_time: Date;

  // 关联关系
  @ManyToOne(() => Member, member => member.labels)
  @JoinColumn({ name: 'member_id' })
  member: Member;
} 