import { Column, Entity, JoinColumn, ManyToMany, PrimaryGeneratedColumn } from "typeorm";
import PriceEntity from "./price.entity";

@Entity(
    { name: "store" }
)
export default class StoreEntity{

    constructor(id?: number){
        this.id = id;
    }

    @PrimaryGeneratedColumn()
    id?: number;

    @Column()
    code?: string;

    @Column()
    title?: string;

    @Column({name: "business_name"})
    businessName?: string;

    @Column({name: "vat_number"})
    vatNumber?: string;

    @Column({name: "fiscal_code"})
    fiscalCode?: string;

    @Column({name: "fiscal_regim"})
    fiscalRegim?: string;

    @Column()
    city?: string;

    @Column()
    address?: string;

    @Column()
    province?: string;

    @Column({name: "zip_code"})
    zipCode?: string;

    @Column({name: "country_code"})
    countryCode?: string;

    @Column(({name: "phone_number"}))
    phoneNumber?: string;   

    @Column()
    email?: string;

    @JoinColumn({name: "id_price"})
    @ManyToMany(type => PriceEntity)
    price?: PriceEntity;

    @Column(
        { type: "datetime", name: "created_at" }
    )
    createdAt?: Date;

    @Column(
        { type: "datetime", name: "updated_at" }
    )
    updatedAt?: Date;

}