using System;
using Verse;
using RimWorld;

namespace SCE
{
    public class PawnRelationInfo : IExposable
    {
        public Pawn pawn;
        public Pawn otherPawn;
        public int startTicks;

        public PawnRelationInfo() {  }

        public PawnRelationInfo(Pawn pawn, DirectPawnRelation relation)
        {
            this.pawn = pawn;
            otherPawn = relation.otherPawn;
            startTicks = relation.startTicks;
        }

        public bool IsBetween(Pawn first, Pawn second)
        {
            return (pawn == first && otherPawn == second) || (pawn == second && otherPawn == first);
        }

        public bool Involves(Pawn pawn)
        {
            return this.pawn == pawn || otherPawn == pawn;
        }

        public void Deconstruct(out Pawn pawn, out Pawn otherPawn)
        {
            pawn = this.pawn;
            otherPawn = this.otherPawn;
        }

        public void ExposeData()
        {
            Scribe_References.Look(ref pawn, "pawn");
            Scribe_References.Look(ref otherPawn, "otherPawn");
            Scribe_Values.Look(ref startTicks, "startTicks");
        }
    }
}