import { Entity, Column, Unique } from 'typeorm';
import { BaseEntity } from '../database/base.entity';

/**
 * ServiceType — tenant-scoped master table.
 *
 * Shared across: Destination, Supplier, Pricing, Booking modules.
 * Examples: Hotels, Transport, Activities, Sightseeing, Cruise, etc.
 *
 * Admin can add custom service types per tenant.
 * Seeded with defaults on tenant onboarding: Hotels, Transport, Activities.
 */
@Entity('service_types')
@Unique(['tenant_id', 'code'])
export class ServiceTypeEntity extends BaseEntity {
  @Column({ type: 'varchar', length: 255 })
  name: string;

  @Column({ type: 'varchar', length: 50 })
  code: string;

  @Column({ type: 'varchar', length: 500, nullable: true })
  description: string | null;

  @Column({ type: 'boolean', default: true })
  is_active: boolean;

  @Column({ type: 'boolean', default: false })
  is_system: boolean; // true for seeded defaults, prevents deletion

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