package com.style24.persistence.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.style24.core.support.session.TscSession;
import com.style24.core.support.util.CryptoUtils;
import com.style24.core.support.util.MaskingUtils;
import com.style24.persistence.TscBaseDomain;

import lombok.Data;

/**
 * 재입고 알림 Domain
 *
 * @author eskim
 * @since 2020. 12. 16
 */
@SuppressWarnings("serial")
@Data
public class ReinboundInform extends TscBaseDomain {

	private Integer rinbdInfoSq;
	private int custNo;
	private String goodsCd;
	private String optCd;
	private String optCd1;
	private String optCd2;
	private String reqDt;
	private String informDt;
	private int pastDays;

	private String custId;
	private String brandEnm;
	private String GoodsNm;
	private String custNm;
	private String cellPhnno;
	private String goodsStat;
	private String optCd1Nm;
	private String sysImgNm;
	private int currStockQty;
	private String soldoutYn;

	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
	private String[] arrRinbdInfoSq;

	// 암호화 대상 복호화 처리
	public String getCustNm() {
		this.custNm = CryptoUtils.decryptAES(this.custNm);
		return this.custNm;
	}
	
	public String getCellPhnno() {
		this.cellPhnno = CryptoUtils.decryptAES(this.cellPhnno);
		return this.cellPhnno;
	}

	// Masking
	public String getMaskingCustId() {
		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.id(this.custId) : this.custId;
	}

	public String getMaskingCustNm() {
		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.name(getCustNm()) : getCustNm();

	}
	
}
