/**
 * Copyright © 2018 spring-data-dynamodb (https://github.com/boostchicken/spring-data-dynamodb)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.socialsignin.spring.data.dynamodb.domain.sample;

import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexRangeKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperFieldModel.DynamoDBAttributeType;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTyped;
import org.springframework.data.annotation.Id;

import java.util.Date;

@DynamoDBTable(tableName = "feed_user")
public class FeedUser {
	@Id
	@DynamoDBHashKey
	@DynamoDBAutoGeneratedKey
	private String id;

	@DynamoDBIndexHashKey(globalSecondaryIndexName = "idx_global_usrNo_feedOpenYn")
	private int usrNo;

	@DynamoDBAttribute
	private String feedId;

	@DynamoDBAttribute
	private Date feedRegDate;

	@DynamoDBAttribute
	@DynamoDBTyped(DynamoDBAttributeType.N) // For backwards compatibility with old versions, DynamoDBMapper booleans
											// are
											// serialized using the DynamoDB N type so this is not strictly required.
											// This
											// is here purely to test the DynamoDBMapper v2 conversion schemas using new
											// non-deprecated annotations. NOTE: this introduces an important change in
											// *internal* behaviour where @DynamoDBNativeBoolean will no longer be
											// translated
											// to DynamoDB type N. Instead, it would be correctly mapped to type BOOL
											// which
											// would cause this test to fail given that only scalar (B, N or S) types
											// are
											// allowed key types
	@DynamoDBIndexRangeKey(globalSecondaryIndexName = "idx_global_usrNo_feedOpenYn")
	private boolean feedOpenYn;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getUsrNo() {
		return usrNo;
	}

	public void setUsrNo(int usrNo) {
		this.usrNo = usrNo;
	}

	public String getFeedId() {
		return feedId;
	}

	public void setFeedId(String feedId) {
		this.feedId = feedId;
	}

	public Date getFeedRegDate() {
		return feedRegDate;
	}

	public void setFeedRegDate(Date feedRegDate) {
		this.feedRegDate = feedRegDate;
	}

	public boolean isFeedOpenYn() {
		return feedOpenYn;
	}

	public void setFeedOpenYn(boolean feedOpenYn) {
		this.feedOpenYn = feedOpenYn;
	}
}
