import { RootState } from '../store'
import { Template } from '../store/types'

// Template selectors
export const selectTemplates = (state: RootState): Template[] => 
  state.template.templates

export const selectSelectedTemplate = (state: RootState): Template | null => 
  state.template.selectedTemplate

export const selectTemplateById = (state: RootState, id: string): Template | undefined =>
  state.template.templates.find(template => template.id === id)

export const selectTemplatesByType = (state: RootState, type: 'image-to-image' | 'image-to-video'): Template[] =>
  state.template.templates.filter(template => template.type === type)
