%clear all
%clc
m = 0.89;
mdp = 0.55;
phih = 0;
phie = 0;
psi = 0;
delta = 0.03;
beta = 0.99;
betadp = 0.95;
gamma = 0.98;
nuA = 0.05;
mu = 0.3;
j = 0.1;
eta = 1.01;
epsilon = 21;
gammay = 0.00453;
phi = 1 - 0.08/4;
%gammay = 0;
lambdass = 0.2/4;
rholam = 0.925;


%omega = 0.5;
%for i = 1:100
R = (1+gammay)/beta;
Pi = 1;
YA = 1;
YB = 1;
XA = epsilon/(epsilon-1);
XB = epsilon/(epsilon-1);
X = XA;

F = (1-1/X)*(YA);


%qhA = gamma*nuA/(1-(1-(1+gammay)*m)*gamma-(1+gammay)*m*beta)*YA/X;
qhA = gamma*nuA/(1-gamma-m*(beta-gamma))*YA/X;


bA = m*(qhA)*beta;

%KA = (gamma*mu/(1-gamma*(1-delta)))*YA/X;

KA = (mu * YA * (1+gammay)/X)/(  (1+gammay)/gamma*(1+psi*gammay/delta)-psi/delta*gammay*(gammay-delta) + psi/(2*delta)*gammay^2-(1+psi/delta*gammay)*(1-delta)  )
IA = (gammay+delta)/(1+gammay)*KA;

wpALpA = (1-mu-nuA)*YA/X;

%wdpALdpA = (1-alpha)*(1-mu-nuA)*YA/X;

%CA = YA/X + bA - bA/beta - wpALpA - wdpALdpA-IA;
CA = YA/X + bA - bA/beta - wpALpA -IA;

lambdaA = (beta-gamma)/(CA*(1+gammay));

%qhdp = j/(1-betadp-mdp*(beta-betadp))*Cdp

%bdp = mdp*beta*consA*Cdp
consA = (j*mdp*beta)/(1-betadp-mdp*(beta-betadp));
Cdp = 0
Cp = YA-CA-(gammay+delta)/(1+gammay)*KA;
bdp = 0
bp = -bA;

LpA = 1;

LdpA = 0;


wpA = ((1-mu-nuA)*YA/X)/LpA;

wdpA = 0;

lambdadp = 0;





%%%%%%%%%%%%%%%%%%%%%%%%%%
%CALCULATING hA hB hp hdp%
%%%%%%%%%%%%%%%%%%%%%%%%%%


%C = j/(1-beta);
%A = gamma*nuA/((1-(1-m)*gamma-m*beta)*X);
%B = j/(1-1*(beta)); % or equals J

%hA = 1/(1 + C*Cp/(A*YA));
%hA = 1/(1+nuB*YB/(nuA*YA) + A/(B*YA) + (C/A)*(Cdp/Cp)*(A/(B*YA)));
%hp = C*Cp/(A*YA)*hA;
%hdp = 0

%q = j/(1-beta)*Cp/hp;


qhp = j/(1-beta)*Cp;

q = qhp + qhA;
hp = qhp/q;
hA = qhA/q;

uA = 1/CA*(1+psi/delta*gammay);

AA = YA/(KA^mu*hA^nuA*LpA^((1-mu-nuA)));

gammaa = (1+gammay)^(  (1-mu)/(X-1)  )-1;

VA = (YA/X-wpA)*(1+gammaa)/(1+gammaa-phi*beta);
ZA = (1+gammaa+lambdass*phi-phi)/(lambdass*phi);
JZ = (phi*beta*lambdass*(1-rholam))/(  1+gammaa - phi*beta*(1-lambdass+rholam*lambdass))*VA*ZA;
wsLZsa = rholam*lambdass*phi*beta/(1+gammaa)*(VA*ZA-JZ);
wsLsr = beta*JZ*(1+gammaa-phi)/(1+gammaa);
Ls = 1;
ws = (1-1/ZA)*wsLZsa + wsLsr;
LZsa = wsLZsa/ws;
Lsr = wsLsr/ws;
A = 1;
save params AA

names =  {'bA' 'bp' 'KA' 'IA' 'CA' 'Cp' 'lambdaA' 'LpA' 'wpA' 'hA' 'hp' 'q' 'uA' 'VA' 'ZA' 'JZ' 'Ls' 'ws' 'LZsa' 'Lsr' 'A'};
%AA/AB
for i = 1:size(names,2);
    SteadyState.(char(names(i))) = eval(char(names(i)));
end
