import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { CharacterEntity } from './character.entity';

export interface CharacterOverlay {
    overlayId: number;
    index: number;
    opacity: number;
    colors: [number, number];
}

@Entity('character_overlay_presets')
export class CharacterOverlayPresetEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    character_id: number;
    @Column({ type: 'varchar', length: 128 }) name: string;
    @Column({ type: 'json' }) overlays: CharacterOverlay[];

    @ManyToOne(() => CharacterEntity)
    @JoinColumn({ name: 'character_id' })
    character?: CharacterEntity;
}
