import { Place } from 'src/place/entities/place.entity';
import { State } from 'src/state/entities/state.entity';
import { Entity, Column, ManyToOne, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
@Entity()
export class Town {
  @PrimaryGeneratedColumn()
  townId: number;

  @ManyToOne(() => State, (state) => state.stateId, { nullable: false, eager: true })
  state: State;

  @OneToMany(() => Place, (place) => place.town)
  places: Place[];

  @Column()
  name: string;

  @Column()
  imageName: string;

  @Column({ default: true })
  active: boolean = true;
}
