content: {-# LANGUAGE TemplateHaskell #-}
  {-# OPTIONS_GHC -fno-warn-orphans #-}
  
  module Main where
  
  import Data.Aeson.TypeScript.TH
  import Network.URI
  
  import Data.Data (Proxy (Proxy))
  import Recalc.Server (aesonOptions)
  import Recalc.Server.TH
  import Recalc.Server.TypeScript
  import Recalc.Univer.Protocol
  
  instance TypeScript URI where
    getTypeScriptType _ = "string"
  
  instance TypeScript Cells where
    getTypeScriptType _ = "IObjectMatrixPrimitiveType<Nullable<ICellData>>"
  
  instance TypeScript FunctionType where
    getTypeScriptType _ = "FunctionType"
  
  $(foldMap (deriveTypeScript aesonOptions) [''FunctionParameter, ''FunctionDescription])
  $(deriveTypeScriptProtocolWithout ''SpreadsheetProtocol [''Cells])
  
  main :: IO ()
  main = do
    putStrLn "/** this file is auto-generated by src/ts/Main.hs */\n"
    putStrLn . formatTSDeclarations
      $ getTypeScriptDeclarations @FunctionType Proxy
        <> getTypeScriptDeclarations @FunctionParameter Proxy
        <> getTypeScriptDeclarations @FunctionDescription Proxy
        <> typeScriptInterface @SpreadsheetProtocol
  