/*
 * SDK Pullenti Unitext, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software. 
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

package com.pullenti.unitext.internal.zip;

// Class representing extended unix date time values.
public class ExtendedUnixData implements ITaggedData {

    @Override
    public short getTagID() {
        return (short)0x5455;
    }


    @Override
    public void setData(byte[] data, int index, int count) {
        return;
    }

    @Override
    public byte[] getData() {
        return new byte[0];
    }

    public static boolean isValidValue(java.time.LocalDateTime value) {
        return ((value.compareTo(java.time.LocalDateTime.of(1901, 12, 13, 20, 45, 52)) >= 0) || (value.compareTo(java.time.LocalDateTime.of(2038, 1, 19, 3, 14, 7)) <= 0));
    }

    public java.time.LocalDateTime getModificationTime() {
        return _modificationTime;
    }

    public java.time.LocalDateTime setModificationTime(java.time.LocalDateTime value) throws IndexOutOfBoundsException {
        if (!isValidValue(value)) 
            throw new IndexOutOfBoundsException("value");
        _flags = Flags.of((byte)((_flags.value()) | (Flags.MODIFICATIONTIME.value())));
        _modificationTime = value;
        return value;
    }


    public java.time.LocalDateTime getAccessTime() {
        return _lastAccessTime;
    }

    public java.time.LocalDateTime setAccessTime(java.time.LocalDateTime value) throws IndexOutOfBoundsException {
        if (!isValidValue(value)) 
            throw new IndexOutOfBoundsException("value");
        _flags = Flags.of((byte)((_flags.value()) | (Flags.ACCESSTIME.value())));
        _lastAccessTime = value;
        return value;
    }


    public java.time.LocalDateTime getCreateTime() {
        return _createTime;
    }

    public java.time.LocalDateTime setCreateTime(java.time.LocalDateTime value) throws IndexOutOfBoundsException {
        if (!isValidValue(value)) 
            throw new IndexOutOfBoundsException("value");
        _flags = Flags.of((byte)((_flags.value()) | (Flags.CREATETIME.value())));
        _createTime = value;
        return value;
    }


    private Flags getInclude() {
        return _flags;
    }

    private Flags setInclude(Flags value) {
        _flags = value;
        return value;
    }


    private Flags _flags = Flags.MODIFICATIONTIME;

    private java.time.LocalDateTime _modificationTime = java.time.LocalDateTime.of(1970, 1, 1, 0, 0, 0);

    private java.time.LocalDateTime _lastAccessTime = java.time.LocalDateTime.of(1970, 1, 1, 0, 0, 0);

    private java.time.LocalDateTime _createTime = java.time.LocalDateTime.of(1970, 1, 1, 0, 0, 0);

    // Flags indicate which values are included in this instance.
    public static class Flags implements Comparable<Flags> {
    
        public static final Flags MODIFICATIONTIME; // (byte)0x01
    
        public static final Flags ACCESSTIME; // (byte)0x02
    
        public static final Flags CREATETIME; // (byte)0x04
    
    
        public byte value() { return m_val; }
        private byte m_val;
        private String m_str;
        private Flags(byte val, String str) { m_val = val; m_str = str; }
        @Override
        public String toString() {
            if(m_str != null) return m_str;
            return ((Byte)m_val).toString();
        }
        @Override
        public int hashCode() {
            return (int)m_val;
        }
        @Override
        public int compareTo(Flags v) {
            if(m_val < v.m_val) return -1;
            if(m_val > v.m_val) return 1;
            return 0;
        }
        private static java.util.HashMap<Byte, Flags> mapIntToEnum; 
        private static java.util.HashMap<String, Flags> mapStringToEnum; 
        private static Flags[] m_Values; 
        private static java.util.Collection<Byte> m_Keys; 
        public static Flags of(byte val) {
            if (mapIntToEnum.containsKey(val)) return mapIntToEnum.get(val);
            Flags item = new Flags(val, ((Byte)val).toString());
            mapIntToEnum.put(val, item);
            mapStringToEnum.put(item.m_str.toUpperCase(), item);
            return item; 
        }
        public static Flags of(String str) {
            str = str.toUpperCase(); 
            if (mapStringToEnum.containsKey(str)) return mapStringToEnum.get(str);
            return null; 
        }
        public static boolean isDefined(Object val) {
            if(val instanceof Byte) return m_Keys.contains((Byte)val); 
            return false; 
        }
        public static Flags[] getValues() {
            return m_Values; 
        }
        static {
            mapIntToEnum = new java.util.HashMap<Byte, Flags>();
            mapStringToEnum = new java.util.HashMap<String, Flags>();
            MODIFICATIONTIME = new Flags((byte)((byte)0x01), "MODIFICATIONTIME");
            mapIntToEnum.put(MODIFICATIONTIME.value(), MODIFICATIONTIME);
            mapStringToEnum.put(MODIFICATIONTIME.m_str.toUpperCase(), MODIFICATIONTIME);
            ACCESSTIME = new Flags((byte)((byte)0x02), "ACCESSTIME");
            mapIntToEnum.put(ACCESSTIME.value(), ACCESSTIME);
            mapStringToEnum.put(ACCESSTIME.m_str.toUpperCase(), ACCESSTIME);
            CREATETIME = new Flags((byte)((byte)0x04), "CREATETIME");
            mapIntToEnum.put(CREATETIME.value(), CREATETIME);
            mapStringToEnum.put(CREATETIME.m_str.toUpperCase(), CREATETIME);
            java.util.Collection<Flags> col = mapIntToEnum.values();
            m_Values = new Flags[col.size()];
            col.toArray(m_Values);
            m_Keys = new java.util.ArrayList<Byte>(mapIntToEnum.keySet());
        }
    }

    public ExtendedUnixData() {
    }
    public static ExtendedUnixData _globalInstance;
    
    static {
        try { _globalInstance = new ExtendedUnixData(); } 
        catch(Exception e) { }
    }
}
