package com.fs.task.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ServiceConfirmStatusEnum {

    PENDING(1L, "待生成"),
    GENERATED(2L, "已生成");

    private final Long code;
    private final String name;

    public static ServiceConfirmStatusEnum of(Long code) {
        if (code == null) return null;
        for (ServiceConfirmStatusEnum e : values()) {
            if (e.code.equals(code)) return e;
        }
        throw new IllegalArgumentException("Unknown ServiceConfirmStatus code: " + code);
    }

    public boolean isPending() { return this == PENDING; }
    public boolean isGenerated() { return this == GENERATED; }
}
