package com.red.circle.other.app.inner.endpoint.activity;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.activity.GlobalizationDescriptionClientService;
import com.red.circle.other.inner.endpoint.activity.api.ActivityGlobalizationDescriptionClientApi;
import com.red.circle.other.inner.model.dto.activity.ActivityGlobalizationDescriptionDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动国际化语言描述.
 *
 * @author pengliang on 2023/10/8
 */
@Validated
@RestController
@RequestMapping(value = ActivityGlobalizationDescriptionClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ActivityGlobalizationDescriptionClientEndpoint implements
    ActivityGlobalizationDescriptionClientApi {

  private final GlobalizationDescriptionClientService globalizationDescriptionClientService;

  @Override
  public ResultResponse<List<ActivityGlobalizationDescriptionDTO>> listByRelationId(
      Long relationId) {
    return ResultResponse.success(
        globalizationDescriptionClientService.listByRelationId(relationId));
  }

  @Override
  public ResultResponse<Void> saveOrUpdate(ActivityGlobalizationDescriptionDTO dto) {
    globalizationDescriptionClientService.saveOrUpdate(dto);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> deleteById(Long id) {
    globalizationDescriptionClientService.deleteById(id);
    return ResultResponse.success();
  }

}
