import { Injectable } from '@angular/core';
import { Get, Post, requestDone } from '../http.decorators';
import { _BaseApi } from './_base';

@Injectable({ providedIn: 'root' })
export class BasicApi extends _BaseApi {
  @Get('/basic/predefine/all', false, ['type'])
  async getPredefineList(type: string): Promise<BasicData.Predefine[]> {
    requestDone();
  }
  @Post('/basic/predefine/add')
  async addPredefine(data: Omit<BasicData.Predefine, 'id'>): Promise<void> {
    requestDone(data);
  }
  async deletePredefine(type: string, value: string): Promise<void> {
    return this.http.delete('/basic/predefine/remove', { type, value });
  }

  async deleteType(name: string): Promise<void> {
    return this.http.delete('/basic/product/remove-type', { name });
  }

  @Get('/basic/product/units')
  async getUnitList(): Promise<BasicData.Unit[]> {
    requestDone();
  }
  @Post('/basic/product/update-unit')
  async updateUnit(data: Partial<BasicData.Unit>): Promise<void> {
    requestDone(data);
  }
  @Post('/basic/product/add-unit')
  async addUnit(data: Partial<BasicData.Unit>): Promise<void> {
    requestDone(data);
  }
  async deletedUnit(id: number): Promise<void> {
    return this.http.delete('/basic/product/remove-unit', { id });
  }

  @Get('/basic/equipment/all')
  async getEquipmentList(): Promise<BasicData.Equipment[]> {
    requestDone();
  }
  @Post('/basic/equipment/update')
  async updateEquipment(data: Partial<BasicData.Equipment>): Promise<void> {
    requestDone(data);
  }
  @Post('/basic/equipment/add')
  async addEquipment(data: Partial<BasicData.Equipment>): Promise<void> {
    requestDone(data);
  }
  async deletedEquipment(id: number): Promise<void> {
    return this.http.get('/basic/equipment/remove', { id });
  }

  @Get('/basic/operation/all')
  async getOperationList(): Promise<BasicData.Operation[]> {
    requestDone();
  }
  @Post('/basic/operation/update')
  async updateOperation(data: Partial<BasicData.Operation>): Promise<void> {
    requestDone(data);
  }
  @Post('/basic/operation/add')
  async addOperation(data: Partial<BasicData.Operation>): Promise<void> {
    requestDone(data);
  }
  async deletedOperation(id: number): Promise<void> {
    return this.http.get('/basic/operation/remove', { id });
  }

  @Get('/basic/position/all')
  async getPositionList(): Promise<BasicData.Position[]> {
    requestDone();
  }
  @Post('/basic/position/update')
  async updatePosition(data: Partial<BasicData.Position>): Promise<void> {
    requestDone(data);
  }
  @Post('/basic/position/add')
  async addPosition(data: Partial<BasicData.Position>): Promise<void> {
    requestDone(data);
  }
  async deletedPosition(id: number): Promise<void> {
    return this.http.get('/basic/position/remove', { id });
  }

  @Get('/hr/department/all')
  async getDepartmentList(): Promise<BasicData.Department[]> {
    requestDone();
  }
  @Post('/hr/department/add')
  async addDepartment(data: Partial<BasicData.Department>): Promise<void> {
    requestDone(data);
  }
  @Post('/hr/department/update')
  async updateDepartment(data: Partial<BasicData.Department>): Promise<void> {
    requestDone(data);
  }
  async removeDepartment(id: number): Promise<void> {
    return this.http.get('/hr/department/remove', { id });
  }

  @Get('/basic/job/all')
  async getJobList(): Promise<BasicData.Job[]> {
    requestDone();
  }
  @Post('/basic/job/add')
  async addJob(data: Partial<BasicData.Job>): Promise<void> {
    requestDone(data);
  }
  @Post('/basic/job/update')
  async updateJob(data: Partial<BasicData.Job>): Promise<void> {
    requestDone(data);
  }
  async removeJob(id: number): Promise<void> {
    return this.http.get('/basic/job/remove', { id });
  }
}
