NAME=${1:-Route}

NAME=${NAME^}

mkdir -p src/api/${NAME,}
cat > src/api/${NAME,}/index.ts << EOF
import { API_URL } from '../../config'
import { ${NAME}Response, ${NAME} } from './types'

const initial${NAME}: ${NAME} = {}

const compose${NAME}URL = () => (
    API_URL + '/${NAME,}?'
)

const process${NAME} = (data: ${NAME}Response): ${NAME} => {
    return data
}

export { initial${NAME}, compose${NAME}URL, process${NAME} }
EOF

cat > src/api/${NAME,}/types.ts << EOF
import { isObject } from '../../utils/types'

type ${NAME}Response = {
    
}

const is${NAME}Response = (obj: unknown): obj is ${NAME}Response => (
    isObject(obj, {
    
    })
)

type ${NAME} = {

}

const is${NAME} = (obj: unknown): obj is ${NAME} => (
    isObject(obj, {

    })
)

export type { ${NAME}Response, ${NAME} }

export { is${NAME}Response, is${NAME} }
EOF
