package com.red.circle.other.app.dto.cmd.pet;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.red.circle.common.business.dto.cmd.AppExtCommand;
import jakarta.validation.constraints.NotNull;
import java.io.Serial;
import java.util.Objects;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 宠物喂养.
 *
 * @author pengliang on 2021/11/4
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PetCurrentFeedingCmd extends AppExtCommand {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 0.免费喂养 1.正常喂养 2.加速喂养.
   *
   * @eo.required
   */
  @NotNull(message = "feedType required.")
  private Integer feedType;

  /**
   * 用户id.
   *
   * @eo.required
   */
  @NotNull(message = "userId required")
  @JsonSerialize(using = ToStringSerializer.class)
  private Long userId;

  public Long getUid() {
    return Objects.nonNull(userId) ? userId : getUserId();
  }

}
