package com.red.circle.order.app.dto.clientobject;

import com.red.circle.framework.dto.DTO;
import com.red.circle.order.app.enums.PayMaxV2ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;

/**
 * 响应结果2.0.
 *
 * @author lixiaofei on 2024/7/25
 */
@EqualsAndHashCode(callSuper = true)
@Slf4j
@Data
@Accessors(chain = true)
public class PayerMaxResponseV2CO extends DTO implements Serializable {

  private static final long serialVersionUID = 1L;
  /**
   * 返回码.
   */
  private String code = "SUCCESS";
  private String msg = "Success";

  public PayerMaxResponseV2CO(String code, String msg) {
  }

  public static PayerMaxResponseV2CO success(PayMaxV2ErrorCode errorCode) {
    return builder().code(errorCode.getCode()).msg(errorCode.getMsg().toLowerCase()).build();
  }

  public static PayerMaxResponseV2CO createFail(PayMaxV2ErrorCode errorCode) {
    return builder().code(errorCode.getCode()).msg(errorCode.getMsg().toLowerCase()).build();
  }

  public static PayMaxResponseBuilder builder() {
    return new PayMaxResponseBuilder();
  }


  public static class PayMaxResponseBuilder {
    private String code;
    private String msg;

    PayMaxResponseBuilder() {
    }

    public PayMaxResponseBuilder code(final String code) {
      this.code = code;
      return this;
    }

    public PayMaxResponseBuilder msg(final String msg) {
      this.msg = msg;
      return this;
    }

    public PayerMaxResponseV2CO build() {
      return new PayerMaxResponseV2CO(this.code, this.msg);
    }

    public String toString() {
      return "PayerMaxResponseV2CO.PayMaxResponseBuilder(code=" + this.code + ", msg=" + this.msg + ")";
    }
  }
}
