import { CrudClient } from "../infra/crud-client"
import { type ApiClientOptions } from "../infra/client"
import type { ApiPath } from "../infra/types"

export const SERVICE_GROUP_INCLUDE_ROUTES = {
    INDEX: "/api/service-group-includes",
    BY_ID: "/api/service-group-includes/{id}",
    CHANGE_ARRANGEMENT: "/api/service-group-includes/{id}/change-arrangement",
} as const satisfies Record<string, ApiPath>

export class ServiceGroupIncludesClient extends CrudClient<
    typeof SERVICE_GROUP_INCLUDE_ROUTES.INDEX,
    typeof SERVICE_GROUP_INCLUDE_ROUTES.BY_ID
> {
    constructor(baseUrl?: string, defaultOptions?: ApiClientOptions) {
        super(baseUrl, defaultOptions, SERVICE_GROUP_INCLUDE_ROUTES.INDEX, SERVICE_GROUP_INCLUDE_ROUTES.BY_ID)
    }

    async changeArrangement(id: string, payload: { arrangement?: number }) {
        return this.post(SERVICE_GROUP_INCLUDE_ROUTES.CHANGE_ARRANGEMENT, payload as never, { params: { id } } as never)
    }
}
