package org.pac4j.core.context;

import org.pac4j.core.exception.TechnicalException;

/**
 * @author Misagh Moayyed
 * @since 1.8.1
 */
public final class Cookie {

    private String name;
    private String value;
    private String domain;
    private int maxAge = -1;
    private String path;
    private boolean secure;
    private boolean isHttpOnly = false;
    private String sameSitePolicy;

    public Cookie(final String name, final String value) {
        if (name == null || name.length() == 0) {
            throw new TechnicalException("cookie name and value cannot be empty");
        }
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public int getMaxAge() {
        return maxAge;
    }

    public void setMaxAge(int maxAge) {
        this.maxAge = maxAge;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public boolean isSecure() {
        return secure;
    }

    public void setSecure(boolean secure) {
        this.secure = secure;
    }

    public boolean isHttpOnly() {
        return isHttpOnly;
    }

    public void setHttpOnly(boolean httpOnly) {
        isHttpOnly = httpOnly;
    }

    public String getSameSitePolicy() { return sameSitePolicy; }

    public void setSameSitePolicy(String sameSitePolicy) { this.sameSitePolicy = sameSitePolicy; }

}

@@ -392,16 +392,44 @@
 ePolicy;
+%0A    private String comment;
 %0A%0A    pu
@@ -767,16 +767,22 @@
 setName(
+final 
 String n
@@ -906,16 +906,22 @@
 etValue(
+final 
 String v
@@ -1051,16 +1051,22 @@
 tDomain(
+final 
 String d
@@ -1196,16 +1196,22 @@
 tMaxAge(
+final 
 int maxA
@@ -1335,16 +1335,22 @@
 setPath(
+final 
 String p
@@ -1477,16 +1477,22 @@
 tSecure(
+final 
 boolean 
@@ -1634,16 +1634,22 @@
 ttpOnly(
+final 
 boolean 
@@ -1798,16 +1798,22 @@
 ePolicy(
+final 
 String s
@@ -1870,10 +1870,163 @@
 icy; %7D%0A%0A
+    public String getComment() %7B%0A        return comment;%0A    %7D%0A%0A    public void setComment(final String comment) %7B%0A        this.comment = comment;%0A    %7D%0A
 %7D%0A

add comment in cookie