package sizebay.catalog.client.model;

import com.fasterxml.jackson.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.UUID;
import static java.time.LocalDateTime.now;

@Data
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Profile implements Serializable {

     private static final BigDecimal DAYS_OF_YEAR = new BigDecimal(365.2425D);

     long id;
     String userId;
     String name;
     String gender;
     int age;
     int weight;
     double height;
     int bodyShapeChest;
     int bodyShapeWaist;
     int bodyShapeHip;
     int footShape;
     boolean ignoreGender;

     int isActive;
     long lastActiveTime;

     ProfileMeasurements measures;
     ProfileProduct product;

    @JsonGetter
    public String getIdView() {return Long.toString(this.id);}

     public Date getBirth(int age) {
          final int days = new BigDecimal(age).multiply(DAYS_OF_YEAR).intValue();
          final ZonedDateTime then = now().minusDays(days).atZone(ZoneId.systemDefault());

          return ( Date.from(then.toInstant()));
     }

     public void generateIdentifier() {
          long val;
          do {
               val = UUID.randomUUID().getMostSignificantBits();
          } while (val < 0);
          this.setId(val);
     }

}

@@ -1501,10 +1501,490 @@
      %7D%0A%0A
+     public String getAgeGroup(final String productAgeGroup) %7B%0A    %09%09final boolean isGrayZone = this.getAge() %3E= 12 && this.getAge() %3C= 16;%0A%0A    %09%09if(isGrayZone && productAgeGroup != null) %7B%0A%09%09%09%09%09try %7B%0A%09%09%09%09%09%09return Product.AgeGroupEnum.valueOf(productAgeGroup).name();%0A%09%09%09%09%09%7D catch (IllegalArgumentException e) %7B%0A%09%09%09%09%09%09return null;%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%0A%09%09%09%09if(this.getAge() %3E 13) %7B%0A%09%09%09%09%09return Product.AgeGroupEnum.ADULT.name();%0A%09%09%09%09%7D%0A%0A%09%09%09%09return Product.AgeGroupEnum.KIDS.name();%0A%09%09 %7D%0A%0A
 %7D%0A

create getAgeGroup method in Profile