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

@Entity('member_sign')
export class MemberSign {
  @PrimaryGeneratedColumn()
  sign_id: number;

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

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

  @Column({ type: 'date', comment: '签到日期' })
  sign_date: Date;

  @Column({ type: 'int', default: 0, comment: '签到积分' })
  sign_point: number;

  @Column({ type: 'int', default: 0, comment: '连续签到天数' })
  continuous_days: number;

  @Column({ type: 'varchar', length: 255, comment: '签到备注' })
  remark: string;

  @Column({ type: 'varchar', length: 45, comment: '签到IP' })
  sign_ip: string;

  @Column({ type: 'varchar', length: 255, comment: '签到地址' })
  sign_address: string;

  @Column({ type: 'varchar', length: 255, comment: '签到设备' })
  sign_device: string;

  @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.signs)
  @JoinColumn({ name: 'member_id' })
  member: Member;
} 