package com.brilliance.isc.swift.objmtconvert.model.mx.common;

import com.brilliance.isc.swift.objmtconvert.ext.XmlDate;
import lombok.Data;

import java.util.Arrays;
import java.util.List;

/**
 * @author : zxg
 * @data : Created in 2023/4/23
 * @description : 参数校验规则 .*(\+|-)((0[0-9])|(1[0-3])):[0-5][0-9]
 */
@Data
public class SttlmTmReq {

    /**
     * 记入CLS银行在中央银行的账户的时间
     */
    private String clsTm;

    /**
     * 到付款可能结清的时间
     */
    private String tillTm;

    /**
     * 付款的时间
     */
    private String frTm;

    /**
     * 付款必须被结算的时间
     */
    private String rjctTm;

    public void setRjctTm(XmlDate rjctTm){
        this.rjctTm = splitTime(rjctTm);
    }

    public void setClsTm(XmlDate clsTm) {
        this.clsTm = splitTime(clsTm);
    }

    public void setTillTm(XmlDate tillTm) {
        this.tillTm = splitTime(tillTm);
    }

    public void setFrTm(XmlDate frTm) {
        this.frTm = splitTime(frTm);
    }

    public static String splitTime(XmlDate date){
        String str = date.toString();
        List<String> list = Arrays.asList(str.split("[),T]"));
        return list.get(1);
    }
}
