export declare const ServiceTemplate = "\nimport { \n    CreateCatDto, \n    UpdateCatDto \n}  from \"./cat.dto\";\n\ntype Cat = {\n    id: number;\n    name: string;\n    age: number;\n}\n\nexport class CatService {\n    private cats: Cat[] = [\n        { id: 1, name: 'cat1', age: 1.6 },\n        { id: 2, name: 'cat2', age: 1.8 },\n    ];\n    public async index() {\n        return this.cats;\n    };\n\n    public async show(id: number) {\n        const cat = this.cats.find(cat => cat.id === id);\n        if(cat == null) return null;\n        return cat;\n    };\n\n    public async create({ name, age }: CreateCatDto) {\n\n        const cat = {\n            id: this.cats.length + 1,\n            name: name,\n            age: age\n        };\n\n        this.cats.push(cat);\n\n        return cat;\n    }\n    \n    public async update(id: number, { name, age }: UpdateCatDto) {\n        const index = this.cats.findIndex(d => d.id === id);\n\n        if (index === -1) {\n            throw new Error(\"Cat not found\");\n        }\n\n        this.cats[index] = {\n            ...this.cats[index],\n            ...{ name, age }        \n        };\n\n        const cat = this.cats[index];\n\n        return cat;\n    }\n\n    public async remove(id: number) {\n        const index = this.cats.findIndex(d => d.id === id);\n\n        if (index === -1) {\n            throw new Error(\"Cat not found\");\n        }\n\n        this.cats.splice(index, 1);\n\n        return true;\n    }\n}\n";
