import type { TsrpcConfig } from 'tsrpc-cli';

export default <TsrpcConfig>{
    // Generate ServiceProto
    proto: [
        {
            ptlDir: 'src/shared/protocols', // Protocol dir
            output: 'src/shared/protocols/serviceProto.ts', // Path for generated ServiceProto
            apiDir: 'src/api_s2c',   // API dir
            docDir: 'doc/s2c',     // API documents dir
            compatible: false,
        },
        {
            ptlDir: 'src/monopoly/protocols', // Protocol dir
            output: 'src/monopoly/protocols/serviceProto.ts', // Path for generated ServiceProto
            apiDir: 'src/api_o2s',   // API dir
            docDir: 'doc/s2o',
            compatible: false,
        },
        {
            ptlDir: 'src/cross/protocols',
            output: 'src/cross/protocols/serviceProto.ts',
            apiDir: 'src/api_cross',   // API dir
            compatible: false,
        }
    ],
    // Sync shared code
    sync: [
        // {
        //     from: 'src/shared',
        //     to: '../frontend/src/shared',
        //     type: 'symlink'     // Change this to 'copy' if your environment not support symlink
        // }
    ],
    // Dev server
    dev: {
        autoProto: true,        // Auto regenerate proto
        autoSync: true,         // Auto sync when file changed
        autoApi: true,          // Auto create API when ServiceProto updated
        watch: 'src',           // Restart dev server when these files changed
        entry: 'src/index.ts',  // Dev server command: node -r ts-node/register {entry}
    },
    // Build config
    build: {
        autoProto: true,        // Auto generate proto before build
        autoSync: true,         // Auto sync before build
        autoApi: true,          // Auto generate API before build
        outDir: 'dist',         // Clean this dir before build
    }
};