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

@Entity('member_address')
export class MemberAddress {
  @PrimaryGeneratedColumn({ name: 'id' })
  id: number;

  @Column({ name: 'member_id', type: 'int', default: 0 })
  member_id: number;

  @Column({ name: 'site_id', type: 'int', default: 0 })
  site_id: number;

  @Column({ name: 'name', type: 'varchar', length: 255, default: '' })
  name: string;

  @Column({ name: 'mobile', type: 'varchar', length: 255, default: '' })
  mobile: string;

  @Column({ name: 'province_id', type: 'int', default: 0 })
  province_id: number;

  @Column({ name: 'city_id', type: 'int', default: 0 })
  city_id: number;

  @Column({ name: 'district_id', type: 'int', default: 0 })
  district_id: number;

  @Column({ name: 'address', type: 'varchar', length: 255, default: '' })
  address: string;

  @Column({ name: 'address_name', type: 'varchar', length: 255, default: '' })
  address_name: string;

  @Column({ name: 'full_address', type: 'varchar', length: 255, default: '' })
  full_address: string;

  @Column({ name: 'lng', type: 'varchar', length: 255, default: '' })
  lng: string;

  @Column({ name: 'lat', type: 'varchar', length: 255, default: '' })
  lat: string;

  @Column({ name: 'is_default', type: 'tinyint', default: 0 })
  is_default: number;

  @ManyToOne(() => Member)
  @JoinColumn({ name: 'member_id' })
  member: Member;
} 