import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
import dayjs from "dayjs";
import { BaseEntity } from "@/abstrClass/BaseEntity";

@Entity("user")
export class User extends BaseEntity {
  @PrimaryGeneratedColumn({ type: "int", name: "id" })
  id: number;
  @Column("varchar", { name: "name", comment: "姓名\r\n", length: 255 })
  name: string;

  @Column("varchar", {
    name: "phone",
    nullable: true,
    comment: "电话",
    length: 255,
    default: "",
  })
  phone: string;
  @Column({ comment: "性别", default: "男" })
  sex: string;
  @Column("varchar", { name: "pwd", nullable: true, length: 255 })
  pwd: string;
  @Column({
    comment: "创建时间",
    default: dayjs().format("YYYY-MM-DD HH:mm:ss"),
  })
  @Column({ comment: "用户状态", default: 1 })
  userState: number; // 账户状态
  @Column({ comment: "角色", default: "" })
  role: string; // 角色
  @Column({ comment: "生日", default: "" })
  birthday: string; // 生日
  @Column({ comment: "年龄", default: "" })
  age: string; // 年龄
  @Column({ comment: "所在省", default: "" })
  province: string; // 所在省
  @Column({ comment: "所在市", default: "" })
  city: string; // 所在市
  @Column({ comment: "所在区域", default: "" })
  area: string; // 所在区域
  @Column({ comment: "详细地址", default: "" })
  address: string; // 详细地址
}
export default User;
