import { isObject } from '../../utils/types'

type PoetryResponse = {
    title: string,
    text: string,
    author: string,
    id: number,
}

const isPoetryResponse = (obj: unknown): obj is PoetryResponse => (
    isObject(obj, {
        'title': 'string',
        'text': 'string',
        'author': 'string',
        'id': 'number',
    })
)

type Poetry = PoetryResponse

const isPoetry = isPoetryResponse

export type { PoetryResponse, Poetry }

export { isPoetryResponse, isPoetry }
