import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('seo_templates')
export class SeoTemplate {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'template_key', unique: true, length: 100 })
  templateKey: string;

  @Column({ name: 'route_pattern', length: 255, nullable: true })
  routePattern: string;

  @Column({ name: 'meta_title_tpl', type: 'text' })
  metaTitleTpl: string;

  @Column({ name: 'meta_description_tpl', type: 'text' })
  metaDescriptionTpl: string;

  @Column({ name: 'content_title_tpl', type: 'text', nullable: true })
  contentTitleTpl: string;

  @Column({ name: 'content_desc_tpl', type: 'text', nullable: true })
  contentDescTpl: string;

  @Column({ name: 'canonical_url_tpl', type: 'text', nullable: true })
  canonicalUrlTpl: string;

  @Column({ length: 50, default: 'index, follow' })
  robots: string;

  @Column({
    type: 'enum',
    enum: ['active', 'inactive'],
    default: 'active',
  })
  status: 'active' | 'inactive';

  @Column({ default: 1 })
  version: number;

  @Column({ name: 'created_by', type: 'int', nullable: true })
  createdBy: number;

  @Column({ name: 'updated_by', type: 'int', nullable: true })
  updatedBy: number;

  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt: Date;
}
